From: Haoqun Jiang Date: Fri, 28 Feb 2025 10:55:59 +0000 (+0800) Subject: fix: should throw error when an internal error is encountered X-Git-Tag: v3.15.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b5d6a05466bf4fe08172978210109bcfe52fd17;p=thirdparty%2Fvuejs%2Fcreate-vue.git fix: should throw error when an internal error is encountered Also fix the bug that no interactive prompt is provided, result.projectName would be undefined and cause an error. --- diff --git a/index.ts b/index.ts index 44ca81c4..0f0e6087 100755 --- a/index.ts +++ b/index.ts @@ -386,7 +386,7 @@ async function init() { // so we still have to assign the default values here const { projectName, - packageName = projectName.trim() || defaultProjectName, + packageName = projectName?.trim() || defaultProjectName, shouldOverwrite = argv.force as boolean, needsJsx = argv.jsx as boolean, needsTypeScript = (argv.ts || argv.typescript) as boolean, @@ -707,4 +707,5 @@ async function init() { init().catch((e) => { console.error(e) + process.exit(1) })