Skip to content

Commit ab2791d

Browse files
committed
fix(deps): update module dependencis and react scripts
create-react-app have a bug when you run `npm start` command on your console facebook/create-react-app#1590
1 parent 707ee10 commit ab2791d

File tree

6 files changed

+334
-463
lines changed

6 files changed

+334
-463
lines changed

.gitignore

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# See http://help.github.com/ignore-files/ for more about ignoring files.
22

33
# dependencies
4-
node_modules
4+
/node_modules
55

66
# testing
7-
coverage
7+
/coverage
88

99
# production
10-
build
10+
/build
1111

1212
# misc
1313
.DS_Store
1414
.env
15-
npm-debug.log
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
1618
v8.log

package.json

+14-14
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
"babel-preset-react-app": "^2.1.0",
2020
"case-sensitive-paths-webpack-plugin": "1.1.4",
2121
"chalk": "1.1.3",
22-
"commitizen": "^2.8.6",
22+
"commitizen": "^2.9.6",
2323
"connect-history-api-fallback": "1.3.0",
2424
"conventional-changelog-cli": "^1.2.0",
2525
"cross-spawn": "4.0.2",
2626
"css-loader": "0.26.1",
27-
"cz-conventional-changelog": "^1.2.0",
27+
"cz-conventional-changelog": "^2.0.0",
2828
"detect-port": "1.0.1",
2929
"dotenv": "2.0.0",
3030
"eslint": "3.8.1",
@@ -41,13 +41,13 @@
4141
"find-cache-dir": "0.1.1",
4242
"fs-extra": "0.30.0",
4343
"ghooks": "^2.0.0",
44-
"git-repo-info": "^1.3.1",
44+
"git-repo-info": "^1.4.1",
4545
"gzip-size": "3.0.0",
4646
"html-webpack-plugin": "2.24.0",
4747
"http-proxy-middleware": "0.17.3",
4848
"jest": "18.1.0",
4949
"json-loader": "0.5.4",
50-
"less": "^2.7.1",
50+
"less": "^2.7.2",
5151
"less-loader": "^2.2.3",
5252
"node-sass": "^4.1.1",
5353
"object-assign": "4.1.1",
@@ -56,15 +56,15 @@
5656
"promise": "7.1.1",
5757
"react-dev-utils": "^0.5.0",
5858
"recursive-readdir": "2.1.0",
59-
"redux-devtools": "^3.3.1",
59+
"redux-devtools": "^3.3.2",
6060
"redux-devtools-dock-monitor": "^1.1.1",
61-
"redux-devtools-log-monitor": "^1.1.1",
62-
"rimraf": "2.5.4",
63-
"sass-loader": "^4.0.2",
61+
"redux-devtools-log-monitor": "^1.2.0",
62+
"rimraf": "^2.6.0",
63+
"sass-loader": "^6.0.2",
6464
"strip-ansi": "3.0.1",
6565
"style-loader": "0.13.1",
6666
"url-loader": "0.5.7",
67-
"validate-commit-msg": "^2.8.2",
67+
"validate-commit-msg": "^2.11.1",
6868
"webpack": "1.14.0",
6969
"webpack-dev-server": "1.16.2",
7070
"webpack-manifest-plugin": "1.1.0",
@@ -74,13 +74,13 @@
7474
"axios": "^0.15.2",
7575
"react": "^15.4.2",
7676
"react-dom": "^15.4.2",
77-
"react-helmet": "^3.2.1",
77+
"react-helmet": "^4.0.0",
7878
"react-redux": "^5.0.1",
79-
"react-router": "^3.0.0",
80-
"react-router-redux": "^4.0.7",
79+
"react-router": "^3.0.2",
80+
"react-router-redux": "^4.0.8",
8181
"redux": "^3.6.0",
82-
"redux-logger": "^2.7.4",
83-
"redux-thunk": "^2.1.0"
82+
"redux-logger": "^2.8.1",
83+
"redux-thunk": "^2.2.0"
8484
},
8585
"scripts": {
8686
"start": "node scripts/start.js",

scripts/build.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require('dotenv').config({silent: true});
1010
var chalk = require('chalk');
1111
var fs = require('fs-extra');
1212
var path = require('path');
13-
var pathExists = require('path-exists');
13+
var url = require('url');
1414
var filesize = require('filesize');
1515
var gzipSize = require('gzip-size').sync;
1616
var webpack = require('webpack');
@@ -20,7 +20,7 @@ var checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
2020
var recursive = require('recursive-readdir');
2121
var stripAnsi = require('strip-ansi');
2222

23-
var useYarn = pathExists.sync(paths.yarnLockFile);
23+
var useYarn = fs.existsSync(paths.yarnLockFile);
2424

2525
// Warn and crash if required files are missing
2626
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
@@ -134,7 +134,7 @@ function build(previousSizeMap) {
134134
}
135135

136136
if (process.env.CI && stats.compilation.warnings.length) {
137-
printErrors('Failed to compile.', stats.compilation.warnings);
137+
printErrors('Failed to compile. When process.env.CI = true, warnings are treated as failures. Most CI servers set this automatically.', stats.compilation.warnings);
138138
process.exit(1);
139139
}
140140

@@ -148,15 +148,16 @@ function build(previousSizeMap) {
148148

149149
var openCommand = process.platform === 'win32' ? 'start' : 'open';
150150
var appPackage = require(paths.appPackageJson);
151-
var homepagePath = appPackage.homepage;
151+
var publicUrl = paths.publicUrl;
152152
var publicPath = config.output.publicPath;
153-
if (homepagePath && homepagePath.indexOf('.github.io/') !== -1) {
153+
var publicPathname = url.parse(publicPath).pathname;
154+
if (publicUrl && publicUrl.indexOf('.github.io/') !== -1) {
154155
// "homepage": "http://user.github.io/project"
155-
console.log('The project was built assuming it is hosted at ' + chalk.green(publicPath) + '.');
156+
console.log('The project was built assuming it is hosted at ' + chalk.green(publicPathname) + '.');
156157
console.log('You can control this with the ' + chalk.green('homepage') + ' field in your ' + chalk.cyan('package.json') + '.');
157158
console.log();
158159
console.log('The ' + chalk.cyan('build') + ' folder is ready to be deployed.');
159-
console.log('To publish it at ' + chalk.green(homepagePath) + ', run:');
160+
console.log('To publish it at ' + chalk.green(publicUrl) + ', run:');
160161
// If script deploy has been added to package.json, skip the instructions
161162
if (typeof appPackage.scripts.deploy === 'undefined') {
162163
console.log();
@@ -171,7 +172,8 @@ function build(previousSizeMap) {
171172
console.log(' ' + chalk.dim('// ...'));
172173
console.log(' ' + chalk.yellow('"scripts"') + ': {');
173174
console.log(' ' + chalk.dim('// ...'));
174-
console.log(' ' + chalk.yellow('"deploy"') + ': ' + chalk.yellow('"npm run build&&gh-pages -d build"'));
175+
console.log(' ' + chalk.yellow('"predeploy"') + ': ' + chalk.yellow('"npm run build",'));
176+
console.log(' ' + chalk.yellow('"deploy"') + ': ' + chalk.yellow('"gh-pages -d build"'));
175177
console.log(' }');
176178
console.log();
177179
console.log('Then run:');
@@ -187,14 +189,14 @@ function build(previousSizeMap) {
187189
console.log('The ' + chalk.cyan('build') + ' folder is ready to be deployed.');
188190
console.log();
189191
} else {
190-
// no homepage or "homepage": "http://mywebsite.com"
191-
console.log('The project was built assuming it is hosted at the server root.');
192-
if (homepagePath) {
192+
if (publicUrl) {
193193
// "homepage": "http://mywebsite.com"
194+
console.log('The project was built assuming it is hosted at ' + chalk.green(publicUrl) + '.');
194195
console.log('You can control this with the ' + chalk.green('homepage') + ' field in your ' + chalk.cyan('package.json') + '.');
195196
console.log();
196197
} else {
197198
// no homepage
199+
console.log('The project was built assuming it is hosted at the server root.');
198200
console.log('To override this, specify the ' + chalk.green('homepage') + ' in your ' + chalk.cyan('package.json') + '.');
199201
console.log('For example, add this to build it for GitHub Pages:')
200202
console.log();

scripts/start.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
1818
var getProcessForPort = require('react-dev-utils/getProcessForPort');
1919
var openBrowser = require('react-dev-utils/openBrowser');
2020
var prompt = require('react-dev-utils/prompt');
21-
var pathExists = require('path-exists');
21+
var fs = require('fs');
2222
var config = require('../config/webpack.config.dev');
2323
var paths = require('../config/paths');
2424

25-
var useYarn = pathExists.sync(paths.yarnLockFile);
25+
var useYarn = fs.existsSync(paths.yarnLockFile);
2626
var cli = useYarn ? 'yarn' : 'npm';
2727
var isInteractive = process.stdout.isTTY;
2828

@@ -230,7 +230,7 @@ function runDevServer(host, port, protocol) {
230230
// project directory is dangerous because we may expose sensitive files.
231231
// Instead, we establish a convention that only files in `public` directory
232232
// get served. Our build script will copy `public` into the `build` folder.
233-
// In `index.html`, you can get URL of `public` folder with %PUBLIC_PATH%:
233+
// In `index.html`, you can get URL of `public` folder with %PUBLIC_URL%:
234234
// <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
235235
// In JavaScript code, you can access it with `process.env.PUBLIC_URL`.
236236
// Note that we only recommend to use `public` folder as an escape hatch
@@ -275,9 +275,7 @@ function runDevServer(host, port, protocol) {
275275
console.log(chalk.cyan('Starting the development server...'));
276276
console.log();
277277

278-
if (isInteractive) {
279-
openBrowser(protocol + '://' + host + ':' + port + '/');
280-
}
278+
openBrowser(protocol + '://' + host + ':' + port + '/');
281279
});
282280
}
283281

scripts/test.js

-12
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,5 @@ if (!process.env.CI && argv.indexOf('--coverage') < 0) {
1515
argv.push('--watch');
1616
}
1717

18-
// A temporary hack to clear terminal correctly.
19-
// You can remove this after updating to Jest 18 when it's out.
20-
// https://github.com/facebook/jest/pull/2230
21-
var realWrite = process.stdout.write;
22-
var CLEAR = process.platform === 'win32' ? '\x1Bc' : '\x1B[2J\x1B[3J\x1B[H';
23-
process.stdout.write = function(chunk, encoding, callback) {
24-
if (chunk === '\x1B[2J\x1B[H') {
25-
chunk = CLEAR;
26-
}
27-
return realWrite.call(this, chunk, encoding, callback);
28-
};
29-
3018

3119
jest.run(argv);

0 commit comments

Comments
 (0)