@@ -124,6 +124,47 @@ yargs
124
124
125
125
if ( targets . includes ( 'typescript' ) ) {
126
126
entries . types = path . join ( output , 'typescript' , source , 'index.d.ts' ) ;
127
+
128
+ if ( ! ( await fs . pathExists ( path . join ( root , 'tsconfig.json' ) ) ) ) {
129
+ const { tsconfig } = await inquirer . prompt ( {
130
+ type : 'confirm' ,
131
+ name : 'tsconfig' ,
132
+ message : `You have enabled 'typescript' compilation, but we couldn't find a 'tsconfig.json' in project root. Generate one?` ,
133
+ default : true ,
134
+ } ) ;
135
+
136
+ if ( tsconfig ) {
137
+ await fs . writeFile (
138
+ path . join ( root , 'tsconfig.json' ) ,
139
+ JSON . stringify (
140
+ {
141
+ compilerOptions : {
142
+ allowUnreachableCode : false ,
143
+ allowUnusedLabels : false ,
144
+ esModuleInterop : true ,
145
+ forceConsistentCasingInFileNames : true ,
146
+ jsx : 'react' ,
147
+ lib : [ 'esnext' ] ,
148
+ module : 'esnext' ,
149
+ moduleResolution : 'node' ,
150
+ noFallthroughCasesInSwitch : true ,
151
+ noImplicitReturns : true ,
152
+ noImplicitUseStrict : false ,
153
+ noStrictGenericChecks : false ,
154
+ noUnusedLocals : true ,
155
+ noUnusedParameters : true ,
156
+ resolveJsonModule : true ,
157
+ skipLibCheck : true ,
158
+ strict : true ,
159
+ target : 'esnext' ,
160
+ } ,
161
+ } ,
162
+ null ,
163
+ 2
164
+ )
165
+ ) ;
166
+ }
167
+ }
127
168
}
128
169
129
170
const prepare = 'bob build' ;
0 commit comments