@@ -5,28 +5,44 @@ import type { CoConfigPassthroughEntry } from 'coconfig';
55
66import { tsconfig , tsconfigBuild } from './tsconfig' ;
77import { jestConfig } from './jest' ;
8+ import { vitestConfig } from './vitest' ;
89import { prettierConfig } from './prettier' ;
910import { eslintRc } from './eslint' ;
1011import { commitLint } from './commitlint' ;
12+ import { hasPackage } from './has-package' ;
1113
1214interface OtiCoConfig {
1315 '.eslintignore' : string ,
1416 '.npmignore' : string ,
1517 'tsconfig.json' : CoConfigPassthroughEntry < typeof tsconfig > ,
1618 'tsconfig.build.json' : CoConfigPassthroughEntry < typeof tsconfigBuild > ,
17- 'jest.config.js' : CoConfigPassthroughEntry ,
19+ 'jest.config.js' ?: CoConfigPassthroughEntry ,
20+ 'vitest.config.ts' ?: CoConfigPassthroughEntry ,
1821 '.prettierrc.js' : CoConfigPassthroughEntry ,
1922 '.eslintrc.js' : CoConfigPassthroughEntry ,
2023 '.commitlintrc.json' : CoConfigPassthroughEntry ,
2124}
2225
23- export const config : OtiCoConfig = {
26+ const baseConfig : OtiCoConfig = {
2427 '.eslintignore' : fs . readFileSync ( path . resolve ( __dirname , '../templates/eslintignore' ) , 'utf8' ) ,
2528 '.npmignore' : fs . readFileSync ( path . resolve ( __dirname , '../templates/npmignore' ) , 'utf8' ) ,
2629 'tsconfig.json' : { configuration : tsconfig , stringify : true } ,
2730 'tsconfig.build.json' : { configuration : tsconfigBuild , stringify : true } ,
28- 'jest.config.js' : { configuration : jestConfig } ,
2931 '.prettierrc.js' : { configuration : prettierConfig } ,
3032 '.eslintrc.js' : { configuration : eslintRc } ,
3133 '.commitlintrc.json' : { configuration : commitLint , stringify : true } ,
3234} ;
35+
36+ if ( hasPackage ( 'jest' ) ) {
37+ Object . assign ( baseConfig , {
38+ 'jest.config.js' : { configuration : jestConfig } ,
39+ } ) ;
40+ }
41+
42+ if ( hasPackage ( 'vitest' ) ) {
43+ Object . assign ( baseConfig , {
44+ 'vitest.config.ts' : { configuration : vitestConfig } ,
45+ } ) ;
46+ }
47+
48+ export const config = baseConfig ;
0 commit comments