From b18de0379c9377f8ba5e274eec44ae52d7ec5c49 Mon Sep 17 00:00:00 2001 From: ospab Date: Tue, 11 Aug 2026 17:07:55 +0300 Subject: [PATCH] fix(ci): staging script was CommonJS in an ES-module package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ostp-gui/package.json sets "type": "module", so a .js file is loaded as an ES module and `require` is not defined — the installer build died on the first line of stage-sidecar.js. Renamed to .cjs, which opts that one file back into CommonJS. The failure was also reported in the wrong place. pwsh does not abort a run block when a native command exits non-zero, so the build carried on past the dead script and failed several steps later complaining about a sidecar that nothing had staged. The two commands are chained now, so staging failures surface as themselves. Verified locally this time: the script resolves the host triple, copies the helper to the name Tauri expects, and warns about a missing wintun.dll rather than failing silently. --- .github/workflows/release.yml | 7 ++++--- ostp-gui/package.json | 4 ++-- ostp-gui/{stage-sidecar.js => stage-sidecar.cjs} | 0 3 files changed, 6 insertions(+), 5 deletions(-) rename ostp-gui/{stage-sidecar.js => stage-sidecar.cjs} (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 029be90..2c024b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -426,9 +426,10 @@ jobs: # first, and fail the build script when it is not. - name: Build NSIS Installer working-directory: ostp-gui - run: | - node stage-sidecar.js --release --target ${{ matrix.target }} - npx tauri build --bundles nsis --target ${{ matrix.target }} --config src-tauri/tauri.installer.conf.json + # Chained, not two lines: pwsh does not abort a run block when a native + # command fails, so a staging failure would otherwise be reported far + # downstream as a missing sidecar rather than as itself. + run: node stage-sidecar.cjs --release --target ${{ matrix.target }} && npx tauri build --bundles nsis --target ${{ matrix.target }} --config src-tauri/tauri.installer.conf.json - name: Collect installer shell: pwsh diff --git a/ostp-gui/package.json b/ostp-gui/package.json index f18eb49..e04fcda 100644 --- a/ostp-gui/package.json +++ b/ostp-gui/package.json @@ -7,9 +7,9 @@ "tauri": "tauri", "dev": "cargo build -p ostp-tun-helper && npx tauri dev", "build": "cargo build -p ostp-tun-helper --release && npx tauri build --no-bundle", - "build:installer": "cargo build -p ostp-tun-helper --release && node stage-sidecar.js --release && npx tauri build --bundles nsis --config src-tauri/tauri.installer.conf.json", + "build:installer": "cargo build -p ostp-tun-helper --release && node stage-sidecar.cjs --release && npx tauri build --bundles nsis --config src-tauri/tauri.installer.conf.json", "build:dist": "npm run build && node build_dist.js", - "sidecar": "node stage-sidecar.js" + "sidecar": "node stage-sidecar.cjs" }, "devDependencies": { "@tauri-apps/cli": "^2" diff --git a/ostp-gui/stage-sidecar.js b/ostp-gui/stage-sidecar.cjs similarity index 100% rename from ostp-gui/stage-sidecar.js rename to ostp-gui/stage-sidecar.cjs