Skip to content

Commit c90fc2d

Browse files
authored
fix: prompt to install dependencies in create (#117)
1 parent c1618bc commit c90fc2d

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.changeset/wise-trains-study.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: prompt to install dependencies in `sv create`

packages/cli/commands/add/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export async function runAddCommand(options: Options, adders: string[]): Promise
452452
}
453453

454454
// install dependencies
455-
let depsStatus: 'installed' | 'skipped' | undefined;
455+
let depsStatus: 'installed' | 'skipped' = 'skipped';
456456
if (options.install && selectedAdders.length > 0) {
457457
depsStatus = await common.suggestInstallingDependencies(options.cwd);
458458
}

packages/cli/commands/create.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ async function createProject(cwd: string, options: Options) {
138138

139139
if (options.adders) {
140140
await runAddCommand(
141-
{ cwd: projectPath, install: options.install, preconditions: true, community: [] },
141+
{ cwd: projectPath, install: false, preconditions: true, community: [] },
142142
[]
143143
);
144-
} else if (options.install) {
144+
}
145+
// show install prompt even if no adders selected
146+
if (options.install) {
145147
// `runAddCommand` includes the installing dependencies prompt. if it's skipped,
146148
// then we'll prompt to install dependencies here
147149
await common.suggestInstallingDependencies(projectPath);

0 commit comments

Comments
 (0)