Skip to content
Merged
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
15 changes: 13 additions & 2 deletions packages/init-stack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,19 @@ async function main(): Promise<void> {
// Install dependencies
console.log();
console.log(colorize.bold`Installing dependencies...`);
const installCommand = packageManager === "yarn" ? "yarn add" : `${packageManager} install`;
await shellNicelyFormatted(`${installCommand} ${packagesToInstall.join(' ')}`, {
const installCommandMap = new Map<string, string>([
["npm", "npm install"],
["yarn", "yarn add"],
["pnpm", "pnpm add"],
["bun", "bun add"],
]);
const installCommand = installCommandMap.get(packageManager) ?? `${packageManager} install`;
// Quote each package name to avoid shell interpretation of env-overridden values.
const safePackages = packagesToInstall.map((p) => JSON.stringify(p));
await shellNicelyFormatted(`${installCommand} ${safePackages.join(' ')}`, {
shell: true,
cwd: projectPath,
});
shell: true,
cwd: projectPath,
});
Expand Down