Skip to content

Commit

Permalink
chore(ci): improve npm publish logic (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackHole1 authored Oct 25, 2023
1 parent de7c4dc commit 7f4aa80
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"clean": "cargo clean && rimraf lib",
"build": "pnpm clean && ./scripts/cross-build.sh && tsup-node",
"build:debug": "pnpm clean && napi build --platform lib && tsup-node",
"prepublishOnly": "pnpm build"
"prepublishOnly": "./scripts/prepublish-only.sh"
},
"devDependencies": {
"@napi-rs/cli": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/cross-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ platform_list=("x86_64-apple-darwin" "aarch64-apple-darwin")

for platform in "${platform_list[@]}"
do
echo "napi build --platform --target $platform --release lib"
napi build --platform --target $platform --release lib
echo "pnpm exec napi build --platform --target $platform --release lib"
pnpm exec napi build --platform --target $platform --release lib
done
8 changes: 8 additions & 0 deletions scripts/prepublish-only.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -o pipefail

if [ -z $CI]; then
pnpm run build;
else
exit 0;
fi;

0 comments on commit 7f4aa80

Please sign in to comment.