Skip to content

Commit 5945ea8

Browse files
authored
fix: package manager detection in non interactive environments (#503)
1 parent d721c65 commit 5945ea8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.changeset/tall-moons-marry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'sv': patch
3+
---
4+
5+
fix: package manager detection in non interactive environments

packages/cli/utils/package-manager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export async function packageManagerPrompt(cwd: string): Promise<AgentName | und
2222
const detected = await detect({ cwd });
2323
const agent = detected?.name ?? getUserAgent();
2424

25+
// If we are in a non interactive environment just go with the detected package manager.
26+
// There is no need to prompt in that case.
27+
if (!process.stdout.isTTY) return agent;
28+
2529
const pm = await p.select({
2630
message: 'Which package manager do you want to install dependencies with?',
2731
options: agentOptions,

0 commit comments

Comments
 (0)