From 70a55db213668253d19bb96afbb3c9b4520c29db Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 19 Aug 2026 15:12:40 +0200 Subject: [PATCH] fix(ci): pass shell: true so test:package can spawn npm.cmd on Windows Cherry-picked from f3e5c3c, narrowed to the part still applicable here: scripts/test-package.mjs's spawnSync calls for npm.cmd needed shell: true on Windows (Node can't exec a .cmd shim without going through a shell), so the script has never actually run to completion locally on Windows until now. f3e5c3c's other change - making scripts/prepare.mjs capture the build's stdout instead of inheriting it, so it can't corrupt npm pack --json's own --json output - does not apply on top of origin/main: prepare.mjs no longer exists there, having been replaced by a `git config core.hooksPath .githooks` prepare step that doesn't build at all and so can't hit this problem in the first place. That part is intentionally left out as moot. Co-Authored-By: Claude Sonnet 5 --- scripts/test-package.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/test-package.mjs b/scripts/test-package.mjs index 3d9e00e..b6a1590 100644 --- a/scripts/test-package.mjs +++ b/scripts/test-package.mjs @@ -36,6 +36,10 @@ function run(command, args, options = {}) { } try { + // shell: true - required on Windows to spawn a .cmd shim (npm.cmd) at all; + // Node's spawnSync can't exec one directly without going through a shell. + // Safe here specifically because these args are internally generated + // (this repo's own paths and fixed flag strings), never user input. const packed = JSON.parse( run( npmCommand, @@ -47,7 +51,7 @@ try { "--pack-destination", consumerRoot, ], - { cwd: projectRoot }, + { cwd: projectRoot, shell: true }, ), ); const archive = join(consumerRoot, packed[0].filename); @@ -60,7 +64,7 @@ try { type: "module", }), ); - run(npmCommand, ["install", "--ignore-scripts", archive]); + run(npmCommand, ["install", "--ignore-scripts", archive], { shell: true }); const packageName = "@compas-dev/compas-threejs-ts"; const installed = JSON.parse(