Skip to content

Commit

Permalink
fix: exec command on Astro new version message (#10991)
Browse files Browse the repository at this point in the history
`getExecCommand` is an async function but it wasn't awaited in
`newVersionAvailable` so the message was:
`Run [object Promise] @astrojs/upgrade to update`
  • Loading branch information
ArmandPhilippot authored May 9, 2024
1 parent e2cdd3c commit 370b9f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/astro/src/core/dev/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default async function dev(inlineConfig: AstroInlineConfig): Promise<DevS

logger.warn(
'SKIP_FORMAT',
msg.newVersionAvailable({
await msg.newVersionAvailable({
latestVersion: version,
})
);
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ export function serverShortcuts({ key, label }: { key: string; label: string }):
return [dim(' Press'), key, dim('to'), label].join(' ');
}

export function newVersionAvailable({ latestVersion }: { latestVersion: string }) {
export async function newVersionAvailable({ latestVersion }: { latestVersion: string }) {
const badge = bgYellow(black(` update `));
const headline = yellow(`▶ New version of Astro available: ${latestVersion}`);
const execCommand = getExecCommand();
const execCommand = await getExecCommand();

const details = ` Run ${cyan(`${execCommand} @astrojs/upgrade`)} to update`;
return ['', `${badge} ${headline}`, details, ''].join('\n');
Expand Down

0 comments on commit 370b9f1

Please sign in to comment.