fix: preserve Windows Node shim detection

This commit is contained in:
Zoltan Kochan
2026-11-03 15:09:03 +01:00
parent a5f174cfd1
commit fffe7742ec
3 changed files with 6 additions and 2 deletions
+4
View File
@@ -460,3 +460,7 @@ jobs:
if ($LASTEXITCODE -ne 0 -or $actual -ne $env:EXPECTED_VERSION) {
throw "Expected $env:EXPECTED_VERSION via bin_dest, got $actual"
}
$pnpx = Get-Command pnpx -ErrorAction Stop
if ((Split-Path -Parent $pnpx.Source) -ne $env:BIN_DEST) {
throw "pnpx resolves to $($pnpx.Source), expected under $env:BIN_DEST"
}
+1 -1
View File
@@ -270,7 +270,7 @@ Please specify it by one of the following ways:
- in the package.json with the key "devEngines.packageManager"`):new Error(`No workspace is found.
If you've intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file,
please run the actions/checkout before pnpm/action-setup.
Otherwise, please specify the pnpm version in the action configuration.`)}function WLe(t){if(t==="latest-12"||t==="next-12")return!0;let e=(0,Sd.validRange)(t);return e!==null&&(0,Sd.subset)(e,">=12.0.0 <13.0.0")}function $Le(){return new Promise(t=>{let e=(0,wX.spawn)("node",["--version"],{stdio:["pipe","pipe","pipe"]}),r="";e.stdout.on("data",n=>{r+=n.toString()}),e.on("close",()=>{let n=r.match(/^v(\d+)\.(\d+)/);t(n?{major:parseInt(n[1],10),minor:parseInt(n[2],10)}:{major:0,minor:0})}),e.on("error",()=>t({major:0,minor:0}))})}function bX(t,e,r){return(0,NX.exec)(`"${t}"`,e,{cwd:r.cwd,env:r.env&&Object.fromEntries(Object.entries(r.env).filter(n=>n[1]!==void 0)),ignoreReturnCode:!0})}var vX=JLe;async function KLe(t){(0,Rd.startGroup)("Running self-installer...");let{exitCode:e,binDest:r}=await vX(t);if((0,Rd.endGroup)(),e){(0,Rd.setFailed)(`Something went wrong, self-installer exits with code ${e}`);return}return r}var DX=KLe;var xk=Ct(ct());function XLe(t,e){(0,xk.setOutput)("dest",t.dest),(0,xk.setOutput)("bin_dest",e)}var _X=XLe;var tc=Ct(ct()),kX=require("child_process");function ZLe(t){for(let e of t.runInstall){let r=["install"];e.recursive&&r.unshift("recursive"),e.args&&r.push(...e.args);let n=["pnpm",...r].join(" ");(0,tc.startGroup)(`Running ${n}...`);let{error:i,status:s}=(0,kX.spawnSync)("pnpm",r,{stdio:"inherit",cwd:e.cwd,shell:!0});if((0,tc.endGroup)(),i){(0,tc.setFailed)(i);continue}if(s){(0,tc.setFailed)(`Command ${n} (cwd: ${e.cwd}) exits with status ${s}`);continue}}}var PX=ZLe;var rc=Ct(ct()),TX=require("child_process");function eMe(t){if(t.runInstall.length===0){console.log("Pruning is unnecessary.");return}(0,rc.startGroup)("Running pnpm store prune...");let{error:e,status:r}=(0,TX.spawnSync)("pnpm",["store","prune"],{stdio:"inherit",shell:!0});if((0,rc.endGroup)(),e){(0,rc.warning)(e);return}if(r){(0,rc.warning)(`command pnpm store prune exits with code ${r}`);return}}var OX=eMe;async function tMe(){(0,Da.getState)("is_post")==="true"?await nMe():await rMe()}async function rMe(){let t=_K();(0,Da.saveState)("inputs",t),(0,Da.saveState)("is_post","true");let e=await DX(t);e!==void 0&&(console.log("Installation Completed!"),_X(t,e),await f4(t),PX(t))}async function nMe(){let t=JSON.parse((0,Da.getState)("inputs"));OX(t),await y4(t)}tMe().catch(t=>{console.error(t),(0,Da.setFailed)(t)});
Otherwise, please specify the pnpm version in the action configuration.`)}function WLe(t){if(t==="latest-12"||t==="next-12")return!0;let e=(0,Sd.validRange)(t);return e!==null&&(0,Sd.subset)(e,">=12.0.0 <13.0.0")}function $Le(){return new Promise(t=>{let e=(0,wX.spawn)("node",["--version"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),r="";e.stdout.on("data",n=>{r+=n.toString()}),e.on("close",()=>{let n=r.match(/^v(\d+)\.(\d+)/);t(n?{major:parseInt(n[1],10),minor:parseInt(n[2],10)}:{major:0,minor:0})}),e.on("error",()=>t({major:0,minor:0}))})}function bX(t,e,r){return(0,NX.exec)(`"${t}"`,e,{cwd:r.cwd,env:r.env&&Object.fromEntries(Object.entries(r.env).filter(n=>n[1]!==void 0)),ignoreReturnCode:!0})}var vX=JLe;async function KLe(t){(0,Rd.startGroup)("Running self-installer...");let{exitCode:e,binDest:r}=await vX(t);if((0,Rd.endGroup)(),e){(0,Rd.setFailed)(`Something went wrong, self-installer exits with code ${e}`);return}return r}var DX=KLe;var xk=Ct(ct());function XLe(t,e){(0,xk.setOutput)("dest",t.dest),(0,xk.setOutput)("bin_dest",e)}var _X=XLe;var tc=Ct(ct()),kX=require("child_process");function ZLe(t){for(let e of t.runInstall){let r=["install"];e.recursive&&r.unshift("recursive"),e.args&&r.push(...e.args);let n=["pnpm",...r].join(" ");(0,tc.startGroup)(`Running ${n}...`);let{error:i,status:s}=(0,kX.spawnSync)("pnpm",r,{stdio:"inherit",cwd:e.cwd,shell:!0});if((0,tc.endGroup)(),i){(0,tc.setFailed)(i);continue}if(s){(0,tc.setFailed)(`Command ${n} (cwd: ${e.cwd}) exits with status ${s}`);continue}}}var PX=ZLe;var rc=Ct(ct()),TX=require("child_process");function eMe(t){if(t.runInstall.length===0){console.log("Pruning is unnecessary.");return}(0,rc.startGroup)("Running pnpm store prune...");let{error:e,status:r}=(0,TX.spawnSync)("pnpm",["store","prune"],{stdio:"inherit",shell:!0});if((0,rc.endGroup)(),e){(0,rc.warning)(e);return}if(r){(0,rc.warning)(`command pnpm store prune exits with code ${r}`);return}}var OX=eMe;async function tMe(){(0,Da.getState)("is_post")==="true"?await nMe():await rMe()}async function rMe(){let t=_K();(0,Da.saveState)("inputs",t),(0,Da.saveState)("is_post","true");let e=await DX(t);e!==void 0&&(console.log("Installation Completed!"),_X(t,e),await f4(t),PX(t))}async function nMe(){let t=JSON.parse((0,Da.getState)("inputs"));OX(t),await y4(t)}tMe().catch(t=>{console.error(t),(0,Da.setFailed)(t)});
/*! Bundled license information:
undici/lib/fetch/body.js:
+1 -1
View File
@@ -210,7 +210,7 @@ function targetsPnpm12(version: string): boolean {
function getSystemNodeVersion(): Promise<{ major: number; minor: number }> {
return new Promise((resolve) => {
const cp = spawn('node', ['--version'], { stdio: ['pipe', 'pipe', 'pipe'] })
const cp = spawn('node', ['--version'], { stdio: ['pipe', 'pipe', 'pipe'], shell: process.platform === 'win32' })
let output = ''
cp.stdout.on('data', (data: Buffer) => { output += data.toString() })
cp.on('close', () => {