From d6a83aa8874a69a407610c439a0413f5d8fbf8a0 Mon Sep 17 00:00:00 2001
From: Valerii Sorokobatko <valeriy.sorokobatko@gmail.com>
Date: Fri, 24 Feb 2017 20:00:09 +0200
Subject: [PATCH] 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
---
 packages/react-scripts/scripts/eject.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js
index 473a40da4..6e609c4f9 100644
--- a/packages/react-scripts/scripts/eject.js
+++ b/packages/react-scripts/scripts/eject.js
@@ -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!'));
-- 
GitLab