Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] Skip path validation for examples #4434

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/create-toolpad-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const validatePath = async (relativePath: string): Promise<boolean | string> =>
await fs.access(absolutePath, fsConstants.F_OK);

// Directory exists, verify if it's empty to proceed

if (await isFolderEmpty(absolutePath)) {
return true;
}
Expand Down Expand Up @@ -272,7 +273,9 @@ const run = async () => {
message: example
? `Enter path of directory to download example "${chalk.cyan(example)}" into`
: 'Enter path of directory to bootstrap new app',
validate: validatePath,
// This check is only necessary if an empty app is being bootstrapped,
// not if an example is being downloaded.
validate: example ? () => true : validatePath,
default: '.',
});
}
Expand Down
Loading