diff --git a/.changeset/empty-pillows-peel.md b/.changeset/empty-pillows-peel.md new file mode 100644 index 0000000000000..f76612d4ad4d8 --- /dev/null +++ b/.changeset/empty-pillows-peel.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +Don't exit if dependencies fail to install diff --git a/packages/create-astro/src/actions/dependencies.ts b/packages/create-astro/src/actions/dependencies.ts index fe5e6f777d5a2..50694c675a631 100644 --- a/packages/create-astro/src/actions/dependencies.ts +++ b/packages/create-astro/src/actions/dependencies.ts @@ -1,7 +1,7 @@ import type { Context } from './context'; import { execa } from 'execa'; -import { error, info, spinner, title } from '../messages.js'; +import { error, info, spinner, title, warn } from '../messages.js'; export async function dependencies( ctx: Pick @@ -25,12 +25,15 @@ export async function dependencies( await spinner({ start: `Dependencies installing with ${ctx.pkgManager}...`, end: 'Dependencies installed', - while: () => - install({ pkgManager: ctx.pkgManager, cwd: ctx.cwd }).catch((e) => { - // eslint-disable-next-line no-console + while: () => { + return install({ pkgManager: ctx.pkgManager, cwd: ctx.cwd }).catch((e) => { error('error', e); - process.exit(1); - }), + warn( + 'warning', + 'Dependencies failed to install, please install them manually after setup.' + ); + }); + }, }); } else { await info( diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts index 9121ad60f74c6..a635d91436836 100644 --- a/packages/create-astro/src/messages.ts +++ b/packages/create-astro/src/messages.ts @@ -94,6 +94,15 @@ export const info = async (prefix: string, text: string) => { } }; +export const warn = async (prefix: string, text: string) => { + if (stdout.columns < 80) { + log(`${' '.repeat(5)} ${color.yellow('◼')} ${color.yellow(prefix)}`); + log(`${' '.repeat(9)}${color.dim(text)}`); + } else { + log(`${' '.repeat(5)} ${color.yellow('◼')} ${color.yellow(prefix)} ${color.dim(text)}`); + } +}; + export const error = async (prefix: string, text: string) => { if (stdout.columns < 80) { log(`${' '.repeat(5)} ${color.red('▲')} ${color.red(prefix)}`);