Skip to content

Commit

Permalink
eject: Additionally remove react-scripts from dependencies (faceboo…
Browse files Browse the repository at this point in the history
…k#1458)

ATM if react-scripts is (erroneously) declared in `dependencies` instead of `devDependencies` or isn't declared at all, the `eject` script will fail half-way. This change makes it more robust, react-scripts will be removed from either, if present.
  • Loading branch information
creynders authored and randycoulman committed May 8, 2017
1 parent 5bbdd83 commit 80c6615
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,14 @@ prompt(

console.log(cyan('Updating the dependencies'));
var ownPackageName = ownPackage.name;
console.log(' Removing ' + cyan(ownPackageName) + ' from devDependencies');
delete appPackage.devDependencies[ownPackageName];
if (appPackage.devDependencies[ownPackageName]) {
console.log(' Removing ' + cyan(ownPackageName) + ' from devDependencies');
delete appPackage.devDependencies[ownPackageName];
}
if (appPackage.dependencies[ownPackageName]) {
console.log(' Removing ' + cyan(ownPackageName) + ' from dependencies');
delete appPackage.dependencies[ownPackageName];
}

Object.keys(ownPackage.dependencies).forEach(function (key) {
// For some reason optionalDependencies end up in dependencies after install
Expand Down

0 comments on commit 80c6615

Please sign in to comment.