@@ -50,7 +50,7 @@ const _wpThemeVersion = packageJson.version;
50
50
const _createReactAppVersion = _wpThemeVersion . split ( "-wp." ) [ 0 ] ;
51
51
52
52
// Check these!!!!
53
- const _reactScriptsWpThemeVersion = "3.2 .0-wp.2 " ;
53
+ const _reactScriptsWpThemeVersion = "3.3 .0-wp.1 " ;
54
54
const _getScriptsPath = function ( ) {
55
55
return scriptsFromNpm ( ) ;
56
56
} ;
@@ -110,7 +110,7 @@ const program = new commander.Command(packageJson.name)
110
110
. option ( "--info" , "print environment debug info" )
111
111
. option ( "--use-npm" , "force downloading packages using npm instead of yarn (if both are installed)" )
112
112
. option ( "--use-pnp" )
113
- . option ( "--typescript" )
113
+ . option ( "--typescript" , "set your theme to use TypeScript" )
114
114
. allowUnknownOption ( )
115
115
. on ( "--help" , ( ) => {
116
116
console . log ( ` Only ${ chalk . green ( "<project-directory>" ) } is required.` ) ;
@@ -172,6 +172,7 @@ function createApp(name, verbose, version, useNpm, usePnp, useTypescript, templa
172
172
fs . ensureDirSync ( name ) ;
173
173
174
174
console . log ( `Creating a new React WP theme in ${ chalk . green ( root ) } .` ) ;
175
+ console . log ( `Using Create React App ${ chalk . green ( _createReactAppVersion ) } to scaffold the theme's source code...` ) ;
175
176
console . log ( ) ;
176
177
177
178
let useYarn = useNpm ? false : shouldUseYarn ( ) ;
@@ -194,6 +195,14 @@ function shouldUseYarn() {
194
195
function createWpTheme ( root , appName , version , verbose , originalDirectory , template , useYarn , usePnp , useTypescript ) {
195
196
const packageToInstall = "create-react-app" ;
196
197
198
+ if ( useTypescript === true ) {
199
+ template = "wptheme-typescript" ;
200
+ }
201
+
202
+ if ( typeof template !== "string" || template . trim ( ) . length === 0 ) {
203
+ template = "wptheme" ;
204
+ }
205
+
197
206
return Promise . resolve ( packageToInstall )
198
207
. then ( ( packageName ) =>
199
208
checkIfOnline ( useYarn ) . then ( ( isOnline ) => ( {
@@ -207,7 +216,7 @@ function createWpTheme(root, appName, version, verbose, originalDirectory, templ
207
216
}
208
217
209
218
let createWpThemeReactRoot = "react-src" ;
210
- createReactApp ( createWpThemeReactRoot , appName , version , verbose , originalDirectory , template , useYarn , usePnp , useTypescript ) ;
219
+ createReactApp ( createWpThemeReactRoot , appName , version , verbose , originalDirectory , template , useYarn , usePnp ) ;
211
220
} )
212
221
. catch ( ( reason ) => {
213
222
console . log ( ) ;
@@ -227,7 +236,7 @@ function createWpTheme(root, appName, version, verbose, originalDirectory, templ
227
236
} ) ;
228
237
}
229
238
230
- function createReactApp ( createWpThemeReactRoot , appName , version , verbose , originalDirectory , template , useYarn , usePnp , useTypescript ) {
239
+ function createReactApp ( createWpThemeReactRoot , appName , version , verbose , originalDirectory , template , useYarn , usePnp ) {
231
240
return new Promise ( ( resolve , reject ) => {
232
241
let command = "npx" ;
233
242
@@ -247,9 +256,8 @@ function createReactApp(createWpThemeReactRoot, appName, version, verbose, origi
247
256
args . push ( "--use-pnp" ) ;
248
257
}
249
258
250
- if ( useTypescript ) {
251
- args . push ( "--typescript" ) ;
252
- }
259
+ args . push ( "--template" ) ;
260
+ args . push ( template ) ;
253
261
254
262
let scriptsPath = _getScriptsPath ( ) ;
255
263
args . push ( "--scripts-version" ) ;
0 commit comments