@@ -41,18 +41,13 @@ const fs = require('fs-extra');
41
41
const path = require ( 'path' ) ;
42
42
const execSync = require ( 'child_process' ) . execSync ;
43
43
const spawn = require ( 'cross-spawn' ) ;
44
- const semver = require ( 'semver' ) ;
45
44
const dns = require ( 'dns' ) ;
46
- const tmp = require ( 'tmp' ) ;
47
- const unpack = require ( 'tar-pack' ) . unpack ;
48
45
const url = require ( 'url' ) ;
49
- const hyperquest = require ( 'hyperquest' ) ;
50
46
const envinfo = require ( 'envinfo' ) ;
51
- const os = require ( 'os' ) ;
52
47
53
48
const packageJson = require ( './package.json' ) ;
54
49
const _wpThemeVersion = packageJson . version ;
55
- const _createReactAppVersion = _wpThemeVersion . split ( '-' ) [ 0 ] ;
50
+ // const _createReactAppVersion = _wpThemeVersion.split('-')[0];
56
51
57
52
// Check this!!!!
58
53
const _getScriptsPath = function ( ) {
@@ -184,7 +179,7 @@ function printValidationResults(results) {
184
179
}
185
180
}
186
181
187
- console . log ( program . name ( ) + " version: " + chalk . magenta ( packageJson . version ) ) ;
182
+ console . log ( program . name ( ) + " version: " + chalk . magenta ( _wpThemeVersion ) ) ;
188
183
createApp (
189
184
projectName ,
190
185
program . verbose ,
@@ -212,7 +207,7 @@ function createApp(
212
207
console . log ( `Creating a new React WP theme in ${ chalk . green ( root ) } .` ) ;
213
208
console . log ( ) ;
214
209
215
- const useYarn = useNpm ? false : shouldUseYarn ( ) ;
210
+ let useYarn = useNpm ? false : shouldUseYarn ( ) ;
216
211
const originalDirectory = process . cwd ( ) ;
217
212
218
213
process . chdir ( root ) ; // change into the newly created folder, then run create-react-app.
@@ -397,67 +392,6 @@ function getProxy() {
397
392
}
398
393
}
399
394
400
- function checkThatNpmCanReadCwd ( ) {
401
- const cwd = process . cwd ( ) ;
402
- let childOutput = null ;
403
- try {
404
- // Note: intentionally using spawn over exec since
405
- // the problem doesn't reproduce otherwise.
406
- // `npm config list` is the only reliable way I could find
407
- // to reproduce the wrong path. Just printing process.cwd()
408
- // in a Node process was not enough.
409
- childOutput = spawn . sync ( 'npm' , [ 'config' , 'list' ] ) . output . join ( '' ) ;
410
- } catch ( err ) {
411
- // Something went wrong spawning node.
412
- // Not great, but it means we can't do this check.
413
- // We might fail later on, but let's continue.
414
- return true ;
415
- }
416
- if ( typeof childOutput !== 'string' ) {
417
- return true ;
418
- }
419
- const lines = childOutput . split ( '\n' ) ;
420
- // `npm config list` output includes the following line:
421
- // "; cwd = C:\path\to\current\dir" (unquoted)
422
- // I couldn't find an easier way to get it.
423
- const prefix = '; cwd = ' ;
424
- const line = lines . find ( line => line . indexOf ( prefix ) === 0 ) ;
425
- if ( typeof line !== 'string' ) {
426
- // Fail gracefully. They could remove it.
427
- return true ;
428
- }
429
- const npmCWD = line . substring ( prefix . length ) ;
430
- if ( npmCWD === cwd ) {
431
- return true ;
432
- }
433
- console . error (
434
- chalk . red (
435
- `Could not start an npm process in the right directory.\n\n` +
436
- `The current directory is: ${ chalk . bold ( cwd ) } \n` +
437
- `However, a newly started npm process runs in: ${ chalk . bold (
438
- npmCWD
439
- ) } \n\n` +
440
- `This is probably caused by a misconfigured system terminal shell.`
441
- )
442
- ) ;
443
- if ( process . platform === 'win32' ) {
444
- console . error (
445
- chalk . red ( `On Windows, this can usually be fixed by running:\n\n` ) +
446
- ` ${ chalk . cyan (
447
- 'reg'
448
- ) } delete "HKCU\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n` +
449
- ` ${ chalk . cyan (
450
- 'reg'
451
- ) } delete "HKLM\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n\n` +
452
- chalk . red ( `Try to run the above two lines in the terminal.\n` ) +
453
- chalk . red (
454
- `To learn more about this problem, read: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/`
455
- )
456
- ) ;
457
- }
458
- return false ;
459
- }
460
-
461
395
function checkIfOnline ( useYarn ) {
462
396
if ( ! useYarn ) {
463
397
// Don't ping the Yarn registry.
0 commit comments