Skip to content

Commit

Permalink
🛠 revert name to react-scripts, closes facebook#4
Browse files Browse the repository at this point in the history
  • Loading branch information
kitze committed Sep 26, 2016
1 parent edcef42 commit 070d381
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
17 changes: 7 additions & 10 deletions packages/react-scripts/scripts/eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ prompt(
files.forEach(function(file) {
console.log('Copying ' + file + ' to ' + appPath);
var content = fs
.readFileSync(path.join(ownPath, file), 'utf8')
// Remove dead code from .js files on eject
.replace(/\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/mg, '')
// Remove dead code from .applescript files on eject
.replace(/-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/mg, '')
.trim() + '\n';
.readFileSync(path.join(ownPath, file), 'utf8')
// Remove dead code from .js files on eject
.replace(/\/\/ @remove-on-eject-begin([\s\S]*?)\/\/ @remove-on-eject-end/mg, '')
// Remove dead code from .applescript files on eject
.replace(/-- @remove-on-eject-begin([\s\S]*?)-- @remove-on-eject-end/mg, '')
.trim() + '\n';
fs.writeFileSync(path.join(appPath, file), content);
});
console.log();
Expand All @@ -94,10 +94,7 @@ prompt(
delete appPackage.scripts['eject'];
Object.keys(appPackage.scripts).forEach(function (key) {
appPackage.scripts[key] = appPackage.scripts[key]
.replace(
new RegExp(ownPackageName + ' (\\w+)', 'g'),
'node scripts/$1.js'
);
.replace(/react-scripts (\w+)/g, 'node scripts/$1.js');
});

// Add Jest config
Expand Down
10 changes: 5 additions & 5 deletions packages/react-scripts/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {

// Setup the script rules
appPackage.scripts = {
'start': ownPackageName + ' start',
'build': ownPackageName + ' build',
'test': ownPackageName + ' test --env=jsdom',
'eject': ownPackageName + ' eject'
'start': 'react-scripts start',
'build': 'react-scripts build',
'test': 'react-scripts test --env=jsdom',
'eject': 'react-scripts eject'
};

fs.writeFileSync(
Expand Down Expand Up @@ -81,7 +81,7 @@ module.exports = function(appPath, appName, verbose, originalDirectory) {
// backward compatibility with old global-cli's.
var cdpath;
if (originalDirectory &&
path.join(originalDirectory, appName) === appPath) {
path.join(originalDirectory, appName) === appPath) {
cdpath = appName;
} else {
cdpath = appPath;
Expand Down

0 comments on commit 070d381

Please sign in to comment.