mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
fix: added onError functionality to spinner (#9048)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
This commit is contained in:
parent
5db28e90d0
commit
1e97708cda
5 changed files with 20 additions and 15 deletions
5
.changeset/silent-experts-sip.md
Normal file
5
.changeset/silent-experts-sip.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'create-astro': patch
|
||||
---
|
||||
|
||||
Fixes an issue where a successful "Dependencies installed" message is displayed even when installing dependencies fails.
|
|
@ -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": {
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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<any>;
|
||||
}) {
|
||||
await load(args, { stdout });
|
||||
|
|
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue