Skip to content

Commit 3afbf8e

Browse files
committed
fix: publish npm sub-packages with --access public before root package
1 parent 213e3b3 commit 3afbf8e

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,20 @@ jobs:
341341
npm config set provenance true
342342
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
343343
TAG_NAME="${{ github.event.release.tag_name }}"
344-
# Determine npm tag: prerelease versions get "next", stable gets "latest"
345344
if echo "$TAG_NAME" | grep -qE "^v?[0-9]+\.[0-9]+\.[0-9]+$"; then
346-
echo "Publishing stable release: $TAG_NAME"
347-
npm publish --access public --provenance
345+
NPM_TAG="latest"
348346
else
349-
echo "Publishing prerelease: $TAG_NAME"
350-
npm publish --tag next --access public --provenance
347+
NPM_TAG="next"
351348
fi
349+
# Publish platform-specific sub-packages first
350+
for dir in npm/*/; do
351+
if [ -f "$dir/package.json" ]; then
352+
echo "Publishing $dir..."
353+
npm publish "$dir" --access public --provenance --tag $NPM_TAG || true
354+
fi
355+
done
356+
# Publish root package
357+
npm publish --access public --provenance --tag $NPM_TAG
352358
env:
353359
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
354360
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"build": "napi build --platform --release --package domparser_napi --js index.js",
6161
"postbuild": "node scripts/postbuild.js",
6262
"build:debug": "napi build --platform --package domparser_napi --js index.js && node scripts/postbuild.js",
63-
"prepublishOnly": "napi prepublish -t npm",
63+
"prepublishOnly": "napi prepublish -t npm --skip-optional-publish",
6464
"test": "node --test",
6565
"benchmark": "node ./benchmark/benchmark.mjs",
6666
"prepare": "husky install"

0 commit comments

Comments
 (0)