fix(dev): make npm run dev work on Windows (#374)
spawnSync('npm') without a shell fails with ENOENT on Windows because npm is npm.cmd, not npm.exe. The root dev script also used Unix VAR=value prefixes, which cmd.exe rejects.
Use shell: true when spawning npm on Windows, and set renderer URLs with cross-env.
This commit is contained in:
@@ -40,7 +40,16 @@ const stale = APPS.filter((app) => {
|
||||
if (stale.length) {
|
||||
console.log(`Rebuilding stale preloads: ${stale.join(', ')}`)
|
||||
for (const app of stale) {
|
||||
const r = spawnSync('npm', ['run', 'build', '-w', `@genoffice/${app}`], { stdio: 'inherit' })
|
||||
const r = spawnSync('npm', ['run', 'build', '-w', `@genoffice/${app}`], {
|
||||
stdio: 'inherit',
|
||||
// Windows has npm.cmd / npm.ps1, not npm.exe; spawn without a shell
|
||||
// looks up npm.exe only and fails with ENOENT.
|
||||
shell: process.platform === 'win32',
|
||||
})
|
||||
if (r.error) {
|
||||
console.error(r.error)
|
||||
process.exit(1)
|
||||
}
|
||||
if (r.status !== 0) process.exit(r.status ?? 1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user