From dcf40da3a8fd8ee2f9002b16818e67c535fdaed7 Mon Sep 17 00:00:00 2001 From: Abhigyan Patwari Date: Wed, 1 Apr 2026 17:28:14 +0530 Subject: [PATCH] fix: ensure import rewrites survive npm publish lifecycle npm runs `prepare` after `prepack` during publish, so the previous `prepare: tsc` overwrote the rewritten imports before packing. Both `prepare` and `prepack` now run the full build script so the tarball always contains rewritten relative imports. Co-Authored-By: Claude Opus 4.6 (1M context) --- gitnexus/CHANGELOG.md | 8 +++++++- gitnexus/package-lock.json | 4 ++-- gitnexus/package.json | 6 +++--- gitnexus/scripts/build.js | 4 ++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gitnexus/CHANGELOG.md b/gitnexus/CHANGELOG.md index 273f97657..081eb9b26 100644 --- a/gitnexus/CHANGELOG.md +++ b/gitnexus/CHANGELOG.md @@ -2,10 +2,16 @@ All notable changes to GitNexus will be documented in this file. -## [1.5.1] - 2026-04-01 +## [1.5.2] - 2026-04-01 ### Fixed - **`gitnexus-shared` module not found** — `gitnexus-shared` was a `file:` workspace dependency never published to npm, causing `ERR_MODULE_NOT_FOUND` when installing `gitnexus` globally. The build now bundles shared code into `dist/_shared/` and rewrites imports to relative paths (#613) +- **v1.5.1 publish regression** — npm's `prepare` lifecycle ran `tsc` after `prepack`, overwriting the rewritten imports before packing; both scripts now run the full build so the final tarball is always correct + +## [1.5.1] - 2026-04-01 [YANKED] + +### Fixed +- Incomplete fix for `gitnexus-shared` bundling — `prepare` script overwrote rewritten imports during publish ## [1.5.0] - 2026-04-01 diff --git a/gitnexus/package-lock.json b/gitnexus/package-lock.json index 2feb1266a..a533998ef 100644 --- a/gitnexus/package-lock.json +++ b/gitnexus/package-lock.json @@ -1,12 +1,12 @@ { "name": "gitnexus", - "version": "1.5.1", + "version": "1.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gitnexus", - "version": "1.5.1", + "version": "1.5.2", "license": "PolyForm-Noncommercial-1.0.0", "dependencies": { "@huggingface/transformers": "^3.0.0", diff --git a/gitnexus/package.json b/gitnexus/package.json index adb5eb544..d7361e725 100644 --- a/gitnexus/package.json +++ b/gitnexus/package.json @@ -1,6 +1,6 @@ { "name": "gitnexus", - "version": "1.5.1", + "version": "1.5.2", "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.", "author": "Abhigyan Patwari", "license": "PolyForm-Noncommercial-1.0.0", @@ -46,8 +46,8 @@ "test:integration": "vitest run test/integration", "test:watch": "vitest", "test:coverage": "vitest run --coverage", - "prepare": "tsc", - "prepack": "npm run build && chmod +x dist/cli/index.js" + "prepare": "node scripts/build.js", + "prepack": "node scripts/build.js" }, "dependencies": { "@huggingface/transformers": "^3.0.0", diff --git a/gitnexus/scripts/build.js b/gitnexus/scripts/build.js index d3e33bfb3..68378c61d 100644 --- a/gitnexus/scripts/build.js +++ b/gitnexus/scripts/build.js @@ -66,4 +66,8 @@ function walk(dir, extensions, cb) { walk(DIST, ['.js', '.d.ts'], rewriteFile); +// ── 5. Make CLI entry executable ──────────────────────────────────── +const cliEntry = path.join(DIST, 'cli', 'index.js'); +if (fs.existsSync(cliEntry)) fs.chmodSync(cliEntry, 0o755); + console.log(`[build] done — rewrote ${rewritten} files.`);