Update eject script

This commit is contained in:
Will Monk
2016-12-12 15:02:51 +00:00
parent a1ef7a0c3c
commit 5227310d46
2 changed files with 3 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-scripts-ts",
"version": "0.8.5",
"version": "0.8.6",
"description": "Configuration and scripts for Create React App.",
"repository": "wmonk/create-react-app",
"license": "BSD-3-Clause",

View File

@@ -89,8 +89,6 @@ 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'));
console.log(cyan('Updating the dependencies'));
var ownPackageName = ownPackage.name;
@@ -110,10 +108,10 @@ prompt(
delete appPackage.scripts['eject'];
Object.keys(appPackage.scripts).forEach(function (key) {
appPackage.scripts[key] = appPackage.scripts[key]
.replace(/react-scripts (\w+)/g, 'node scripts/$1.js');
.replace(/react-scripts-ts (\w+)/g, 'node scripts/$1.js');
console.log(
' Replacing ' +
cyan('"react-scripts ' + key + '"') +
cyan('"react-scripts-ts ' + key + '"') +
' with ' +
cyan('"node scripts/' + key + '.js"')
);
@@ -129,15 +127,6 @@ prompt(
true
);
// Add Babel config
console.log(' Adding ' + cyan('Babel') + ' preset');
appPackage.babel = babelConfig;
// Add ESlint config
console.log(' Adding ' + cyan('ESLint') +' configuration');
appPackage.eslintConfig = eslintConfig;
fs.writeFileSync(
path.join(appPath, 'package.json'),
JSON.stringify(appPackage, null, 2)