From 337ba837a9b1e3c9e3a38c1abd42aa899f2fefd9 Mon Sep 17 00:00:00 2001 From: productdevbook Date: Thu, 21 Dec 2023 15:26:50 +0300 Subject: [PATCH] feat(nuxt): add writeFileSync and tsconfig.json check in rootFolderSync --- .../nuxt/src/runtime/core/utils/rootFolderSync.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/runtime/core/utils/rootFolderSync.ts b/packages/nuxt/src/runtime/core/utils/rootFolderSync.ts index 46b6ce04..dd227142 100644 --- a/packages/nuxt/src/runtime/core/utils/rootFolderSync.ts +++ b/packages/nuxt/src/runtime/core/utils/rootFolderSync.ts @@ -1,5 +1,5 @@ -import { existsSync, mkdirSync } from 'node:fs' -import { join } from 'node:path' +import { existsSync, mkdirSync, writeFileSync } from 'node:fs' +import { join, resolve } from 'node:path' import type { PergelOptions } from '../types' /** @@ -18,6 +18,13 @@ export function rootFolderSync(resolvePergelDir: string, options: PergelOptions) mkdirSync(projectFolder, { recursive: true }) } + // Check ts.config.json + if (!existsSync(resolve(join(resolvePergelDir, 'tsconfig.json')))) { + writeFileSync(resolve(join(resolvePergelDir, 'tsconfig.json')), JSON.stringify({ + extends: '../.nuxt/tsconfig.server.json', + }, null, 2)) + } + return { projectNames, }