Skip to content

Commit

Permalink
Moved Babel and ESLint config to package.json after ejecting (faceboo…
Browse files Browse the repository at this point in the history
  • Loading branch information
montogeek authored and feiqitian committed Oct 25, 2016
1 parent 0349d0c commit fadda2f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit fadda2f

Please sign in to comment.