Skip to content

Commit 9a98851

Browse files
gaearonvjeux
authored andcommitted
Use rimraf as it handles edge cases
1 parent f9fe9ff commit 9a98851

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"html-webpack-plugin": "^2.22.0",
4343
"json-loader": "^0.5.4",
4444
"postcss-loader": "^0.9.1",
45+
"rimraf": "^2.5.3",
4546
"style-loader": "^0.13.1",
4647
"url-loader": "^0.5.7",
4748
"webpack": "^1.13.1",

scripts/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
process.env.NODE_ENV = 'production';
1111

1212
var path = require('path');
13-
var spawnSync = require('child_process').spawnSync;
13+
var rimrafSync = require('rimraf').sync;
1414
var webpack = require('webpack');
1515
var config = require('../webpack.config.prod');
1616

1717
var isInNodeModules = 'node_modules' ===
1818
path.basename(path.resolve(path.join(__dirname, '..', '..')));
1919
var relative = isInNodeModules ? '../..' : '.';
20-
spawnSync('rm', ['-rf', relative + '/build']);
20+
rimrafSync(relative + '/build');
2121

2222
webpack(config).run(function(err, stats) {
2323
if (err) {

scripts/graduate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
var fs = require('fs');
1111
var path = require('path');
12+
var rimrafSync = require('rimraf').sync;
1213
var spawnSync = require('child_process').spawnSync;
1314

1415
console.log('Graduating...');
@@ -74,7 +75,7 @@ fs.writeFileSync(
7475
console.log();
7576

7677
console.log('Running npm install...');
77-
spawnSync('rm', ['-rf', selfPath]);
78+
rimrafSync(selfPath);
7879
spawnSync('npm', ['install'], {stdio: 'inherit'});
7980
console.log();
8081

0 commit comments

Comments
 (0)