Skip to content

Commit

Permalink
Use pre node@4 compatible path-exists (facebook#685)
Browse files Browse the repository at this point in the history
* Revert "Add ES5 version of `path-exists` to CLI"

This reverts commit fc3ab46.

* Use pre node@4 compatible `path-exists`

Ref facebook#617
  • Loading branch information
SimenB authored and feiqitian committed Oct 25, 2016
1 parent bb2141b commit e96e9ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
16 changes: 2 additions & 14 deletions packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var spawn = require('cross-spawn');
var chalk = require('chalk');
var semver = require('semver');
var argv = require('minimist')(process.argv.slice(2));
var pathExists = require('path-exists');

/**
* Arguments:
Expand Down Expand Up @@ -75,7 +76,7 @@ function createApp(name, verbose, version) {

checkAppName(appName);

if (!pathExistsSync(name)) {
if (!pathExists.sync(name)) {
fs.mkdirSync(root);
} else if (!isSafeToCreateProjectIn(root)) {
console.log('The directory `' + name + '` contains file(s) that could conflict. Aborting.');
Expand Down Expand Up @@ -219,16 +220,3 @@ function isSafeToCreateProjectIn(root) {
return validFiles.indexOf(file) >= 0;
});
}

// This is an ES5 version of https://github.com/sindresorhus/path-exists.
// The reason it exists is so that the CLI doesn't break before being able to
// warn the user they're using an unsupported version of Node.
// See https://github.com/facebookincubator/create-react-app/issues/570
function pathExistsSync(fp) {
try {
fs.accessSync(fp);
return true;
} catch (err) {
return false;
}
}
1 change: 1 addition & 0 deletions packages/create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"chalk": "^1.1.1",
"cross-spawn": "^4.0.0",
"minimist": "^1.2.0",
"path-exists": "^2.1.0",
"semver": "^5.0.3"
}
}
2 changes: 1 addition & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"json-loader": "0.5.4",
"object-assign": "4.1.0",
"opn": "4.0.2",
"path-exists": "3.0.0",
"path-exists": "2.1.0",
"postcss-loader": "0.13.0",
"promise": "7.1.1",
"recursive-readdir": "2.0.0",
Expand Down

0 comments on commit e96e9ac

Please sign in to comment.