Skip to content

Commit

Permalink
feat(nuxt): add writeFileSync and tsconfig.json check in rootFolderSync
Browse files Browse the repository at this point in the history
  • Loading branch information
productdevbook committed Dec 21, 2023
1 parent 65af061 commit 337ba83
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/nuxt/src/runtime/core/utils/rootFolderSync.ts
Original file line number Diff line number Diff line change
@@ -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'

/**
Expand All @@ -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,
}
Expand Down

0 comments on commit 337ba83

Please sign in to comment.