diff --git a/.changeset/silent-experts-sip.md b/.changeset/silent-experts-sip.md new file mode 100644 index 000000000000..ce1ca3e291fe --- /dev/null +++ b/.changeset/silent-experts-sip.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +Fixes an issue where a successful "Dependencies installed" message is displayed even when installing dependencies fails. diff --git a/packages/create-astro/package.json b/packages/create-astro/package.json index 4f78989fbc84..d19ef1e4f4ae 100644 --- a/packages/create-astro/package.json +++ b/packages/create-astro/package.json @@ -31,7 +31,7 @@ "//a": "MOST PACKAGES SHOULD GO IN DEV_DEPENDENCIES! THEY WILL BE BUNDLED.", "//b": "DEPENDENCIES IS FOR UNBUNDLED PACKAGES", "dependencies": { - "@astrojs/cli-kit": "^0.3.0", + "@astrojs/cli-kit": "^0.3.1", "giget": "1.1.2" }, "devDependencies": { diff --git a/packages/create-astro/src/actions/dependencies.ts b/packages/create-astro/src/actions/dependencies.ts index 1e731099c010..e920fcf8e482 100644 --- a/packages/create-astro/src/actions/dependencies.ts +++ b/packages/create-astro/src/actions/dependencies.ts @@ -27,17 +27,16 @@ export async function dependencies( await spinner({ start: `Installing dependencies with ${ctx.packageManager}...`, end: 'Dependencies installed', - while: () => { - return install({ packageManager: ctx.packageManager, cwd: ctx.cwd }).catch((e) => { - error('error', e); - error( - 'error', - `Dependencies failed to install, please run ${color.bold( - ctx.packageManager + ' install' - )} to install them manually after setup.` - ); - }); + onError: (e) => { + error('error', e); + error( + 'error', + `Dependencies failed to install, please run ${color.bold( + ctx.packageManager + ' install' + )} to install them manually after setup.` + ); }, + while: () => install({ packageManager: ctx.packageManager, cwd: ctx.cwd }), }); } else { await info( diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts index 29c551883a74..09675740a1f9 100644 --- a/packages/create-astro/src/messages.ts +++ b/packages/create-astro/src/messages.ts @@ -31,6 +31,7 @@ export async function say(messages: string | string[], { clear = false, hat = '' export async function spinner(args: { start: string; end: string; + onError?: (error: any) => void; while: (...args: any) => Promise; }) { await load(args, { stdout }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6b915936f29..322d1a4f7717 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3700,8 +3700,8 @@ importers: packages/create-astro: dependencies: '@astrojs/cli-kit': - specifier: ^0.3.0 - version: 0.3.0 + specifier: ^0.3.1 + version: 0.3.1 giget: specifier: 1.1.2 version: 1.1.2 @@ -5166,8 +5166,8 @@ packages: - prettier-plugin-astro dev: true - /@astrojs/cli-kit@0.3.0: - resolution: {integrity: sha512-nil0Kz2xuzR3xQX+FVHg2W8g+FvbeUeoCeU53duQjAFuHRJrbqWRmgfjYeM6f2780dsSuGiYMXmY+IaJqaqiaw==} + /@astrojs/cli-kit@0.3.1: + resolution: {integrity: sha512-BEzf3gudr4XrrrInJKD+GSS5O+GXRTukLUpOfgqdTSq6d48EWVhigNHobmlQGbpa9FEAw+sZmvmHmhS29QhnwA==} engines: {node: '>=18.14.1'} dependencies: chalk: 5.3.0