@@ -50,7 +50,7 @@ const _wpThemeVersion = packageJson.version;
5050const _createReactAppVersion = _wpThemeVersion . split ( "-wp." ) [ 0 ] ;
5151
5252// Check these!!!!
53- const _reactScriptsWpThemeVersion = "3.2 .0-wp.2 " ;
53+ const _reactScriptsWpThemeVersion = "3.3 .0-wp.1 " ;
5454const _getScriptsPath = function ( ) {
5555 return scriptsFromNpm ( ) ;
5656} ;
@@ -110,7 +110,7 @@ const program = new commander.Command(packageJson.name)
110110 . option ( "--info" , "print environment debug info" )
111111 . option ( "--use-npm" , "force downloading packages using npm instead of yarn (if both are installed)" )
112112 . option ( "--use-pnp" )
113- . option ( "--typescript" )
113+ . option ( "--typescript" , "set your theme to use TypeScript" )
114114 . allowUnknownOption ( )
115115 . on ( "--help" , ( ) => {
116116 console . log ( ` Only ${ chalk . green ( "<project-directory>" ) } is required.` ) ;
@@ -172,6 +172,7 @@ function createApp(name, verbose, version, useNpm, usePnp, useTypescript, templa
172172 fs . ensureDirSync ( name ) ;
173173
174174 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...` ) ;
175176 console . log ( ) ;
176177
177178 let useYarn = useNpm ? false : shouldUseYarn ( ) ;
@@ -194,6 +195,14 @@ function shouldUseYarn() {
194195function createWpTheme ( root , appName , version , verbose , originalDirectory , template , useYarn , usePnp , useTypescript ) {
195196 const packageToInstall = "create-react-app" ;
196197
198+ if ( useTypescript === true ) {
199+ template = "wptheme-typescript" ;
200+ }
201+
202+ if ( typeof template !== "string" || template . trim ( ) . length === 0 ) {
203+ template = "wptheme" ;
204+ }
205+
197206 return Promise . resolve ( packageToInstall )
198207 . then ( ( packageName ) =>
199208 checkIfOnline ( useYarn ) . then ( ( isOnline ) => ( {
@@ -207,7 +216,7 @@ function createWpTheme(root, appName, version, verbose, originalDirectory, templ
207216 }
208217
209218 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 ) ;
211220 } )
212221 . catch ( ( reason ) => {
213222 console . log ( ) ;
@@ -227,7 +236,7 @@ function createWpTheme(root, appName, version, verbose, originalDirectory, templ
227236 } ) ;
228237}
229238
230- function createReactApp ( createWpThemeReactRoot , appName , version , verbose , originalDirectory , template , useYarn , usePnp , useTypescript ) {
239+ function createReactApp ( createWpThemeReactRoot , appName , version , verbose , originalDirectory , template , useYarn , usePnp ) {
231240 return new Promise ( ( resolve , reject ) => {
232241 let command = "npx" ;
233242
@@ -247,9 +256,8 @@ function createReactApp(createWpThemeReactRoot, appName, version, verbose, origi
247256 args . push ( "--use-pnp" ) ;
248257 }
249258
250- if ( useTypescript ) {
251- args . push ( "--typescript" ) ;
252- }
259+ args . push ( "--template" ) ;
260+ args . push ( template ) ;
253261
254262 let scriptsPath = _getScriptsPath ( ) ;
255263 args . push ( "--scripts-version" ) ;
0 commit comments