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:
kingchenc
2026-05-21 21:16:33 +02:00
parent 371d338a8b
commit 1aa7df1c97
9 changed files with 118 additions and 17 deletions
Generated
+6 -6
View File
@@ -1883,7 +1883,7 @@ dependencies = [
[[package]]
name = "wickra"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"approx",
"criterion",
@@ -1894,7 +1894,7 @@ dependencies = [
[[package]]
name = "wickra-core"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"approx",
"proptest",
@@ -1904,7 +1904,7 @@ dependencies = [
[[package]]
name = "wickra-data"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"approx",
"csv",
@@ -1922,7 +1922,7 @@ dependencies = [
[[package]]
name = "wickra-node"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"napi",
"napi-build",
@@ -1932,7 +1932,7 @@ dependencies = [
[[package]]
name = "wickra-python"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"numpy",
"pyo3",
@@ -1941,7 +1941,7 @@ dependencies = [
[[package]]
name = "wickra-wasm"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"console_error_panic_hook",
"js-sys",