Skip to content

Commit 0902eea

Browse files
committed
fix(scripts): use the .cmd bin shim on Windows for tsgo + oxfmt spawns
After replacing pnpm exec with node_modules/.bin/<tool>, the Windows build died with "'node_modules' is not recognized" — the extension-less .bin file is a POSIX sh script cmd.exe (shell: WIN32) can't run. Pick node_modules\.bin\ <tool>.cmd on win32, the shim npm writes for exactly this. Covers the tsgo declarations build and the api-index oxfmt pass.
1 parent 6948745 commit 0902eea

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

scripts/bundle/steps.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ export async function buildTypes(
104104
}
105105

106106
commands.push({
107+
// npm writes a `.cmd` shim on Windows; the extension-less file is a POSIX
108+
// sh script cmd.exe can't run ("'node_modules' is not recognized"), so pick
109+
// the platform-correct shim. shell: WIN32 lets cmd.exe resolve the .cmd.
107110
args: ['--project', 'tsconfig.dts.json'],
108-
command: 'node_modules/.bin/tsgo',
111+
command: WIN32 ? 'node_modules\\.bin\\tsgo.cmd' : 'node_modules/.bin/tsgo',
109112
options: {
110113
shell: WIN32,
111114
},

scripts/repo/make-api-index-md.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ async function main(): Promise<void> {
173173
// alignment behaviour) wins over oxfmt's built-in default config.
174174
try {
175175
await spawn(
176-
'node_modules/.bin/oxfmt',
176+
// Windows needs the .cmd shim — the extension-less .bin file is a POSIX
177+
// sh script cmd.exe (shell: WIN32) can't run.
178+
WIN32 ? 'node_modules\\.bin\\oxfmt.cmd' : 'node_modules/.bin/oxfmt',
177179
[
178180
'-c',
179181
'.config/fleet/oxfmtrc.json',

0 commit comments

Comments
 (0)