From 0b5d6a05466bf4fe08172978210109bcfe52fd17 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Fri, 28 Feb 2025 18:55:59 +0800 Subject: [PATCH] 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. --- index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) }) -- 2.39.5