Skip to content

Commit

Permalink
Remove .bin files defined at react-scripts/package.json after eject (f…
Browse files Browse the repository at this point in the history
…acebook#1567)

* remove bin files after eject defined at package.json

* add swallowing try/catch
  • Loading branch information
tuchk4 authored and gaearon committed Feb 24, 2017
1 parent 431b80f commit 80b85e4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,19 @@ prompt(
);
console.log();

try {
// remove react-scripts and react-scripts binaries from app node_modules
Object.keys(ownPackage.bin).forEach(function(binKey) {
fs.removeSync(path.join(appPath, 'node_modules', '.bin', binKey));
});
fs.removeSync(ownPath);
} catch(e) {}

if (fs.existsSync(paths.yarnLockFile)) {
console.log(cyan('Running yarn...'));
fs.removeSync(ownPath);
spawnSync('yarnpkg', [], {stdio: 'inherit'});
} else {
console.log(cyan('Running npm install...'));
fs.removeSync(ownPath);
spawnSync('npm', ['install'], {stdio: 'inherit'});
}
console.log(green('Ejected successfully!'));
Expand Down

0 comments on commit 80b85e4

Please sign in to comment.