Merge pull request #14128 from WalkingPizza/fix/14114

Throw if --template flag is immediately followed by another flag when creating app via CLI
This commit is contained in:
Rémi de Juvigny 2022-10-14 17:51:18 +02:00 committed by GitHub
commit d90504462c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,15 @@ async function initProject(projectName, program) {
await checkInstallPath(resolve(projectName));
}
const programFlags = program.options
.reduce((acc, { short, long }) => [...acc, short, long], [])
.filter(Boolean);
if (program.template && programFlags.includes(program.template)) {
console.error(`${program.template} is not a valid template`);
process.exit(1);
}
const hasDatabaseOptions = databaseOptions.some((opt) => program[opt]);
if (program.quickstart && hasDatabaseOptions) {