Skip to content

Commit ee7c0d1

Browse files
committed
Add better-npm-run and update run scripts, resolves #26.
1 parent 3ad0aec commit ee7c0d1

File tree

3 files changed

+92
-90
lines changed

3 files changed

+92
-90
lines changed

Diff for: package.json

+57-13
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,70 @@
1212
"url": "https://github.com/combine/universal-react-redux.git"
1313
},
1414
"engines": {
15-
"node": "6.2.1",
15+
"node": "7.x.x",
1616
"npm": "3.x.x"
1717
},
1818
"scripts": {
19-
"start": "yarn run dev:build && yarn run dev:start",
19+
"start": "better-npm-run dev:build && better-npm-run dev:start",
20+
"dev:start": "better-npm-run dev:start",
21+
"dev:start:server": "better-npm-run dev:start:server",
22+
"dev:start:client": "better-npm-run dev:start:client",
23+
"dev:build": "better-npm-run dev:build",
24+
"prod:build": "better-npm-run prod:build",
25+
"prod:start": "better-npm-run prod:start ",
26+
"test": "better-npm-run test",
27+
"test:all": "better-npm-run test:all",
28+
"test:watch": "better-npm-run test:watch",
29+
"test:all:watch": "better-npm-run test:all:watch",
30+
"lint": "better-npm-run lint",
31+
"postinstall": "node ./postinstall.js"
32+
},
33+
"betterScripts": {
2034
"dev:start": "yarn run dev:start:client & yarn run dev:start:server",
21-
"dev:start:server": "NODE_ENV=development yarn run nodemon server",
22-
"dev:start:client": "NODE_ENV=development yarn run babel-node webpack/development.hot",
23-
"dev:build": "NODE_ENV=development $(yarn bin)/babel-node $(yarn bin)/webpack --progress --colors --display-error-details --config webpack/development.js",
24-
"prod:build": "NODE_ENV=production $(yarn bin)/babel-node $(yarn bin)/webpack -p --optimize-dedupe --config webpack/production.js",
25-
"prod:start": "NODE_ENV=production pm2 start server --name='callai'",
26-
"test": "yarn run mocha --recursive --compilers js:babel-register",
27-
"test:all": "yarn run mocha --recursive --compilers js:babel-register $(find . -path ./node_modules -prune -o -name '*.test.js' -print)",
28-
"test:watch": "npm test -- --watch",
29-
"test:all:watch": "yarn run mocha --recursive --compilers js:babel-register $(find . -path ./node_modules -prune -o -name '*.test.js' -print) --watch",
30-
"lint": "yarn run eslint --ext .js,.jsx .",
31-
"postinstall": "if [ \"$NODE_ENV\" = \"production\" ]; then yarn run prod:build; fi"
35+
"dev:start:server": {
36+
"command": "yarn run nodemon server",
37+
"env": { "NODE_ENV": "development" }
38+
},
39+
"dev:start:client": {
40+
"command": "yarn run babel-node webpack/development.hot",
41+
"env": { "NODE_ENV": "development" }
42+
},
43+
"dev:build": {
44+
"command": "$(yarn bin)/babel-node $(yarn bin)/webpack --progress --colors --display-error-details --config webpack/development.js",
45+
"env": { "NODE_ENV": "development" }
46+
},
47+
"prod:build": {
48+
"command": "$(yarn bin)/babel-node $(yarn bin)/webpack -p --optimize-dedupe --config webpack/production.js",
49+
"env": { "NODE_ENV": "production" }
50+
},
51+
"prod:start": {
52+
"command": "pm2 start server --name='universal-react-redux'",
53+
"env": { "NODE_ENV": "production" }
54+
},
55+
"test": {
56+
"command": "yarn run mocha --recursive --compilers js:babel-register",
57+
"env": { "NODE_ENV": "test" }
58+
},
59+
"test:all": {
60+
"command": "yarn run mocha --recursive --compilers js:babel-register $(find . -path ./node_modules -prune -o -name '*.test.js' -print)",
61+
"env": { "NODE_ENV": "test" }
62+
},
63+
"test:watch": {
64+
"command": "yarn run test -- --watch",
65+
"env": { "NODE_ENV": "test" }
66+
},
67+
"test:all:watch": {
68+
"command": "yarn run test:all -- --watch",
69+
"env": { "NODE_ENV": "test" }
70+
},
71+
"lint": {
72+
"command": "yarn run eslint --ext .js,.jsx .",
73+
"env": { "NODE_ENV": "test" }
74+
}
3275
},
3376
"devDependencies": {
3477
"babel-eslint": "7.1.1",
78+
"better-npm-run": "^0.0.13",
3579
"eslint": "3.11.1",
3680
"eslint-loader": "1.6.1",
3781
"eslint-plugin-react": "6.7.1",

Diff for: postinstall.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const exec = require('child_process').exec;
2+
3+
// For cross-platform postinstalls, use a node script to execute any
4+
// post-install tasks rather than using a bash script since that wouldn't work
5+
// on Windows.
6+
if (process.env.NODE_ENV === 'production') {
7+
exec('yarn run prod:build', (error, stdout, stderr) => {
8+
if (error) {
9+
console.error(`exec error: ${error}`);
10+
return;
11+
}
12+
console.log(`stdout: ${stdout}`);
13+
console.log(`stderr: ${stderr}`);
14+
});
15+
}

Diff for: yarn.lock

+20-77
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ atob@~1.1.0:
217217
version "1.1.3"
218218
resolved "https://registry.yarnpkg.com/atob/-/atob-1.1.3.tgz#95f13629b12c3a51a5d215abdce2aa9f32f80773"
219219

220-
autoprefixer@6.5.3:
220+
autoprefixer@6.5.3, autoprefixer@^6.3.1:
221221
version "6.5.3"
222222
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.5.3.tgz#2d853af66d04449fcf50db3066279ab54c3e4b01"
223223
dependencies:
@@ -228,17 +228,6 @@ autoprefixer@6.5.3:
228228
postcss "^5.2.5"
229229
postcss-value-parser "^3.2.3"
230230

231-
autoprefixer@^6.3.1:
232-
version "6.5.1"
233-
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-6.5.1.tgz#ae759a5221e709f3da17c2d656230e67c43cbb75"
234-
dependencies:
235-
browserslist "~1.4.0"
236-
caniuse-db "^1.0.30000554"
237-
normalize-range "^0.1.2"
238-
num2fraction "^1.2.2"
239-
postcss "^5.2.4"
240-
postcss-value-parser "^3.2.3"
241-
242231
aws-sign2@~0.6.0:
243232
version "0.6.0"
244233
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f"
@@ -276,7 +265,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.16.0:
276265
esutils "^2.0.2"
277266
js-tokens "^2.0.0"
278267

279-
babel-core@6.18.2:
268+
babel-core@6.18.2, babel-core@^6.18.0:
280269
version "6.18.2"
281270
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.18.2.tgz#d8bb14dd6986fa4f3566a26ceda3964fa0e04e5b"
282271
dependencies:
@@ -300,30 +289,6 @@ babel-core@6.18.2:
300289
slash "^1.0.0"
301290
source-map "^0.5.0"
302291

303-
babel-core@^6.18.0:
304-
version "6.18.0"
305-
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.18.0.tgz#bb5ce9bc0a956e6e94e2f12d597abb3b0b330deb"
306-
dependencies:
307-
babel-code-frame "^6.16.0"
308-
babel-generator "^6.18.0"
309-
babel-helpers "^6.16.0"
310-
babel-messages "^6.8.0"
311-
babel-register "^6.18.0"
312-
babel-runtime "^6.9.1"
313-
babel-template "^6.16.0"
314-
babel-traverse "^6.18.0"
315-
babel-types "^6.18.0"
316-
babylon "^6.11.0"
317-
convert-source-map "^1.1.0"
318-
debug "^2.1.1"
319-
json5 "^0.5.0"
320-
lodash "^4.2.0"
321-
minimatch "^3.0.2"
322-
path-is-absolute "^1.0.0"
323-
private "^0.1.6"
324-
slash "^1.0.0"
325-
source-map "^0.5.0"
326-
327292
babel-eslint@7.1.1:
328293
version "7.1.1"
329294
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2"
@@ -905,6 +870,13 @@ bcrypt-pbkdf@^1.0.0:
905870
dependencies:
906871
tweetnacl "^0.14.3"
907872

873+
better-npm-run@^0.0.13:
874+
version "0.0.13"
875+
resolved "https://registry.yarnpkg.com/better-npm-run/-/better-npm-run-0.0.13.tgz#38a340d0546c831ce80bae66d4def19c5c7ee963"
876+
dependencies:
877+
dotenv "^2.0.0"
878+
object-assign "^4.0.1"
879+
908880
big.js@^3.1.3:
909881
version "3.1.3"
910882
resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.1.3.tgz#4cada2193652eb3ca9ec8e55c9015669c9806978"
@@ -1068,11 +1040,7 @@ camelcase@^3.0.0:
10681040
version "3.0.0"
10691041
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a"
10701042

1071-
caniuse-db@^1.0.30000539, caniuse-db@^1.0.30000554:
1072-
version "1.0.30000559"
1073-
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000559.tgz#afbd68916dd23bfd549c26520c78631fb5e2e393"
1074-
1075-
caniuse-db@^1.0.30000578:
1043+
caniuse-db@^1.0.30000539, caniuse-db@^1.0.30000578:
10761044
version "1.0.30000590"
10771045
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000590.tgz#306e2b133ce467e8341b2accd223256b4040b2be"
10781046

@@ -1633,6 +1601,10 @@ domain-browser@^1.1.1:
16331601
version "1.1.7"
16341602
resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc"
16351603

1604+
dotenv@^2.0.0:
1605+
version "2.0.0"
1606+
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-2.0.0.tgz#bd759c357aaa70365e01c96b7b0bec08a6e0d949"
1607+
16361608
duplexer@~0.1.1:
16371609
version "0.1.1"
16381610
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
@@ -3055,14 +3027,10 @@ lodash.restparam@^3.0.0:
30553027
version "3.6.1"
30563028
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
30573029

3058-
lodash@4.17.2, lodash@^4.0.0:
3030+
lodash@4.17.2, lodash@^4.0.0, lodash@^4.14.0, lodash@^4.16.2, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.0, lodash@^4.6.1, lodash@^4.8.0:
30593031
version "4.17.2"
30603032
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42"
30613033

3062-
lodash@^4.14.0, lodash@^4.16.2, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.6.0, lodash@^4.6.1, lodash@^4.8.0:
3063-
version "4.16.6"
3064-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.16.6.tgz#d22c9ac660288f3843e16ba7d2b5d06cca27d777"
3065-
30663034
lodash@~4.9.0:
30673035
version "4.9.0"
30683036
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.9.0.tgz#4c20d742f03ce85dc700e0dd7ab9bcab85e6fc14"
@@ -3947,16 +3915,7 @@ postcss-zindex@^2.0.1:
39473915
postcss "^5.0.4"
39483916
uniqs "^2.0.0"
39493917

3950-
postcss@^5.0.10, postcss@^5.0.14, postcss@^5.0.19, postcss@^5.0.4:
3951-
version "5.2.4"
3952-
resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.4.tgz#8eb4bee3e5c4e091585b116df32d8db24a535f21"
3953-
dependencies:
3954-
chalk "^1.1.3"
3955-
js-base64 "^2.1.9"
3956-
source-map "^0.5.6"
3957-
supports-color "^3.1.2"
3958-
3959-
postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.16, postcss@^5.0.2, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.2.4, postcss@^5.2.5:
3918+
postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.14, postcss@^5.0.16, postcss@^5.0.19, postcss@^5.0.2, postcss@^5.0.4, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.2.5:
39603919
version "5.2.5"
39613920
resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.5.tgz#ec428c27dffc7fac65961340a9b022fa4af5f056"
39623921
dependencies:
@@ -4146,7 +4105,7 @@ react-pure-render@^1.0.2:
41464105
version "1.0.2"
41474106
resolved "https://registry.yarnpkg.com/react-pure-render/-/react-pure-render-1.0.2.tgz#9d8a928c7f2c37513c2d064e57b3e3c356e9fabb"
41484107

4149-
react-redux@4.4.6:
4108+
react-redux@4.4.6, react-redux@^4.0.0:
41504109
version "4.4.6"
41514110
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-4.4.6.tgz#4b9d32985307a11096a2dd61561980044fcc6209"
41524111
dependencies:
@@ -4155,15 +4114,6 @@ react-redux@4.4.6:
41554114
lodash "^4.2.0"
41564115
loose-envify "^1.1.0"
41574116

4158-
react-redux@^4.0.0:
4159-
version "4.4.5"
4160-
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-4.4.5.tgz#f509a2981be2252d10c629ef7c559347a4aec457"
4161-
dependencies:
4162-
hoist-non-react-statics "^1.0.3"
4163-
invariant "^2.0.0"
4164-
lodash "^4.2.0"
4165-
loose-envify "^1.1.0"
4166-
41674117
react-router-redux@4.0.7:
41684118
version "4.0.7"
41694119
resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-4.0.7.tgz#9b1fde4e70106c50f47214e12bdd888cfb96e2a6"
@@ -4219,7 +4169,7 @@ read-pkg@^1.0.0:
42194169
normalize-package-data "^2.3.2"
42204170
path-type "^1.0.0"
42214171

4222-
readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@~2.1.4:
4172+
readable-stream@^2.0.0, readable-stream@~2.1.4:
42234173
version "2.1.5"
42244174
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0"
42254175
dependencies:
@@ -4231,7 +4181,7 @@ readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@~2.
42314181
string_decoder "~0.10.x"
42324182
util-deprecate "~1.0.1"
42334183

4234-
readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@~2.0.0, readable-stream@~2.0.5:
4184+
"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@~2.0.0, readable-stream@~2.0.5:
42354185
version "2.0.6"
42364186
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
42374187
dependencies:
@@ -5236,20 +5186,13 @@ webpack-isomorphic-tools@2.6.4:
52365186
sync-request "^3.0.1"
52375187
uglify-js "^2.7.0"
52385188

5239-
webpack-sources@0.1.3:
5189+
webpack-sources@0.1.3, webpack-sources@^0.1.0:
52405190
version "0.1.3"
52415191
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.3.tgz#15ce2fb79d0a1da727444ba7c757bf164294f310"
52425192
dependencies:
52435193
source-list-map "~0.1.0"
52445194
source-map "~0.5.3"
52455195

5246-
webpack-sources@^0.1.0:
5247-
version "0.1.2"
5248-
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.2.tgz#057a3f3255f8ba561b901d9150589aa103a57e65"
5249-
dependencies:
5250-
source-list-map "~0.1.0"
5251-
source-map "~0.5.3"
5252-
52535196
webpack@2.1.0-beta.27:
52545197
version "2.1.0-beta.27"
52555198
resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.1.0-beta.27.tgz#06cb802e44118159e46b7533ae76b0d84c8c89d8"

0 commit comments

Comments
 (0)