From 07623e2f8463277731f9a00d5808079a18990492 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus <sbekkhus91@gmail.com> Date: Tue, 20 Sep 2016 01:00:51 +0200 Subject: [PATCH] Use pre node@4 compatible `path-exists` (#685) * Revert "Add ES5 version of `path-exists` to CLI" This reverts commit fc3ab46d2a54f142f9287ce7de9ab2fc2514487d. * Use pre node@4 compatible `path-exists` Ref #617 --- packages/create-react-app/index.js | 16 ++-------------- packages/create-react-app/package.json | 1 + packages/react-scripts/package.json | 2 +- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/create-react-app/index.js b/packages/create-react-app/index.js index 94a3497a9..02f9de254 100644 --- a/packages/create-react-app/index.js +++ b/packages/create-react-app/index.js @@ -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: @@ -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.'); @@ -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; - } -} diff --git a/packages/create-react-app/package.json b/packages/create-react-app/package.json index ca428bd87..f85611555 100644 --- a/packages/create-react-app/package.json +++ b/packages/create-react-app/package.json @@ -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" } } diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index c9c5b34f6..ced353068 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -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", -- GitLab