diff --git a/.changeset/tender-islands-cheat.md b/.changeset/tender-islands-cheat.md index 5180e79..2400758 100644 --- a/.changeset/tender-islands-cheat.md +++ b/.changeset/tender-islands-cheat.md @@ -7,3 +7,4 @@ - Add NPM provenance to all packages. - Use real version on CLI. +- Use `shell: true` on CLI for installing dependencies : works better on Windows. diff --git a/packages/cli/src/utils/installDependencies.ts b/packages/cli/src/utils/installDependencies.ts index 9dba09f..ca75370 100644 --- a/packages/cli/src/utils/installDependencies.ts +++ b/packages/cli/src/utils/installDependencies.ts @@ -1,12 +1,20 @@ -import { spawnSync } from "node:child_process"; +import { spawn } from "node:child_process"; import { detectPackageManager } from "nypm"; export const installDependencies = async (projectDirectory: string): Promise => { const packageManager = await detectPackageManager(projectDirectory) - const command = packageManager?.command ?? "npm"; + let command = packageManager?.command ?? "npm"; + + return new Promise((resolve, reject) => { + const child = spawn(command, ['install'], { + cwd: projectDirectory, + stdio: "ignore", + shell: true + }); - spawnSync(command, ['install'], { - cwd: projectDirectory, - stdio: 'ignore' + child.on('exit', (code) => { + if (code === 0) resolve(); + else reject(); + }); }); }