Skip to content

Commit cc1a733

Browse files
committed
cleanup
1 parent 17c002f commit cc1a733

File tree

2 files changed

+4
-70
lines changed

2 files changed

+4
-70
lines changed

createReactWpTheme.js

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,13 @@ const fs = require('fs-extra');
4141
const path = require('path');
4242
const execSync = require('child_process').execSync;
4343
const spawn = require('cross-spawn');
44-
const semver = require('semver');
4544
const dns = require('dns');
46-
const tmp = require('tmp');
47-
const unpack = require('tar-pack').unpack;
4845
const url = require('url');
49-
const hyperquest = require('hyperquest');
5046
const envinfo = require('envinfo');
51-
const os = require('os');
5247

5348
const packageJson = require('./package.json');
5449
const _wpThemeVersion = packageJson.version;
55-
const _createReactAppVersion = _wpThemeVersion.split('-')[0];
50+
// const _createReactAppVersion = _wpThemeVersion.split('-')[0];
5651

5752
// Check this!!!!
5853
const _getScriptsPath = function() {
@@ -184,7 +179,7 @@ function printValidationResults(results) {
184179
}
185180
}
186181

187-
console.log(program.name() + " version: " + chalk.magenta(packageJson.version));
182+
console.log(program.name() + " version: " + chalk.magenta(_wpThemeVersion));
188183
createApp(
189184
projectName,
190185
program.verbose,
@@ -212,7 +207,7 @@ function createApp(
212207
console.log(`Creating a new React WP theme in ${chalk.green(root)}.`);
213208
console.log();
214209

215-
const useYarn = useNpm ? false : shouldUseYarn();
210+
let useYarn = useNpm ? false : shouldUseYarn();
216211
const originalDirectory = process.cwd();
217212

218213
process.chdir(root); // change into the newly created folder, then run create-react-app.
@@ -397,67 +392,6 @@ function getProxy() {
397392
}
398393
}
399394

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-
461395
function checkIfOnline(useYarn) {
462396
if (!useYarn) {
463397
// Don't ping the Yarn registry.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-react-wptheme",
3-
"version": "2.1.1-wptheme-2.0.6",
3+
"version": "2.1.1-wptheme-2.0.8",
44
"description": "Create React WP themes with no build configuration.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)