Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added onError functionality to spinner #9048

Merged
merged 5 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/silent-experts-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-astro': patch
---

Fixes an issue where a successful "Dependencies installed" message is displayed even when installing dependencies fails.
2 changes: 1 addition & 1 deletion packages/create-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
19 changes: 10 additions & 9 deletions packages/create-astro/src/actions/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ export async function dependencies(
await spinner({
start: `Installing dependencies with ${ctx.packageManager}...`,
end: 'Dependencies installed',
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: () => {
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.`
);
});
return install({ packageManager: ctx.packageManager, cwd: ctx.cwd }).catch((e) => { throw e });
skirianov marked this conversation as resolved.
Show resolved Hide resolved
},
});
} else {
Expand Down
1 change: 1 addition & 0 deletions packages/create-astro/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading