Skip to content

Commit 0b5d6a0

Browse files
committed
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.
1 parent 313847d commit 0b5d6a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ async function init() {
386386
// so we still have to assign the default values here
387387
const {
388388
projectName,
389-
packageName = projectName.trim() || defaultProjectName,
389+
packageName = projectName?.trim() || defaultProjectName,
390390
shouldOverwrite = argv.force as boolean,
391391
needsJsx = argv.jsx as boolean,
392392
needsTypeScript = (argv.ts || argv.typescript) as boolean,
@@ -707,4 +707,5 @@ async function init() {
707707

708708
init().catch((e) => {
709709
console.error(e)
710+
process.exit(1)
710711
})

0 commit comments

Comments
 (0)