]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
fix: should throw error when an internal error is encountered
authorHaoqun Jiang <haoqunjiang@gmail.com>
Fri, 28 Feb 2025 10:55:59 +0000 (18:55 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Fri, 28 Feb 2025 10:55:59 +0000 (18:55 +0800)
Also fix the bug that no interactive prompt is provided,
result.projectName would be undefined and cause an error.

index.ts

index 44ca81c469668a84f2c35bc35eee1ff72a00bb54..0f0e6087189cc00f244bd961cc0a6975ca460bcc 100755 (executable)
--- 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)
 })