From fe108beda7971b962237370829828c763edcd9d2 Mon Sep 17 00:00:00 2001 From: Valerii Sorokobatko Date: Wed, 15 Feb 2017 19:09:54 +0200 Subject: [PATCH 1/2] remove bin files after eject defined at package.json --- packages/react-scripts/scripts/eject.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index a8ee0fc3102..6dee3b13607 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -149,13 +149,17 @@ prompt( ); console.log(); + // 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); + 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!')); From 96b6be1c911af0a349e0149a482c987a3c0d1167 Mon Sep 17 00:00:00 2001 From: Valerii Sorokobatko Date: Thu, 16 Feb 2017 13:09:23 +0200 Subject: [PATCH 2/2] add swallowing try/catch --- packages/react-scripts/scripts/eject.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index 6dee3b13607..ae616bb10dd 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -149,11 +149,13 @@ prompt( ); console.log(); - // 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); + 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...'));