fix(create-astro): typescript prompt handling (#5958)
* fix(create-astro): typescript prompt handling * fallback * fix(create-astro): additional case Co-authored-by: Nate Moore <nate@astro.build>
This commit is contained in:
parent
ab7e1b9a5a
commit
c69c364c9f
2 changed files with 9 additions and 4 deletions
5
.changeset/angry-cups-hug.md
Normal file
5
.changeset/angry-cups-hug.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'create-astro': patch
|
||||
---
|
||||
|
||||
Fix typescript prompt handling
|
|
@ -312,7 +312,7 @@ export async function main() {
|
|||
args.typescript = 'strict';
|
||||
}
|
||||
|
||||
const tsResponse =
|
||||
let tsResponse =
|
||||
args.typescript ||
|
||||
(
|
||||
await prompts(
|
||||
|
@ -342,7 +342,7 @@ export async function main() {
|
|||
|
||||
if (tsResponse === 'unsure') {
|
||||
await typescriptByDefault();
|
||||
tsResponse.typescript = 'base';
|
||||
tsResponse = 'base';
|
||||
}
|
||||
if (args.dryRun) {
|
||||
ora().info(dim(`--dry-run enabled, skipping.`));
|
||||
|
@ -353,7 +353,7 @@ export async function main() {
|
|||
// If the template doesn't have a tsconfig.json, let's add one instead
|
||||
fs.writeFileSync(
|
||||
templateTSConfigPath,
|
||||
stringify({ extends: `astro/tsconfigs/${tsResponse}` }, null, 2)
|
||||
stringify({ extends: `astro/tsconfigs/${tsResponse ?? 'base'}` }, null, 2)
|
||||
);
|
||||
|
||||
return;
|
||||
|
@ -363,7 +363,7 @@ export async function main() {
|
|||
|
||||
if (templateTSConfig && typeof templateTSConfig === 'object') {
|
||||
const result = assign(templateTSConfig, {
|
||||
extends: `astro/tsconfigs/${tsResponse.typescript}`,
|
||||
extends: `astro/tsconfigs/${tsResponse ?? 'base'}`,
|
||||
});
|
||||
|
||||
fs.writeFileSync(templateTSConfigPath, stringify(result, null, 2));
|
||||
|
|
Loading…
Reference in a new issue