Skip to content

Commit 80b85e4

Browse files
tuchk4gaearon
authored andcommitted
Remove .bin files defined at react-scripts/package.json after eject (facebook#1567)
* remove bin files after eject defined at package.json * add swallowing try/catch
1 parent 431b80f commit 80b85e4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/eject.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,19 @@ prompt(
148148
);
149149
console.log();
150150

151+
try {
152+
// remove react-scripts and react-scripts binaries from app node_modules
153+
Object.keys(ownPackage.bin).forEach(function(binKey) {
154+
fs.removeSync(path.join(appPath, 'node_modules', '.bin', binKey));
155+
});
156+
fs.removeSync(ownPath);
157+
} catch(e) {}
158+
151159
if (fs.existsSync(paths.yarnLockFile)) {
152160
console.log(cyan('Running yarn...'));
153-
fs.removeSync(ownPath);
154161
spawnSync('yarnpkg', [], {stdio: 'inherit'});
155162
} else {
156163
console.log(cyan('Running npm install...'));
157-
fs.removeSync(ownPath);
158164
spawnSync('npm', ['install'], {stdio: 'inherit'});
159165
}
160166
console.log(green('Ejected successfully!'));

0 commit comments

Comments
 (0)