Skip to content

Commit

Permalink
eject: Additionally remove react-scripts from dependencies
Browse files Browse the repository at this point in the history
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 Jan 27, 2017
1 parent dd788b6 commit c7c2e63
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 c7c2e63

Please sign in to comment.