fix(nuxi): prevent showing stack traces while scaffolding (#9962)

This commit is contained in:
James George 2023-01-21 19:01:48 +05:30 committed by GitHub
parent de50b41e2d
commit bcc784243e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 7 deletions

View File

@ -23,13 +23,23 @@ export default defineNuxtCommand({
process.exit(1) process.exit(1)
} }
const t = await downloadTemplate(template, { let t
dir: args._[0] as string,
force: args.force, try {
offline: args.offline, t = await downloadTemplate(template, {
preferOffline: args['prefer-offline'], dir: args._[0] as string,
registry: process.env.NUXI_INIT_REGISTRY || DEFAULT_REGISTRY force: args.force,
}) offline: args.offline,
preferOffline: args['prefer-offline'],
registry: process.env.NUXI_INIT_REGISTRY || DEFAULT_REGISTRY
})
} catch (err) {
if (process.env.DEBUG) {
throw err
}
consola.error((err as Error).toString())
process.exit(1)
}
// Show next steps // Show next steps
const relativeDist = rpath(t.dir) const relativeDist = rpath(t.dir)