Skip to content

Commit

Permalink
fix(upgrade): verify astro installation before upgrade to prevent f…
Browse files Browse the repository at this point in the history
…alse success (#12576)
  • Loading branch information
apatel369 authored Dec 4, 2024
1 parent 44af543 commit 19b3ac0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/little-rules-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/upgrade': patch
---

Fixes an issue where running `upgrade` in a directory without `astro` installed shows a false success message
8 changes: 7 additions & 1 deletion packages/upgrade/src/actions/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ export async function verify(
}
}

await verifyAstroProject(ctx);
const isAstroProject = await verifyAstroProject(ctx);
if (!isAstroProject) {
bannerAbort();
newline();
error('error', `Astro installation not found in the current directory.`);
ctx.exit(1);
}

const ok = await verifyVersions(ctx, registry);
if (!ok) {
Expand Down

0 comments on commit 19b3ac0

Please sign in to comment.