Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chatty-queens-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: correctly resolve package manager commands in `create`'s next-steps
10 changes: 6 additions & 4 deletions packages/cli/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@sveltejs/create';
import * as common from '../utils/common.ts';
import { runAddCommand } from './add/index.ts';
import { detectSync, type AgentName } from 'package-manager-detector';
import { detectSync, resolveCommand, type AgentName } from 'package-manager-detector';
import {
getUserAgent,
installDependencies,
Expand Down Expand Up @@ -72,14 +72,16 @@ export const create = new Command('create')
);
}
if (!packageManager) {
initialSteps.push(`${i++}: ${highlight(`${pm} install`)}`);
const { args, command } = resolveCommand(pm, 'install', [])!;
initialSteps.push(`${i++}: ${highlight(`${command} ${args.join(' ')}`)}`);
}

const pmRun = pm === 'npm' ? 'npm run dev --' : `${pm} dev`;
const { args, command } = resolveCommand(pm, 'run', ['dev', '--open'])!;
const pmRunCmd = `${command} ${args.join(' ')}`;
const steps = [
...initialSteps,
`${i++}: ${highlight('git init && git add -A && git commit -m "Initial commit"')} (optional)`,
`${i++}: ${highlight(`${pmRun} --open`)}`,
`${i++}: ${highlight(pmRunCmd)}`,
'',
`To close the dev server, hit ${highlight('Ctrl-C')}`,
'',
Expand Down
Loading