Skip to content

Commit e8bdd8b

Browse files
halfzebrarandycoulman
authored andcommitted
Remove path-exists from dependencies and replace it with fs.existsSync (facebook#1289)
1 parent 53bded6 commit e8bdd8b

File tree

6 files changed

+8
-12
lines changed

6 files changed

+8
-12
lines changed

packages/react-scripts/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"json-loader": "0.5.4",
5858
"node-sass": "^3.13.0",
5959
"object-assign": "4.1.0",
60-
"path-exists": "2.1.0",
6160
"postcss-loader": "1.0.0",
6261
"promise": "7.1.1",
6362
"react-dev-utils": "^0.4.2",

packages/react-scripts/scripts/build.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ require('dotenv').config({silent: true});
2121
var chalk = require('chalk');
2222
var fs = require('fs-extra');
2323
var path = require('path');
24-
var pathExists = require('path-exists');
2524
var filesize = require('filesize');
2625
var gzipSize = require('gzip-size').sync;
2726
var webpack = require('webpack');
@@ -31,7 +30,7 @@ var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
3130
var recursive = require('recursive-readdir');
3231
var stripAnsi = require('strip-ansi');
3332

34-
var useYarn = pathExists.sync(paths.yarnLockFile);
33+
var useYarn = fs.existsSync(paths.yarnLockFile);
3534

3635
// Warn and crash if required files are missing
3736
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {

packages/react-scripts/scripts/eject.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
var createJestConfig = require('../utils/createJestConfig');
1111
var fs = require('fs-extra');
1212
var path = require('path');
13-
var pathExists = require('path-exists');
1413
var paths = require('../config/paths');
1514
var prompt = require('react-dev-utils/prompt');
1615
var spawnSync = require('cross-spawn').sync;
@@ -144,7 +143,7 @@ prompt(
144143
);
145144
console.log();
146145

147-
if (pathExists.sync(paths.yarnLockFile)) {
146+
if (fs.existsSync(paths.yarnLockFile)) {
148147
console.log(cyan('Running yarn...'));
149148
fs.removeSync(ownPath);
150149
spawnSync('yarn', [], {stdio: 'inherit'});

packages/react-scripts/scripts/init.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
var fs = require('fs-extra');
1111
var path = require('path');
1212
var spawn = require('cross-spawn');
13-
var pathExists = require('path-exists');
1413
var chalk = require('chalk');
1514

1615
module.exports = function(appPath, appName, verbose, originalDirectory) {
1716
var ownPackageName = require(path.join(__dirname, '..', 'package.json')).name;
1817
var ownPath = path.join(appPath, 'node_modules', ownPackageName);
1918
var appPackage = require(path.join(appPath, 'package.json'));
20-
var useYarn = pathExists.sync(path.join(appPath, 'yarn.lock'));
19+
var useYarn = fs.existsSync(path.join(appPath, 'yarn.lock'));
2120

2221
// Copy over some of the devDependencies
2322
appPackage.dependencies = appPackage.dependencies || {};
@@ -36,7 +35,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
3635
JSON.stringify(appPackage, null, 2)
3736
);
3837

39-
var readmeExists = pathExists.sync(path.join(appPath, 'README.md'));
38+
var readmeExists = fs.existsSync(path.join(appPath, 'README.md'));
4039
if (readmeExists) {
4140
fs.renameSync(path.join(appPath, 'README.md'), path.join(appPath, 'README.old.md'));
4241
}

packages/react-scripts/scripts/start.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
2929
var getProcessForPort = require('react-dev-utils/getProcessForPort');
3030
var openBrowser = require('react-dev-utils/openBrowser');
3131
var prompt = require('react-dev-utils/prompt');
32-
var pathExists = require('path-exists');
32+
var fs = require('fs');
3333
var config = require('../config/webpack.config.dev');
3434
var paths = require('../config/paths');
3535

36-
var useYarn = pathExists.sync(paths.yarnLockFile);
36+
var useYarn = fs.existsSync(paths.yarnLockFile);
3737
var cli = useYarn ? 'yarn' : 'npm';
3838
var isInteractive = process.stdout.isTTY;
3939

packages/react-scripts/utils/createJestConfig.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
// Note: this file does not exist after ejecting.
1111

12-
const pathExists = require('path-exists');
12+
const fs = require('fs');
1313
const paths = require('../config/paths');
1414

1515
module.exports = (resolve, rootDir, isEjecting) => {
1616
// Use this instead of `paths.testsSetup` to avoid putting
1717
// an absolute filename into configuration after ejecting.
18-
const setupTestsFile = pathExists.sync(paths.testsSetup) ? '<rootDir>/src/setupTests.js' : undefined;
18+
const setupTestsFile = fs.existsSync(paths.testsSetup) ? '<rootDir>/src/setupTests.js' : undefined;
1919

2020
// TODO: I don't know if it's safe or not to just use / as path separator
2121
// in Jest configs. We need help from somebody with Windows to determine this.

0 commit comments

Comments
 (0)