-
Notifications
You must be signed in to change notification settings - Fork 4
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
chore: use tsup for building; package.json exports for better compat #33
Conversation
tsup.config.ts
Outdated
import { defineConfig } from "tsup"; | ||
|
||
export default defineConfig({ | ||
outDir: "dist/lib", | ||
entry: ["./lib/index.ts"], | ||
format: ["cjs", "esm"], | ||
target: "node18", | ||
sourcemap: true, | ||
clean: true, | ||
minify: false, | ||
shims: true, | ||
dts: true, | ||
}); |
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.
This can be moved into package.json
if desired, but when in a typescript/javascript file, you get type hints from your editor, which is why I put it in its own config.
package.json
Outdated
"scripts": { | ||
"prebuildify": "prebuildify --napi --strip", | ||
"install": "node-gyp-build", | ||
"build": "npm run prebuildify && tsc && npm run gen-esm-wrapper", | ||
"build": "npm run prebuildify && tsup", |
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.
tsc
was removed, but with dts: true
, tsup
will call tsc
.
cc @jasnell what can we do to help move this forward? |
cc @mcollina any way to push this forward ? |
I currently do not have time |
@mcollina thanks for letting us know; do you know who else we can reach as maintainers that might have time to review this and move it forward? |
👋 sorry for the delay, I oversight the notification. I will take a look at it this weekend and get back to you. thanks! |
Thank you all !! |
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 resolve the conflicts?
After that, it lgtm
Lint seems failing |
I had to change the
This should be mostly equivalent, except a
and
before this change:
after this change:
|
No worries, that should be fine |
Now there are some C++ compilation errors? Hm |
I'll take a look later Today |
Okay, this one should go through 😅 it was pulling in node 23 headers, which was causing problems. Didn't happen on my machine, because it's a corporate device and it doesn't have access to 23 yet. I added a |
Thanks, that should solve it, now there's an issue with the artifacts we upload; let me fix it so you can rebase with |
Can you update your branch with |
The command doesn't work for windows bc of the subshell. |
Sorry for the extremely long reply, completely missed the PR; |
Swaps the existing build scripts out for tsup and sets package.json exports fields for the best compatibility with typescript.
I tested with the repro from the linked issue with
moduleResolution
modes:bundler
,node
,nodenext
(plusmodule
:nodenext
as that's required), andnode16
- all work with the updated exports field.closes #32