From c5e7ca21d04a33f3aa64eb3c1c1138d48345ea39 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 21 Nov 2016 12:26:08 -0600 Subject: [PATCH] Replace rimraf with fs-extra functions (#1072) --- packages/react-scripts/package.json | 1 - packages/react-scripts/scripts/build.js | 3 +-- packages/react-scripts/scripts/eject.js | 7 +++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 1558529da5c..28c81d311ac 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -58,7 +58,6 @@ "promise": "7.1.1", "react-dev-utils": "^0.3.0", "recursive-readdir": "2.1.0", - "rimraf": "2.5.4", "strip-ansi": "3.0.1", "style-loader": "0.13.1", "url-loader": "0.5.7", diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index d03138b50fa..8e4141be8bc 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/scripts/build.js @@ -24,7 +24,6 @@ var path = require('path'); var pathExists = require('path-exists'); var filesize = require('filesize'); var gzipSize = require('gzip-size').sync; -var rimrafSync = require('rimraf').sync; var webpack = require('webpack'); var config = require('../config/webpack.config.prod'); var paths = require('../config/paths'); @@ -78,7 +77,7 @@ recursive(paths.appBuild, (err, fileNames) => { // Remove all content but keep the directory so that // if you're in it, you don't end up in Trash - rimrafSync(paths.appBuild + '/*'); + fs.emptyDirSync(paths.appBuild); // Start the webpack build build(previousSizeMap); diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index 7d4996665ec..a2bd4961026 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -8,12 +8,11 @@ */ var createJestConfig = require('../utils/createJestConfig'); -var fs = require('fs'); +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 rimrafSync = require('rimraf').sync; var spawnSync = require('cross-spawn').sync; var chalk = require('chalk'); var green = chalk.green; @@ -147,11 +146,11 @@ prompt( if (pathExists.sync(paths.yarnLockFile)) { console.log(cyan('Running yarn...')); - rimrafSync(ownPath); + fs.removeSync(ownPath); spawnSync('yarn', [], {stdio: 'inherit'}); } else { console.log(cyan('Running npm install...')); - rimrafSync(ownPath); + fs.removeSync(ownPath); spawnSync('npm', ['install'], {stdio: 'inherit'}); } console.log(green('Ejected successfully!'));