0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-17 22:44:24 -05:00

fix: exec command on Astro new version message (#10991)

`getExecCommand` is an async function but it wasn't awaited in
`newVersionAvailable` so the message was:
`Run [object Promise] @astrojs/upgrade to update`
This commit is contained in:
Armand Philippot 2024-05-09 19:37:21 +02:00 committed by GitHub
parent e2cdd3c96b
commit 370b9f1612
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -67,7 +67,7 @@ export default async function dev(inlineConfig: AstroInlineConfig): Promise<DevS
logger.warn(
'SKIP_FORMAT',
msg.newVersionAvailable({
await msg.newVersionAvailable({
latestVersion: version,
})
);

View file

@ -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');