Publishing is split into two layers:
- scoped platform packages with the native
.nodebinaries - the main
node-wreqpackage with JS, types, loader logic, andoptionalDependencies
The publish version can be overridden at staging time with NODE_WREQ_PUBLISH_VERSION.
That lets CI publish from the GitHub release tag even if the repository's root package.json
stays on a placeholder or development version locally.
When published, the package includes:
- main package:
- CommonJS output in
dist/ - ESM wrapper output in
dist/ - Type declarations in
dist/ optionalDependenciespointing at the scoped native packages
- CommonJS output in
- scoped platform packages:
- one native
.nodebinary each
- one native
Scoped package names:
@node-wreq/darwin-x64@node-wreq/darwin-arm64@node-wreq/linux-x64-gnu@node-wreq/linux-arm64-gnu@node-wreq/linux-x64-musl@node-wreq/win32-x64-msvc
- npm account with package publish permissions
- GitHub repository set up
- npm trusted publishing configured for each package you publish from this workflow
# Bump version using npm
npm version patch # 0.1.0 → 0.1.1
npm version minor # 0.1.0 → 0.2.0
npm version major # 0.1.0 → 1.0.0# Push version tag
git push --follow-tags
# Or manually create tag
git tag v0.1.0
git push origin v0.1.0Then create a GitHub Release from this tag. This will trigger the build workflow.
GitHub Actions will automatically:
- Build native binaries for all configured platforms
- Publish one scoped package per platform artifact
- Build the JS outputs
- Stage the main package with generated
optionalDependencies - Publish the main package to npm
Workflow requirements for trusted publishing:
- the trusted publisher must point at this repository and the exact workflow filename:
.github/workflows/build.yml - publish jobs must run on GitHub-hosted runners
- publish jobs need
permissions.id-token: write - no
NPM_TOKENis required for thenpm publishsteps
Release tag behavior:
- prereleases publish with npm dist-tag
rc - stable releases publish with npm dist-tag
latest - the published package version is derived from the GitHub release tag, for example
v1.0.0-rc2->1.0.0-rc2
# Build everything
npm run build
# Run tests
npm test
# Stage the publishable main package
npm run prepare:publish:main -- .release/main-package
# Inspect staged files
find .release/main-package -maxdepth 3 -type f | sortIf you really need to publish a scoped platform package manually:
# Example: build a target
npm run build:rust -- --target x86_64-unknown-linux-musl
# Stage the scoped package
NODE_WREQ_PUBLISH_VERSION=1.0.0-rc2 node ./scripts/prepare-platform-package.mjs \
--target x86_64-unknown-linux-musl \
--binary rust/node-wreq.linux-x64-musl.node \
--outDir .release/linux-x64-musl
# Publish it
npm publish .release/linux-x64-musl --access publicAfter the platform packages for the same version exist:
npm run build:ts
NODE_WREQ_PUBLISH_VERSION=1.0.0-rc2 npm run prepare:publish:main -- .release/main-package
npm publish .release/main-package --access publicUse GitHub Actions unless you have a specific reason not to.
- Check that all platform targets are properly configured
- Verify Rust toolchain is installed correctly
- Check CMake is available (required for BoringSSL)
- Verify the matching scoped package for the user's platform was published
- Verify the main package version and platform package versions match
- Check that the loader can resolve the correct package for the user's platform