Skip to content

Use pre node@4 compatible path-exists #685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you want this as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it's fine to use the same old version here for consistency. The new version doesn't have any additional functionality.

"postcss-loader": "0.13.0",
"promise": "7.1.1",
"recursive-readdir": "2.0.0",
Expand Down