mirror of
https://github.com/withastro/astro.git
synced 2025-03-17 23:11:29 -05:00
feat: create root tsconfig if doesn't exist
This commit is contained in:
parent
5ba6f2abb2
commit
a73a89a311
1 changed files with 14 additions and 0 deletions
|
@ -167,6 +167,20 @@ export async function resolveConfig(
|
|||
}
|
||||
|
||||
if (astroConfig.experimental.typescript) {
|
||||
const rootTsConfigUrl = new URL('./tsconfig.json', astroConfig.root);
|
||||
if (!fsMod.existsSync(rootTsConfigUrl)) {
|
||||
fsMod.writeFileSync(
|
||||
rootTsConfigUrl,
|
||||
JSON.stringify(
|
||||
{
|
||||
extends: ['astro/tsconfigs/base', GENERATED_TSCONFIG_PATH],
|
||||
},
|
||||
null,
|
||||
2,
|
||||
),
|
||||
'utf-8',
|
||||
);
|
||||
}
|
||||
const generatedTsConfigUrl = new URL(GENERATED_TSCONFIG_PATH, astroConfig.root);
|
||||
if (!fsMod.existsSync(generatedTsConfigUrl)) {
|
||||
fsMod.mkdirSync(path.dirname(fileURLToPath(generatedTsConfigUrl)), { recursive: true });
|
||||
|
|
Loading…
Add table
Reference in a new issue