From 23f5fc72ca83a4c01696bb94ebf53e23f0c68e88 Mon Sep 17 00:00:00 2001 From: Seto Elkahfi Date: Fri, 27 Nov 2026 14:36:58 +0100 Subject: [PATCH] Build the npm launcher before adding its platform packages The v1.4.0 launcher job failed at `npm ci`: the lockfile listed the six @getsigit/si-- packages with no version, and once they existed on npm the lockfile no longer matched package.json. Regenerating it would only move the problem to the next release, because a lockfile can't pin a version that hasn't been published yet. The committed package.json and lockfile now leave the platform packages out. The workflow runs `npm ci` and the build first, and render-main-package.cjs adds them at the release version just before `npm publish`. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: siGit Code v1.7.10 --- .github/workflows/release-npm.yml | 9 +++++-- packaging/npm/scripts/render-main-package.cjs | 3 ++- packaging/npm/si/package-lock.json | 26 ------------------- packaging/npm/si/package.json | 8 ------ 4 files changed, 9 insertions(+), 37 deletions(-) diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index f16b1df..830dc67 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -243,13 +243,18 @@ jobs: node-version-file: .nvmrc registry-url: "https://registry.npmjs.org" - - name: Render and build the launcher + # Build first, then render. The committed package.json and lockfile leave out the six + # platform packages, because a lockfile can't pin a version that hasn't been published: + # it would hold the previous release's version and `npm ci` would refuse it. The build + # only needs TypeScript. The render then adds the platform packages at this release's + # version, just before `npm publish`. + - name: Build and render the launcher shell: bash working-directory: packaging/npm/si run: | - node ../scripts/render-main-package.cjs ./package.json "${RELEASE_VERSION}" npm ci npm run build + node ../scripts/render-main-package.cjs ./package.json "${RELEASE_VERSION}" - name: Check whether the package version already exists on npm id: npm-check diff --git a/packaging/npm/scripts/render-main-package.cjs b/packaging/npm/scripts/render-main-package.cjs index 5aa2c18..f95788a 100644 --- a/packaging/npm/scripts/render-main-package.cjs +++ b/packaging/npm/scripts/render-main-package.cjs @@ -10,7 +10,8 @@ if (!outputPath || !version) { } // The platform binary packages the launcher resolves at runtime. Kept in lockstep with the -// release-npm.yml build matrix. +// release-npm.yml build matrix. They are only added here, at publish time, and never to the +// committed package.json or its lockfile (see the "Build and render the launcher" step). const platformSuffixes = [ "darwin-arm64", "darwin-x64", diff --git a/packaging/npm/si/package-lock.json b/packaging/npm/si/package-lock.json index 9ee41e3..e35a841 100644 --- a/packaging/npm/si/package-lock.json +++ b/packaging/npm/si/package-lock.json @@ -14,34 +14,8 @@ "devDependencies": { "@types/node": "^18.15.11", "typescript": "^5.0.0" - }, - "optionalDependencies": { - "@getsigit/si-darwin-arm64": "1.4.0", - "@getsigit/si-darwin-x64": "1.4.0", - "@getsigit/si-linux-arm64": "1.4.0", - "@getsigit/si-linux-x64": "1.4.0", - "@getsigit/si-windows-arm64": "1.4.0", - "@getsigit/si-windows-x64": "1.4.0" } }, - "node_modules/@getsigit/si-darwin-arm64": { - "optional": true - }, - "node_modules/@getsigit/si-darwin-x64": { - "optional": true - }, - "node_modules/@getsigit/si-linux-arm64": { - "optional": true - }, - "node_modules/@getsigit/si-linux-x64": { - "optional": true - }, - "node_modules/@getsigit/si-windows-arm64": { - "optional": true - }, - "node_modules/@getsigit/si-windows-x64": { - "optional": true - }, "node_modules/@types/node": { "version": "18.19.130", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.130.tgz", diff --git a/packaging/npm/si/package.json b/packaging/npm/si/package.json index d232499..4339778 100644 --- a/packaging/npm/si/package.json +++ b/packaging/npm/si/package.json @@ -32,13 +32,5 @@ "devDependencies": { "@types/node": "^18.15.11", "typescript": "^5.0.0" - }, - "optionalDependencies": { - "@getsigit/si-darwin-arm64": "1.4.0", - "@getsigit/si-darwin-x64": "1.4.0", - "@getsigit/si-linux-arm64": "1.4.0", - "@getsigit/si-linux-x64": "1.4.0", - "@getsigit/si-windows-arm64": "1.4.0", - "@getsigit/si-windows-x64": "1.4.0" } }