summaryrefslogtreecommitdiff
path: root/packages/create-astro/src/actions/git.ts
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2023-02-16 14:28:15 -0600
committerGravatar GitHub <noreply@github.com> 2023-02-16 14:28:15 -0600
commit066b4b4efcde2320d29040c5bd385c67f30c701a (patch)
treebabd286fc1cb66f11b5e0379e6f4f582089661ce /packages/create-astro/src/actions/git.ts
parentfb4e79bf1fb4be8f572e661c4c8b40b4579447c7 (diff)
downloadastro-066b4b4efcde2320d29040c5bd385c67f30c701a.tar.gz
astro-066b4b4efcde2320d29040c5bd385c67f30c701a.tar.zst
astro-066b4b4efcde2320d29040c5bd385c67f30c701a.zip
Improve `create-astro` error handling (#6266)
* fix(create-astro): improve error handling for tasks that use spinner display * refactor: timeout after 60s * chore: remove unused file
Diffstat (limited to 'packages/create-astro/src/actions/git.ts')
-rw-r--r--packages/create-astro/src/actions/git.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/create-astro/src/actions/git.ts b/packages/create-astro/src/actions/git.ts
index 51a7e09c8..6949346fb 100644
--- a/packages/create-astro/src/actions/git.ts
+++ b/packages/create-astro/src/actions/git.ts
@@ -4,7 +4,7 @@ import type { Context } from './context';
import { color } from '@astrojs/cli-kit';
import { execa } from 'execa';
-import { info, spinner, title } from '../messages.js';
+import { info, spinner, error, title } from '../messages.js';
export async function git(ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' | 'dryRun'>) {
if (fs.existsSync(path.join(ctx.cwd, '.git'))) {
@@ -29,7 +29,11 @@ export async function git(ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' |
await spinner({
start: 'Git initializing...',
end: 'Git initialized',
- while: () => init({ cwd: ctx.cwd }),
+ while: () => init({ cwd: ctx.cwd }).catch((e) => {
+ // eslint-disable-next-line no-console
+ error('error', e);
+ process.exit(1);
+ }),
});
} else {
await info(