Skip to content

Commit 0c609cf

Browse files
committed
fix(create): accept default package name when pressing Enter without typing
When the user presses Enter on the "Package name:" prompt without typing, `@clack/core` passes `undefined` as the value to validate. The old condition `value != null && value.length === 0` skipped `undefined`, causing validation to fail with "Invalid package name". Changed to `value == null || value.length === 0` so both `undefined` and empty string are treated as "use the default".
1 parent 6a05434 commit 0c609cf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/cli/src/create/prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export async function promptPackageNameAndTargetDir(
2020
placeholder: defaultPackageName,
2121
defaultValue: defaultPackageName,
2222
validate: (value) => {
23-
if (value != null && value.length === 0) {
23+
if (value == null || value.length === 0) {
2424
return;
2525
}
2626

0 commit comments

Comments
 (0)