MCPcopy Create free account
hub / github.com/epicweb-dev/react-suspense / updateTsconfig

Function updateTsconfig

epicshop/fix.js:66–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64}
65
66async function updateTsconfig() {
67 const tsconfig = {
68 files: [],
69 exclude: ['node_modules'],
70 references: appsWithPkgJson.map((a) => ({
71 path: relativeToWorkshopRoot(a).replace(/\\/g, '/'),
72 })),
73 }
74 const written = await writeIfNeeded(
75 path.join(workshopRoot, 'tsconfig.json'),
76 `${JSON.stringify(tsconfig, null, 2)}\n`,
77 { parser: 'json' },
78 )
79
80 if (written) {
81 // delete node_modules/.cache
82 const cacheDir = path.join(workshopRoot, 'node_modules', '.cache')
83 if (exists(cacheDir)) {
84 await fs.promises.rm(cacheDir, { recursive: true })
85 }
86 console.log('all fixed up')
87 }
88}
89
90async function writeIfNeeded(filepath, content) {
91 const oldContent = await fs.promises.readFile(filepath, 'utf8')

Callers 1

fix.jsFile · 0.85

Calls 3

relativeToWorkshopRootFunction · 0.85
writeIfNeededFunction · 0.85
existsFunction · 0.85

Tested by

no test coverage detected