From 2495f1e6e8c25038881c9796b1061062fc73d2d2 Mon Sep 17 00:00:00 2001 From: alpha nerd Date: Sun, 19 Jul 2026 11:10:36 +0200 Subject: [PATCH] fix: repair npm install and the rollup build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three independent breakages, all present on main before this branch: 1. `npm ci` always exited non-zero. The root package.json carried "install": "node-gyp-build", but binding.gyp lives in native/, so the script ran in a directory with nothing to build: gyp: binding.gyp not found (cwd: ) native/package.json already declares that same install script in the right place, alongside its binding.gyp and "gypfile": true, so the root copy was a duplicate in the wrong package. Removing it also clears the now-inaccurate hasInstallScript flag from the lockfile. `npm ci` exits 0 again; the addon still builds from native/. 2. `npm run build` failed at the first step. @rollup/plugin-typescript requires tslib as a peer, and nothing depended on it directly — it was only present transitively as an optional dev dep, so a clean install could omit it entirely. Declared explicitly. 3. rollup.config.js used ESM syntax while package.json has no "type": "module", so Node parsed it as CommonJS and threw "Cannot use import statement outside a module". Node 24 recovers by reparsing (with a warning); Node 18 fails outright. Renamed to rollup.config.mjs, which is unambiguous on both. Setting "type": "module" instead would have broken jest.config.js, which is CommonJS. Verified on Node 18.19.1 and Node 24.18.0: npm ci exits 0, npm run build produces all three bundles plus declarations, and 76/76 tests pass. Co-Authored-By: Claude Opus 4.8 --- package-lock.json | 7 +++---- package.json | 2 +- rollup.config.js => rollup.config.mjs | 0 3 files changed, 4 insertions(+), 5 deletions(-) rename rollup.config.js => rollup.config.mjs (100%) diff --git a/package-lock.json b/package-lock.json index 25135b3..39e569a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "nomyo-js", "version": "0.1.0", - "hasInstallScript": true, "license": "Apache-2.0", "devDependencies": { "@rollup/plugin-commonjs": "^29.0.0", @@ -22,6 +21,7 @@ "node-gyp-build": "^4.8.0", "rollup": "^4.0.0", "ts-jest": "^29.4.6", + "tslib": "^2.8.1", "typescript": "^6.0.0" }, "engines": { @@ -5975,7 +5975,7 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, - "optional": true + "license": "0BSD" }, "node_modules/type-detect": { "version": "4.0.8", @@ -10642,8 +10642,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, - "optional": true + "dev": true }, "type-detect": { "version": "4.0.8", diff --git a/package.json b/package.json index 3f6624b..10da001 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "build:types": "tsc --emitDeclarationOnly", "test": "jest", "test:browser": "karma start", - "install": "node-gyp-build", "prepublishOnly": "npm run build && npm test" }, "keywords": [ @@ -62,6 +61,7 @@ "node-gyp-build": "^4.8.0", "rollup": "^4.0.0", "ts-jest": "^29.4.6", + "tslib": "^2.8.1", "typescript": "^6.0.0" }, "optionalDependencies": { diff --git a/rollup.config.js b/rollup.config.mjs similarity index 100% rename from rollup.config.js rename to rollup.config.mjs