Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: include type definitions when publishing #21

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

achou11
Copy link
Member

@achou11 achou11 commented Sep 27, 2024

Mainly:

  • Sets up type defs generation
  • Updates npm package setup to include generated types
  • BREAKING CHANGE: renames the exports to include the .js suffix at the end, which I believe is generally recommended/idiomatic. Not strictly necessary for us to do so open to reverting that change if preferred

Should introduce noUncheckedIndexedAccess in the tsconfig as a follow-up but it will lead to errors that will require code changes outside the scope of this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes here related to TransformOptions are not ideal but they were causing an error when emitting declarations via npm run build:types.

Error was:

lib/utils/streams.js:1:1 - error TS9006: Declaration emit for this file requires using private name '_IReadable' from module '"/Users/andrewchou/GitHub/digidem/styled-map-package/node_modules/@types/readable-stream/index"'. An explicit type annotation may unblock declaration emit.

1 import { Readable, Writable, Transform } from 'readable-stream'

@@ -80,6 +89,7 @@
"png-stream": "^1.0.5",
"prettier": "^3.3.3",
"random-bytes-readable-stream": "^3.0.0",
"rimraf": "^4.4.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinned to v4 since >= v5 removes support for node 18

Comment on lines +19 to +24
"files": [
"bin",
"dist",
"lib",
"map-viewer"
],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about including map-viewer. anything else to include here otherwise?

@achou11 achou11 marked this pull request as ready for review September 27, 2024 18:28
@achou11 achou11 changed the title fix: include type definitions when publishing fix!: include type definitions when publishing Sep 27, 2024
Comment on lines +6 to +33
".": {
"types": "./dist/index.d.ts",
"import": "./lib/index.js"
},
"./reader.js": {
"types": "./dist/reader.d.ts",
"import": "./lib/reader.js"
},
"./writer.js": {
"types": "./dist/writer.d.ts",
"import": "./lib/writer.js"
},
"./server.js": {
"types": "./dist/server.d.ts",
"import": "./lib/server.js"
},
"./style-downloader.js": {
"types": "./dist/style-downloader.d.ts",
"import": "./lib/style-downloader.js"
},
"./tile-downloader.js": {
"types": "./dist/tile-downloader.d.ts",
"import": "./lib/tile-downloader.js"
},
"./download.js": {
"types": "./dist/download.d.ts",
"import": "./lib/download.js"
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes here informed by publint, which is generally a super helpful tool that i've become reliant on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant