-
-
Notifications
You must be signed in to change notification settings - Fork 11
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: npm and JSR package contents #16
Conversation
const contents = fs.readFileSync(filePath, "utf8"); | ||
|
||
// prepend the reference comment | ||
const newContents = `/// <reference types="./${filename}.d.ts" />\n${contents}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the contents of types.ts
here? This will make the package smaller
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. As I said in the PR description, JSR errors without types.ts
. It needs to stay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant to delete its contents and keep only the triple-slash directive. not delete this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! Leaving open if anyone else would like to review it before merging.
packages/compat/package.json
Outdated
"dist/cjs/index.cjs", | ||
"dist/cjs/index.d.cts", | ||
"dist/cjs/types.ts", | ||
"dist/cjs/types.d.ts", | ||
"dist/esm/index.js", | ||
"dist/esm/index.d.ts", | ||
"dist/esm/types.ts", | ||
"dist/esm/types.d.ts", | ||
"README.md", | ||
"LICENSE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we could just include "dist"
here instead of each single file. BTW, README and LICENSE are included automatically regardless of extension, so it's not required to list them explicitly: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good call. I was copy-pasting between jsr.json
and package.json
.
packages/config-array/package.json
Outdated
"dist/cjs/index.cjs", | ||
"dist/cjs/index.d.cts", | ||
"dist/cjs/types.ts", | ||
"dist/cjs/types.d.ts", | ||
"dist/esm/index.js", | ||
"dist/esm/index.d.ts", | ||
"dist/esm/types.ts", | ||
"dist/esm/types.d.ts", | ||
"README.md", | ||
"LICENSE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as #16 (comment).
packages/object-schema/package.json
Outdated
"dist/cjs/index.cjs", | ||
"dist/cjs/index.d.cts", | ||
"dist/cjs/types.ts", | ||
"dist/cjs/types.d.ts", | ||
"dist/esm/index.js", | ||
"dist/esm/index.d.ts", | ||
"dist/esm/types.ts", | ||
"dist/esm/types.d.ts", | ||
"README.md", | ||
"LICENSE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as #16 (comment).
Co-authored-by: Francesco Trotta <github@fasttime.org>
Co-authored-by: Francesco Trotta <github@fasttime.org>
Updated the |
"dist/esm/types.d.ts", | ||
"README.md", | ||
"LICENSE" | ||
"dist" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
types.ts
again, we don't need it in npm.
@kecrily I'm leaving @fasttime @mdjermanovic ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! Leaving open for @mdjermanovic to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
I'm not worried about its current state, just that it might balloon in the future and the core still needs to be rewritten. Not sure how big core's |
When I tried publishing to JSR, I got several errors. Specifically:
types.ts
file to be present because it is referenced fromindex.js
. Because this is a TypeScript error, I also addedtypes.ts
to the npm package..d.ts
files and so couldn't find the type definitions for the packages, it needs a triple-slash directive. The triple-slash directive must be added aftertsc
is run, otherwise it looks for that file to verify the contents. So I had to add a new tool calledprepend-type-ref.js
that runs aftertsc
in each package.I verified locally via
npx jsr publish --dry-run
that the JSR publish will succeed with these changes.