Skip to content

Commit

Permalink
gh-1269: Added "fs-extra" and removed "path-exists"
Browse files Browse the repository at this point in the history
  • Loading branch information
dinukadesilva committed Dec 17, 2016
1 parent cfaf633 commit 396d7b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
19 changes: 3 additions & 16 deletions packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ if (currentNodeVersion.split('.')[0] < 4) {
process.exit(1);
}

var fs = require('fs');
var fs = require('fs-extra');
var path = require('path');
var execSync = require('child_process').execSync;
var spawn = require('cross-spawn');
var semver = require('semver');
var pathExists = require('path-exists');

var projectName;

Expand Down Expand Up @@ -103,10 +102,8 @@ function createApp(name, verbose, version) {
var appName = path.basename(root);

checkAppName(appName);

if (!pathExists.sync(name)) {
createFolderPath(name);
} else if (!isSafeToCreateProjectIn(root)) {
fs.ensureDirSync(name);
if (!isSafeToCreateProjectIn(root)) {
console.log('The directory ' + chalk.green(name) + ' contains files that could conflict.');
console.log('Try using a new directory name.');
process.exit(1);
Expand Down Expand Up @@ -136,16 +133,6 @@ function createApp(name, verbose, version) {
run(root, appName, version, verbose, originalDirectory);
}

function createFolderPath(path) {
var projectPath = (path + "/");
projectPath.replace(/(\w+)\//ig, function(i, dirName, index){
var dirPath = path.substr(0, index + 1 + dirName.length);
if (!pathExists.sync(dirPath)) {
fs.mkdirSync(dirPath);
}
});
}

function shouldUseYarn() {
try {
execSync('yarn --version', {stdio: 'ignore'});
Expand Down
2 changes: 1 addition & 1 deletion packages/create-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"chalk": "^1.1.1",
"commander": "^2.9.0",
"cross-spawn": "^4.0.0",
"path-exists": "^2.1.0",
"fs-extra": "^1.0.0",
"semver": "^5.0.3"
}
}

0 comments on commit 396d7b5

Please sign in to comment.