fix(node): commit npm/<platform>/ templates + optionalDependencies
`napi create-npm-dir` failed in CI with both invocations we tried:
positional arg form (`-t <triple> .`) was rejected as extraneous,
and the no-arg form crashed with "path must be a string, received
undefined". The fix used by every napi-rs reference project: commit
the four platform package.json templates directly under
bindings/node/npm/<target>/ instead of generating them at publish time.
- bindings/node/npm/{linux-x64-gnu,darwin-x64,darwin-arm64,win32-x64-msvc}/
each contain a static package.json with the correct os / cpu / libc
filters so npm only installs the right binary per platform.
- Main package.json gains optionalDependencies referencing all four
platform packages by version, so `npm install wickra` pulls the
matching binary on each user's machine.
- Release workflow drops the broken `create-npm-dir` loop. The
`napi artifacts` step now just copies the .node files from the
build artefacts into the existing npm/ directories before publish.
Bump every version to 0.1.2; cargo / pypi / wickra-wasm jobs are
idempotent so they accept the 0.1.1 they already published while still
emitting the new 0.1.2.
This commit is contained in:
@@ -181,13 +181,9 @@ jobs:
|
||||
path: bindings/node/artifacts
|
||||
pattern: bindings-*
|
||||
|
||||
- name: Create npm/<platform>/ scaffolding (one per target)
|
||||
working-directory: bindings/node
|
||||
run: |
|
||||
for t in x86_64-unknown-linux-gnu x86_64-apple-darwin aarch64-apple-darwin x86_64-pc-windows-msvc; do
|
||||
npx napi create-npm-dir -t "$t" .
|
||||
done
|
||||
|
||||
# The npm/<platform>/package.json templates are committed to the
|
||||
# repo (see bindings/node/npm/), so `napi artifacts` only needs to
|
||||
# drop the freshly built .node binary into the matching directory.
|
||||
- name: Move binaries into platform package layout
|
||||
working-directory: bindings/node
|
||||
run: npx napi artifacts --dir artifacts
|
||||
|
||||
Reference in New Issue
Block a user