Skip to content
Prev Previous commit
Next Next commit
Merge branch 'next' into git-init
  • Loading branch information
gaearon authored Jan 15, 2018
commit b9cfee96956cc6615d78420a0cf0a7146bd4f734
30 changes: 16 additions & 14 deletions packages/react-scripts/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@
*/
'use strict';

var fs = require('fs-extra');
var path = require('path');
var spawn = require('cross-spawn');
var chalk = require('chalk');
var execSync = require('child_process').execSync;
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

const fs = require('fs-extra');
const path = require('path');
const chalk = require('chalk');
const execSync = require('child_process').execSync;
const spawn = require('react-dev-utils/crossSpawn');
const { defaultBrowsers } = require('react-dev-utils/browsersHelper');
const os = require('os');

function insideGitRepository() {
try {
Expand Down Expand Up @@ -41,21 +50,14 @@ function gitInit() {

execSync('git init', {stdio: 'ignore'});
execSync('git add .', {stdio: 'ignore'});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be git add -A?
(infact git add . covers create and update but this one feels more inclusive)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sendilkumarn Sure, no problem but there really is no difference. Using git add -A is the same as git add . with Git 2. With Git 1 it isn't the same but the difference is in deleted files. As this is a newly created repo there is not going to be any deleted files.

execSync('git commit -m "Initial commit from create-react-app"', {stdio: 'ignore'});
execSync('git commit -m "Initial commit from Create React App"', {stdio: 'ignore'});

return true;
} catch (e) {
return false;
}
}

const fs = require('fs-extra');
const path = require('path');
const chalk = require('chalk');
const spawn = require('react-dev-utils/crossSpawn');
const { defaultBrowsers } = require('react-dev-utils/browsersHelper');
const os = require('os');

module.exports = function(
appPath,
appName,
Expand Down Expand Up @@ -139,7 +141,7 @@ module.exports = function(
args = ['install', '--save', verbose && '--verbose'].filter(e => e);
}
args.push('react', 'react-dom');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can remove the space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// Install additional template dependencies, if present
const templateDependenciesPath = path.join(
appPath,
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.