Skip to content

Commit

Permalink
Merge branch 'main' into enhance-prefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah11918 authored Jan 2, 2024
2 parents 75e0690 + f192fc3 commit aa3ee52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-cars-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/upgrade": patch
---

Updates the command used for installing packages with pnpm and yarn
9 changes: 6 additions & 3 deletions packages/upgrade/src/actions/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ async function runInstallCommand(
const cwd = fileURLToPath(ctx.cwd);
if (ctx.packageManager === 'yarn') await ensureYarnLock({ cwd });

const installCmd =
ctx.packageManager === 'yarn' || ctx.packageManager === 'pnpm' ? 'add' : 'install';

await spinner({
start: `Installing dependencies with ${ctx.packageManager}...`,
end: `Installed dependencies!`,
Expand All @@ -132,7 +135,7 @@ async function runInstallCommand(
await shell(
ctx.packageManager,
[
'install',
installCmd,
...dependencies.map(
({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}`
),
Expand All @@ -144,7 +147,7 @@ async function runInstallCommand(
await shell(
ctx.packageManager,
[
'install',
installCmd,
'--save-dev',
...devDependencies.map(
({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}`
Expand All @@ -161,7 +164,7 @@ async function runInstallCommand(
error(
'error',
`Dependencies failed to install, please run the following command manually:\n${color.bold(
`${ctx.packageManager} install ${packages}`
`${ctx.packageManager} ${installCmd} ${packages}`
)}`
);
return ctx.exit(1);
Expand Down

0 comments on commit aa3ee52

Please sign in to comment.