diff --git a/index.ts b/index.ts index 84396fa54722696995278a4594588822092a288d..ebdcd1ee26cabad35f55fe8c5389a24d5cb04bc3 100644 --- a/index.ts +++ b/index.ts @@ -121,6 +121,12 @@ Select external port. ) .allowUnknownOption() .parse(process.argv); +if (process.argv.includes("--no-frontend")) { + program.frontend = false; +} +if (process.argv.includes("--no-eslint")) { + program.eslint = false; +} const packageManager = !!program.useNpm ? "npm" diff --git a/questions.ts b/questions.ts index 5b4a9ca2046e6e943c681a1ab5db6ba3ff231dd0..a1517dc3395c54084504fab1ab1aed49d9de00cf 100644 --- a/questions.ts +++ b/questions.ts @@ -89,14 +89,8 @@ export const askQuestions = async ( })), initial: 0, }, - { - onCancel: () => { - console.error("Exiting."); - process.exit(1); - }, - }, + handlers, ); - program.communityProjectPath = communityProjectPath; preferences.communityProjectPath = communityProjectPath; return; // early return - no further questions needed for community projects @@ -130,11 +124,12 @@ export const askQuestions = async ( } } - if (program.framework === "express" || program.framework === "fastapi") { - if (process.argv.includes("--no-frontend")) { - program.frontend = false; - } + if ( + program.template === "streaming" && + (program.framework === "express" || program.framework === "fastapi") + ) { // if a backend-only framework is selected, ask whether we should create a frontend + // (only for streaming backends) if (program.frontend === undefined) { if (ciInfo.isCI) { program.frontend = getPrefOrDefault("frontend"); @@ -161,7 +156,6 @@ export const askQuestions = async ( } } } else { - // single project if framework is nextjs program.frontend = false; } @@ -283,11 +277,7 @@ export const askQuestions = async ( preferences.openAiKey = key; } - if ( - program.framework !== "fastapi" && - !process.argv.includes("--eslint") && - !process.argv.includes("--no-eslint") - ) { + if (program.framework !== "fastapi" && program.eslint === undefined) { if (ciInfo.isCI) { program.eslint = getPrefOrDefault("eslint"); } else { diff --git a/templates/types.ts b/templates/types.ts index 6fc7b47c1e33cd2e56e21ad2c423258aa4904f8b..a0567e10e4e3158cb6d32735bcf45fcb55c6631d 100644 --- a/templates/types.ts +++ b/templates/types.ts @@ -13,7 +13,7 @@ export interface InstallTemplateArgs { isOnline: boolean; template: TemplateType; framework: TemplateFramework; - engine?: TemplateEngine; + engine: TemplateEngine; ui: TemplateUI; eslint: boolean; customApiPath?: string;