mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-24 05:05:53 +08:00
Remove .bin files defined at react-scripts/package.json after eject (#1567)
* remove bin files after eject defined at package.json * add swallowing try/catch
This commit is contained in:
committed by
Dan Abramov
parent
1c0851deb5
commit
d6a83aa887
10
packages/react-scripts/scripts/eject.js
vendored
10
packages/react-scripts/scripts/eject.js
vendored
@@ -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!'));
|
||||
|
||||
Reference in New Issue
Block a user