From ab0ce4f5ce5a2adf5cdcc84b5cad3dbde00ddce1 Mon Sep 17 00:00:00 2001 From: Rick Wong Date: Mon, 16 Mar 2015 23:48:50 +0100 Subject: [PATCH] Added global npm dependencies to `package.json` too. Don't show checksum error in production. --- npm-shrinkwrap.json | 166 ++++++++++++++++++++++++++++++++-------- package.json | 10 ++- src/client.js | 11 ++- webpack.client-watch.js | 1 - webpack.client.js | 1 - webpack.server.js | 1 - 6 files changed, 147 insertions(+), 43 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 34f2b4e..e8ed266 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "react-isomorphic-starterkit", - "version": "1.3.0", + "version": "1.3.1", "dependencies": { "async": { "version": "0.9.0", @@ -44,7 +44,7 @@ "dependencies": { "ansi-regex": { "version": "1.1.1", - "from": "ansi-regex@>=1.0.0 <2.0.0", + "from": "ansi-regex@>=1.1.0 <2.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" }, "get-stdin": { @@ -61,15 +61,15 @@ "dependencies": { "ansi-regex": { "version": "1.1.1", - "from": "ansi-regex@>=1.0.0 <2.0.0", + "from": "ansi-regex@>=1.1.0 <2.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" } } }, "supports-color": { - "version": "1.3.0", + "version": "1.3.1", "from": "supports-color@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" } } }, @@ -97,7 +97,7 @@ }, "debug": { "version": "2.1.3", - "from": "debug@>=2.1.1 <3.0.0", + "from": "debug@>=2.1.3 <2.2.0", "resolved": "https://registry.npmjs.org/debug/-/debug-2.1.3.tgz", "dependencies": { "ms": { @@ -513,9 +513,9 @@ } }, "babel-loader": { - "version": "4.1.0", - "from": "babel-loader@4.1.0", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-4.1.0.tgz", + "version": "4.2.0", + "from": "babel-loader@4.2.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-4.2.0.tgz", "dependencies": { "loader-utils": { "version": "0.2.6", @@ -548,6 +548,79 @@ } } }, + "concurrently": { + "version": "0.0.5", + "from": "concurrently@0.0.5", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-0.0.5.tgz", + "dependencies": { + "bluebird": { + "version": "2.9.6", + "from": "bluebird@2.9.6", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.6.tgz" + }, + "chalk": { + "version": "0.5.1", + "from": "chalk@0.5.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz", + "dependencies": { + "ansi-styles": { + "version": "1.1.0", + "from": "ansi-styles@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz" + }, + "escape-string-regexp": { + "version": "1.0.3", + "from": "escape-string-regexp@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz" + }, + "has-ansi": { + "version": "0.1.0", + "from": "has-ansi@>=0.1.0 <0.2.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz", + "dependencies": { + "ansi-regex": { + "version": "0.2.1", + "from": "ansi-regex@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" + } + } + }, + "strip-ansi": { + "version": "0.3.0", + "from": "strip-ansi@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz", + "dependencies": { + "ansi-regex": { + "version": "0.2.1", + "from": "ansi-regex@>=0.2.1 <0.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" + } + } + }, + "supports-color": { + "version": "0.2.0", + "from": "supports-color@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz" + } + } + }, + "commander": { + "version": "2.6.0", + "from": "commander@2.6.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz" + }, + "lodash": { + "version": "3.1.0", + "from": "lodash@3.1.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.1.0.tgz" + }, + "rx": { + "version": "2.3.24", + "from": "rx@2.3.24", + "resolved": "https://registry.npmjs.org/rx/-/rx-2.3.24.tgz" + } + } + }, "hapi": { "version": "8.4.0", "from": "hapi@8.4.0", @@ -600,12 +673,12 @@ "dependencies": { "isemail": { "version": "1.1.1", - "from": "isemail@1.1.1", + "from": "isemail@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz" }, "moment": { "version": "2.9.0", - "from": "moment@2.9.0", + "from": "moment@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.9.0.tgz" } } @@ -624,12 +697,12 @@ "dependencies": { "isemail": { "version": "1.1.1", - "from": "isemail@1.1.1", + "from": "isemail@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz" }, "moment": { "version": "2.9.0", - "from": "moment@2.9.0", + "from": "moment@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.9.0.tgz" } } @@ -648,7 +721,7 @@ "dependencies": { "lru-cache": { "version": "2.5.0", - "from": "lru-cache@>=2.0.0 <3.0.0", + "from": "lru-cache@2.5.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz" } } @@ -670,12 +743,12 @@ "dependencies": { "isemail": { "version": "1.1.1", - "from": "isemail@1.1.1", + "from": "isemail@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz" }, "moment": { "version": "2.9.0", - "from": "moment@2.9.0", + "from": "moment@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.9.0.tgz" } } @@ -724,12 +797,12 @@ "dependencies": { "isemail": { "version": "1.1.1", - "from": "isemail@1.1.1", + "from": "isemail@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz" }, "moment": { "version": "2.9.0", - "from": "moment@2.9.0", + "from": "moment@>=2.0.0 <3.0.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.9.0.tgz" } } @@ -819,9 +892,9 @@ "resolved": "https://registry.npmjs.org/react/-/react-0.12.2.tgz", "dependencies": { "envify": { - "version": "3.3.1", + "version": "3.4.0", "from": "envify@>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/envify/-/envify-3.3.1.tgz", + "resolved": "https://registry.npmjs.org/envify/-/envify-3.4.0.tgz", "dependencies": { "through": { "version": "2.3.6", @@ -891,9 +964,9 @@ } }, "react-inline-css": { - "version": "1.0.2", - "from": "react-inline-css@1.0.2", - "resolved": "https://registry.npmjs.org/react-inline-css/-/react-inline-css-1.0.2.tgz" + "version": "1.1.1", + "from": "react-inline-css@1.1.1", + "resolved": "https://registry.npmjs.org/react-inline-css/-/react-inline-css-1.1.1.tgz" }, "react-router": { "version": "0.12.4", @@ -1012,6 +1085,11 @@ } } }, + "supervisor": { + "version": "0.6.0", + "from": "supervisor@0.6.0", + "resolved": "https://registry.npmjs.org/supervisor/-/supervisor-0.6.0.tgz" + }, "webpack": { "version": "1.7.3", "from": "webpack@1.7.3", @@ -1114,7 +1192,7 @@ "dependencies": { "source-map": { "version": "0.4.2", - "from": "source-map@>=0.4.1 <0.5.0", + "from": "source-map@>=0.4.0 <0.5.0", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.2.tgz", "dependencies": { "amdefine": { @@ -1231,7 +1309,7 @@ }, "inherits": { "version": "2.0.1", - "from": "inherits@2.0.1", + "from": "inherits@>=2.0.1 <2.1.0", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" } } @@ -1499,9 +1577,9 @@ "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.8.tgz" }, "supports-color": { - "version": "1.3.0", + "version": "1.3.1", "from": "supports-color@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.0.tgz" + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" } } }, @@ -1551,7 +1629,7 @@ "dependencies": { "accepts": { "version": "1.2.5", - "from": "accepts@>=1.2.4 <1.3.0", + "from": "accepts@>=1.2.5 <1.3.0", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.2.5.tgz", "dependencies": { "mime-types": { @@ -1590,7 +1668,7 @@ }, "debug": { "version": "2.1.3", - "from": "debug@>=2.1.1 <2.2.0", + "from": "debug@>=2.1.3 <2.2.0", "resolved": "https://registry.npmjs.org/debug/-/debug-2.1.3.tgz", "dependencies": { "ms": { @@ -1714,9 +1792,33 @@ } }, "serve-static": { - "version": "1.9.1", + "version": "1.9.2", "from": "serve-static@>=1.9.1 <1.10.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.9.1.tgz" + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.9.2.tgz", + "dependencies": { + "send": { + "version": "0.12.2", + "from": "send@0.12.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.12.2.tgz", + "dependencies": { + "destroy": { + "version": "1.0.3", + "from": "destroy@1.0.3", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.3.tgz" + }, + "mime": { + "version": "1.3.4", + "from": "mime@1.3.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz" + }, + "ms": { + "version": "0.7.0", + "from": "ms@0.7.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.0.tgz" + } + } + } + } }, "type-is": { "version": "1.6.1", @@ -1900,7 +2002,7 @@ }, "debug": { "version": "2.1.3", - "from": "debug@>=2.1.1 <3.0.0", + "from": "debug@>=2.1.3 <2.2.0", "resolved": "https://registry.npmjs.org/debug/-/debug-2.1.3.tgz", "dependencies": { "ms": { diff --git a/package.json b/package.json index f94fc18..b9c0144 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-isomorphic-starterkit", "description": "Isomorphic starterkit with server-side React rendering.", - "version": "1.3.0", + "version": "1.3.1", "license": "BSD-3", "repository": { "type": "git", @@ -20,7 +20,7 @@ "main": "dist/index", "scripts": { "start": "supervisor dist/server", - "localhost": "sleep 1; which open && open http://localhost:8000", + "localhost": "sleep 2; which open && open http://localhost:8000", "browser": "sleep 6; concurrent --kill-others 'npm run start' 'npm run localhost'", "build-server": "webpack --verbose --colors --display-error-details --config webpack.server.js", "build-client": "webpack --verbose --colors --display-error-details --config webpack.client.js", @@ -34,16 +34,18 @@ "hapi": "8.4.0", "react": "0.12.2", "react-a11y": "0.0.6", - "react-inline-css": "1.0.2", + "react-inline-css": "1.1.1", "react-router": "0.12.4", "superagent": "1.1.0" }, "devDependencies": { "babel-core": "4.7.12", - "babel-loader": "4.1.0", + "babel-loader": "4.2.0", "babel-runtime": "4.7.12", + "concurrently": "0.0.5", "json-loader": "0.5.1", "react-hot-loader": "1.2.3", + "supervisor": "0.6.0", "webpack": "1.7.3", "webpack-dev-server": "1.7.0" }, diff --git a/src/client.js b/src/client.js index 9a0ffdb..4e2c8c6 100644 --- a/src/client.js +++ b/src/client.js @@ -24,12 +24,15 @@ Router.run(routes, Router.HistoryLocation, (Handler) => { }); }); + /** * Detect whether the server-side render has been discarded due to an invalid checksum. */ -const reactRoot = window.document.getElementById("react-root"); +if (process.env.NODE_ENV !== "production") { + const reactRoot = window.document.getElementById("react-root"); -if (!reactRoot || !reactRoot.firstChild || - !reactRoot.firstChild.attributes["data-react-checksum"]) { - console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code."); + if (!reactRoot || !reactRoot.firstChild || + !reactRoot.firstChild.attributes["data-react-checksum"]) { + console.error("Server-side React render was discarded. Make sure that your initial render does not contain any client-side code."); + } } diff --git a/webpack.client-watch.js b/webpack.client-watch.js index 7c9a16c..558db9f 100644 --- a/webpack.client-watch.js +++ b/webpack.client-watch.js @@ -23,7 +23,6 @@ config.plugins = [ config.module = { loaders: [ {include: /\.json$/, loaders: ["json-loader"]}, - {include: /\.jsx$/, loaders: ["react-hot", "babel-loader?experimental&optional=runtime"]}, {include: /\.js$/, loaders: ["react-hot", "babel-loader?experimental&optional=runtime"], exclude: /node_modules/} ] }; diff --git a/webpack.client.js b/webpack.client.js index 5dcb186..f677c91 100644 --- a/webpack.client.js +++ b/webpack.client.js @@ -23,7 +23,6 @@ module.exports = { module: { loaders: [ {include: /\.json$/, loaders: ["json-loader"]}, - {include: /\.jsx$/, loaders: ["babel-loader?experimental&optional=runtime"]}, {include: /\.js$/, loaders: ["babel-loader?experimental&optional=runtime"], exclude: /node_modules/} ] }, diff --git a/webpack.server.js b/webpack.server.js index f1d1d25..1f7877c 100644 --- a/webpack.server.js +++ b/webpack.server.js @@ -20,7 +20,6 @@ module.exports = { module: { loaders: [ {include: /\.json$/, loaders: ["json-loader"]}, - {include: /\.jsx$/, loaders: ["babel-loader?experimental&optional=runtime"]}, {include: /\.js$/, loaders: ["babel-loader?experimental&optional=runtime"], exclude: /node_modules/} ] },