From ca731f0f33ce98b5459dddce4f198cc476aa556a Mon Sep 17 00:00:00 2001 From: "Fred K. Schott" Date: Fri, 5 Aug 2022 15:35:59 -0700 Subject: [PATCH] fred pass --- packages/create-astro/src/index.ts | 31 +++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/packages/create-astro/src/index.ts b/packages/create-astro/src/index.ts index 408be8f5cd9c..ac7606014cb2 100644 --- a/packages/create-astro/src/index.ts +++ b/packages/create-astro/src/index.ts @@ -294,31 +294,34 @@ export async function main() { { type: 'select', name: 'typescript', - message: - 'Astro is a TypeScript-first framework. How strict would you like the typechecking to be?', + message: 'How would you like to setup TypeScript?', choices: [ { title: 'Relaxed', - description: "Not a big fan of TypeScript? No issues, we'll keep this kind", value: 'default', }, { title: 'Strict (recommended)', - description: 'Will enable `strict`', + description: 'Enable `strict` typechecking rules', value: 'strict', }, { - title: 'Stricter', - description: 'Will enable `strict` and some stricter settings', + title: 'Strictest', + description: 'Enable all typechecking rules', value: 'stricter', }, + { + title: 'I prefer not to use TypeScript', + description: `That's cool too!`, + value: 'optout', + }, ], }, { onCancel: () => { ora().info( dim( - 'Operation cancelled. No worries, your project folder has already been created and TypeScript settings have been set to "Relaxed"' + 'Operation cancelled. Your project folder has been created but no TypeScript configuration file was created.' ) ); process.exit(1); @@ -326,6 +329,20 @@ export async function main() { } ); + if (tsResponse.typescript === 'optout') { + console.log(``); + ora().info(cyan(bold(`Don't love TypeScript? That's okay!`))); + console.log(` Astro supports TypeScript inside of ".astro" Astro component scripts,`); + console.log(` so we still need to create a few TypeScript-related files in your project.`); + console.log( + ` You can safely ignore them, but don't delete them! ${dim( + '(ex: tsconfig.json, types.d.ts)' + )}` + ); + console.log(``); + tsResponse.typescript = 'default'; + await wait(300); + } if (args.dryRun) { ora().info(dim(`--dry-run enabled, skipping.`)); } else if (tsResponse.typescript) {