-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 napi double .d.ts formatting #9238
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
flags="\ | ||
--platform \ | ||
-p turborepo-napi \ | ||
--cargo-cwd ../../ \ | ||
--cargo-name turborepo_napi \ | ||
native \ | ||
--js false \ | ||
" | ||
|
||
if [ "$1" == "release" ]; then | ||
flags+=" --release" | ||
else | ||
flags+=" --dts ../js/index.d.ts" | ||
fi | ||
|
||
node_modules/.bin/napi build $flags | ||
|
||
# Unfortunately, when napi generates a .d.ts file, it doesn't match our formatting rules (it doesn't have semicolons). | ||
# Since there's now way to configure this from napi itself, so we need to run prettier on it after generating it. | ||
node_modules/.bin/prettier --write js/index.d.ts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could really min/max this by switching the script around a bit and only running prettier when not in release mode (we don't generate the file in release mode for some reason), but I thought it'd be simpler to leave it as-is and just always format. |
||
|
||
mkdir -p js/dist | ||
cp js/index.{js,d.ts} js/dist/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
was it intentional that we, previously, didn't generate the dts file when in release mode?
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.
Probably not, the release process for this package is far more ad-hoc than the primary
turbo
release workflow.