Commit 21b00444 authored by Eduard Kyvenko's avatar Eduard Kyvenko Committed by Ville Immonen
Browse files

Remove path-exists from dependencies and replace it with fs.existsSync (#1289)

parent 5fa34ddb
No related merge requests found
Showing with 8 additions and 12 deletions
+8 -12
......@@ -53,7 +53,6 @@
"jest": "17.0.2",
"json-loader": "0.5.4",
"object-assign": "4.1.0",
"path-exists": "2.1.0",
"postcss-loader": "1.0.0",
"promise": "7.1.1",
"react-dev-utils": "^0.4.2",
......
......@@ -21,7 +21,6 @@ require('dotenv').config({silent: true});
var chalk = require('chalk');
var fs = require('fs-extra');
var path = require('path');
var pathExists = require('path-exists');
var filesize = require('filesize');
var gzipSize = require('gzip-size').sync;
var webpack = require('webpack');
......@@ -31,7 +30,7 @@ var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
var recursive = require('recursive-readdir');
var stripAnsi = require('strip-ansi');
var useYarn = pathExists.sync(paths.yarnLockFile);
var useYarn = fs.existsSync(paths.yarnLockFile);
// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
......
......@@ -10,7 +10,6 @@
var createJestConfig = require('../utils/createJestConfig');
var fs = require('fs-extra');
var path = require('path');
var pathExists = require('path-exists');
var paths = require('../config/paths');
var prompt = require('react-dev-utils/prompt');
var spawnSync = require('cross-spawn').sync;
......@@ -144,7 +143,7 @@ prompt(
);
console.log();
if (pathExists.sync(paths.yarnLockFile)) {
if (fs.existsSync(paths.yarnLockFile)) {
console.log(cyan('Running yarn...'));
fs.removeSync(ownPath);
spawnSync('yarn', [], {stdio: 'inherit'});
......
......@@ -10,14 +10,13 @@
var fs = require('fs-extra');
var path = require('path');
var spawn = require('cross-spawn');
var pathExists = require('path-exists');
var chalk = require('chalk');
module.exports = function(appPath, appName, verbose, originalDirectory) {
var ownPackageName = require(path.join(__dirname, '..', 'package.json')).name;
var ownPath = path.join(appPath, 'node_modules', ownPackageName);
var appPackage = require(path.join(appPath, 'package.json'));
var useYarn = pathExists.sync(path.join(appPath, 'yarn.lock'));
var useYarn = fs.existsSync(path.join(appPath, 'yarn.lock'));
// Copy over some of the devDependencies
appPackage.dependencies = appPackage.dependencies || {};
......@@ -36,7 +35,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
JSON.stringify(appPackage, null, 2)
);
var readmeExists = pathExists.sync(path.join(appPath, 'README.md'));
var readmeExists = fs.existsSync(path.join(appPath, 'README.md'));
if (readmeExists) {
fs.renameSync(path.join(appPath, 'README.md'), path.join(appPath, 'README.old.md'));
}
......
......@@ -29,11 +29,11 @@ var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
var getProcessForPort = require('react-dev-utils/getProcessForPort');
var openBrowser = require('react-dev-utils/openBrowser');
var prompt = require('react-dev-utils/prompt');
var pathExists = require('path-exists');
var fs = require('fs');
var config = require('../config/webpack.config.dev');
var paths = require('../config/paths');
var useYarn = pathExists.sync(paths.yarnLockFile);
var useYarn = fs.existsSync(paths.yarnLockFile);
var cli = useYarn ? 'yarn' : 'npm';
var isInteractive = process.stdout.isTTY;
......
......@@ -9,13 +9,13 @@
// Note: this file does not exist after ejecting.
const pathExists = require('path-exists');
const fs = require('fs');
const paths = require('../config/paths');
module.exports = (resolve, rootDir, isEjecting) => {
// Use this instead of `paths.testsSetup` to avoid putting
// an absolute filename into configuration after ejecting.
const setupTestsFile = pathExists.sync(paths.testsSetup) ? '<rootDir>/src/setupTests.js' : undefined;
const setupTestsFile = fs.existsSync(paths.testsSetup) ? '<rootDir>/src/setupTests.js' : undefined;
// TODO: I don't know if it's safe or not to just use / as path separator
// in Jest configs. We need help from somebody with Windows to determine this.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment