Skip to content

Commit c5cbee8

Browse files
author
Mo Binni
committed
Implemented a version check of npm to give a soft tip during the install procedure
and fixed gitignore
1 parent 67d0d49 commit c5cbee8

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.vscode/
12
node_modules/
23
build
34
.DS_Store

packages/create-react-app/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ function createApp(name, verbose, version, template) {
121121
);
122122
console.log();
123123

124+
// Check npm version
125+
var npmVersionProc = spawn.sync('npm', ['--version']),
126+
npmVersion = npmVersionProc.stdout;
127+
if (npmVersion) {
128+
var recommendVersion = semver.lt(npmVersion.toString(), '3.0.0');
129+
if (recommendVersion) {
130+
console.log(
131+
chalk.green(
132+
'Tip: It looks like you are using npm 2.\n' +
133+
'We suggest using npm 3 or Yarn for faster install times and less disk space usage.'
134+
)
135+
);
136+
}
137+
}
138+
124139
var packageJson = {
125140
name: appName,
126141
version: '0.1.0',

packages/react-scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@
7272
"optionalDependencies": {
7373
"fsevents": "1.0.17"
7474
}
75-
}
75+
}

0 commit comments

Comments
 (0)