@@ -286,8 +286,18 @@ async function init() {
286
286
}
287
287
if ( needsTypeScript ) {
288
288
render ( 'config/typescript' )
289
+
290
+ // Render tsconfigs
291
+ render ( 'tsconfig/base' )
292
+ if ( needsCypress ) {
293
+ render ( 'tsconfig/cypress' )
294
+ }
295
+ if ( needsVitest ) {
296
+ render ( 'tsconfig/vitest' )
297
+ }
289
298
}
290
299
300
+ // Render ESLint config
291
301
if ( needsEslint ) {
292
302
renderEslint ( root , { needsTypeScript, needsCypress, needsCypressCT, needsPrettier } )
293
303
}
@@ -316,13 +326,15 @@ async function init() {
316
326
// If that's not possible, we put `.ts` version alongside the `.js` one in the templates.
317
327
// So after all the templates are rendered, we need to clean up the redundant files.
318
328
// (Currently it's only `cypress/plugin/index.ts`, but we might add more in the future.)
329
+ // (Or, we might completely get rid of the plugins folder as Cypress 10 supports `cypress.config.ts`)
319
330
320
331
if ( needsTypeScript ) {
321
332
// Convert the JavaScript template to the TypeScript
322
333
// Check all the remaining `.js` files:
323
334
// - If the corresponding TypeScript version already exists, remove the `.js` version.
324
335
// - Otherwise, rename the `.js` file to `.ts`
325
- // rename jsconfig.json to tsconfig.json
336
+ // Remove `jsconfig.json`, because we already hav tsconfig.json
337
+ // `jsconfig.json` is not reused, because we use solution-style `tsconfig`s, which are much more complicated.
326
338
preOrderDirectoryTraverse (
327
339
root ,
328
340
( ) => { } ,
@@ -335,7 +347,7 @@ async function init() {
335
347
fs . renameSync ( filepath , tsFilePath )
336
348
}
337
349
} else if ( path . basename ( filepath ) === 'jsconfig.json' ) {
338
- fs . renameSync ( filepath , filepath . replace ( / j s c o n f i g \. j s o n $ / , 'tsconfig.json' ) )
350
+ fs . unlinkSync ( filepath )
339
351
}
340
352
}
341
353
)
0 commit comments