From fadda2fd2425eab09125d9d43a225ef3249ae853 Mon Sep 17 00:00:00 2001 From: Fernando Montoya Date: Tue, 27 Sep 2016 05:17:46 -0500 Subject: [PATCH] Moved Babel and ESLint config to package.json after ejecting (#773) --- 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 9eb6d4fd44c..d48fe6680ec 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -29,8 +29,6 @@ prompt( var ownPath = path.join(__dirname, '..'); var appPath = path.join(ownPath, '..', '..'); var files = [ - '.babelrc', - '.eslintrc', path.join('config', 'env.js'), path.join('config', 'paths.js'), path.join('config', 'polyfills.js'), @@ -76,6 +74,8 @@ prompt( var ownPackage = require(path.join(ownPath, 'package.json')); var appPackage = require(path.join(appPath, 'package.json')); + var babelConfig = JSON.parse(fs.readFileSync(path.join(ownPath, '.babelrc'), 'utf8')); + var eslintConfig = JSON.parse(fs.readFileSync(path.join(ownPath, '.eslintrc'), 'utf8')); var ownPackageName = ownPackage.name; console.log('Removing dependency: ' + ownPackageName); @@ -104,6 +104,12 @@ prompt( true ); + // Add Babel config + appPackage.babel = babelConfig; + + // Add ESlint config + appPackage.eslintConfig = eslintConfig; + console.log('Writing package.json'); fs.writeFileSync( path.join(appPath, 'package.json'),