Release 0.1.1: fix Node publish + bump everything
v0.1.0 reached crates.io, PyPI, and the wickra-wasm npm package, but the wickra Node binding never published because the workflow called `napi create-npm-dirs` (plural). The actual napi CLI command is `create-npm-dir` (singular, per target). Changes that make the next tag's release actually finish: - workflow: replace the broken step with a loop that runs `napi create-npm-dir -t <triple>` for each of our four build targets. - workflow: every registry publish step now treats "version already uploaded" as success. That makes re-runs (and partial-failure recoveries) safe instead of failing the whole job. - bindings/node/package.json: trim the napi.triples list to the four platforms we actually build (linux-x64-gnu, darwin-x64, darwin-arm64, win32-x64-msvc). The previous defaults+9-extras configuration would have made napi prepublish expect platform packages we never produced. - bindings/node/index.js: switch from local-only binary lookup to the proper napi loader that tries the local `.node` file first and falls back to the per-platform npm subpackage that's installed as an optional dependency in production. - Versions across all four published packages bumped to 0.1.1 so the Node binding can publish for the first time alongside refreshed cargo/pypi/wasm artefacts.
This commit is contained in:
+41
-21
@@ -1,30 +1,50 @@
|
||||
/* eslint-disable */
|
||||
/* prettier-ignore */
|
||||
// This loader is generated by `napi build --platform` at publish time. For
|
||||
// editable development just `require` the local debug binary that napi places
|
||||
// at the package root.
|
||||
// Platform-aware loader for the Wickra Node native binding.
|
||||
//
|
||||
// In production (after `npm install wickra`) the actual `.node` binary
|
||||
// lives inside a per-platform subpackage that npm installs as an
|
||||
// optional dependency — e.g. `wickra-linux-x64-gnu`. In development
|
||||
// (after `napi build --platform`) the binary sits next to this file.
|
||||
// We try the local path first and fall back to the subpackage so the
|
||||
// same loader works in both modes.
|
||||
|
||||
const { platform, arch } = process;
|
||||
const { join } = require('node:path');
|
||||
const { existsSync } = require('node:fs');
|
||||
const { platform, arch } = process;
|
||||
|
||||
function loadNative() {
|
||||
// Try precompiled per-platform binary first (published wheels do this).
|
||||
const candidates = [
|
||||
`./wickra.${platform}-${arch}.node`,
|
||||
`./wickra.${platform}-${arch}-musl.node`,
|
||||
'./wickra.node',
|
||||
];
|
||||
for (const c of candidates) {
|
||||
const p = join(__dirname, c);
|
||||
if (existsSync(p)) {
|
||||
return require(p);
|
||||
}
|
||||
const TARGETS = {
|
||||
'linux-x64': 'linux-x64-gnu',
|
||||
'darwin-x64': 'darwin-x64',
|
||||
'darwin-arm64': 'darwin-arm64',
|
||||
'win32-x64': 'win32-x64-msvc',
|
||||
};
|
||||
|
||||
function load() {
|
||||
const key = `${platform}-${arch}`;
|
||||
const target = TARGETS[key];
|
||||
if (!target) {
|
||||
throw new Error(
|
||||
`wickra: this platform/architecture combination is not supported (${key}). ` +
|
||||
'Open an issue at https://github.com/kingchenc/wickra/issues with your platform details.'
|
||||
);
|
||||
}
|
||||
|
||||
const localBinary = join(__dirname, `wickra.${target}.node`);
|
||||
if (existsSync(localBinary)) {
|
||||
return require(localBinary);
|
||||
}
|
||||
|
||||
try {
|
||||
return require(`wickra-${target}`);
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
`wickra: failed to load the native binding for ${key}. ` +
|
||||
`Expected either ${localBinary} or the wickra-${target} package to be installed. ` +
|
||||
`Run \`npm install\` again, or build from source with \`npm run build\`. ` +
|
||||
`Underlying error: ${err.message}`
|
||||
);
|
||||
}
|
||||
throw new Error(
|
||||
`Wickra: no precompiled binary found for ${platform}-${arch}. ` +
|
||||
'Build from source with `napi build --release` or install a platform-specific package.'
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = loadNative();
|
||||
module.exports = load();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wickra",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "Streaming-first technical indicators: incremental, fast, install-free. Node bindings powered by Rust.",
|
||||
"author": "kingchenc <kingchencp@gmail.com>",
|
||||
"main": "index.js",
|
||||
@@ -32,17 +32,12 @@
|
||||
"napi": {
|
||||
"name": "wickra",
|
||||
"triples": {
|
||||
"defaults": true,
|
||||
"defaults": false,
|
||||
"additional": [
|
||||
"x86_64-unknown-linux-musl",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"i686-pc-windows-msvc",
|
||||
"armv7-unknown-linux-gnueabihf",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-linux-android",
|
||||
"x86_64-unknown-freebsd",
|
||||
"aarch64-unknown-linux-musl",
|
||||
"aarch64-pc-windows-msvc"
|
||||
"x86_64-pc-windows-msvc"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user