Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea/
.vscode/
node_modules/
build
.DS_Store
Expand Down
25 changes: 24 additions & 1 deletion packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function install(dependencies, verbose, callback) {
command = 'yarnpkg';
args = [ 'add', '--exact'].concat(dependencies);
} else {
checkNpmVersion();
command = 'npm';
args = ['install', '--save', '--save-exact'].concat(dependencies);
}
Expand All @@ -173,7 +174,10 @@ function run(root, appName, version, verbose, originalDirectory, template) {
var allDependencies = ['react', 'react-dom', packageToInstall];

console.log('Installing packages. This might take a couple minutes.');
console.log('Installing ' + chalk.cyan('react, react-dom, ' + packageName) + '...');
console.log(
'Installing ' + chalk.cyan('react') + ', ' + chalk.cyan('react-dom') +
', and ' + chalk.cyan(packageName) + '...'
);
console.log();

install(allDependencies, verbose, function(code, command, args) {
Expand Down Expand Up @@ -230,6 +234,25 @@ function getPackageName(installPackage) {
return installPackage;
}

function checkNpmVersion() {
var isNpm2 = false;
try {
var npmVersion = execSync('npm --version').toString();
isNpm2 = semver.lt(npmVersion, '3.0.0');
} catch (err) {
return;
}
if (!isNpm2) {
return;
}
console.log(chalk.yellow('It looks like you are using npm 2.'));
console.log(chalk.yellow(
'We suggest using npm 3 or Yarn for faster install times ' +
'and less disk space usage.'
));
console.log();
}

function checkNodeVersion(packageName) {
var packageJsonPath = path.resolve(
process.cwd(),
Expand Down