Skip to content

Commit 9cc6acf

Browse files
committed
build and publish with es module
1 parent a17395f commit 9cc6acf

File tree

4 files changed

+144
-15
lines changed

4 files changed

+144
-15
lines changed

.babelrc

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
{
22
"presets": [
3-
"env"
3+
["env", { "modules": false }]
44
],
5-
"plugins": [
6-
"add-module-exports",
7-
"transform-es2015-modules-commonjs"
8-
]
5+
"env": {
6+
"commonjs": {
7+
"plugins": [
8+
"add-module-exports",
9+
"transform-es2015-modules-commonjs"
10+
]
11+
},
12+
"test": {
13+
"plugins": [
14+
"transform-es2015-modules-commonjs"
15+
]
16+
}
17+
}
918
}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
2-
dist
2+
es
3+
lib
34
.DS_Store
45
*.log

package.json

+13-5
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,35 @@
1010
"license": "MIT",
1111
"author": "Andrew Clark <[email protected]>",
1212
"files": [
13-
"dist"
13+
"lib",
14+
"es"
1415
],
15-
"main": "dist/index.js",
16+
"main": "lib/index.js",
17+
"module": "es/index.js",
1618
"repository": "redux-utilities/reduce-reducers",
1719
"scripts": {
1820
"precommit": "lint-staged",
1921
"format": "prettier --write \"{lib,test}/*.{js,md}\"",
2022
"format:check": "prettier --list-different \"{lib,test}/*.{js,md}\"",
2123
"lint": "xo",
2224
"test": "jest",
23-
"build": "babel src --out-dir=dist",
25+
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir=lib",
26+
"build:es": "babel src --out-dir=es",
27+
"build": "run-p build:**",
2428
"prepublishOnly": "npm run build"
2529
},
2630
"devDependencies": {
2731
"babel-cli": "^6.26.0",
2832
"babel-jest": "^22.4.3",
2933
"babel-plugin-add-module-exports": "^0.2.1",
30-
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
34+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
3135
"babel-preset-env": "^1.6.1",
36+
"cross-env": "^5.1.4",
3237
"eslint-plugin-prettier": "^2.6.0",
3338
"husky": "^0.14.3",
3439
"jest": "^22.4.3",
3540
"lint-staged": "^7.0.4",
41+
"npm-run-all": "^4.1.2",
3642
"prettier": "^1.12.0",
3743
"xo": "^0.20.3"
3844
},
@@ -42,7 +48,9 @@
4248
"overrides": [
4349
{
4450
"files": "test/**/*.js",
45-
"env": ["jest"]
51+
"env": [
52+
"jest"
53+
]
4654
}
4755
]
4856
},

yarn.lock

+115-4
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,22 @@ array-equal@^1.0.0:
190190
version "1.0.0"
191191
resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93"
192192

193+
array-filter@~0.0.0:
194+
version "0.0.1"
195+
resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec"
196+
193197
array-find-index@^1.0.1:
194198
version "1.0.2"
195199
resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1"
196200

201+
array-map@~0.0.0:
202+
version "0.0.0"
203+
resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662"
204+
205+
array-reduce@~0.0.0:
206+
version "0.0.0"
207+
resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b"
208+
197209
array-union@^1.0.1:
198210
version "1.0.2"
199211
resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
@@ -585,7 +597,7 @@ babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015
585597
babel-runtime "^6.22.0"
586598
babel-template "^6.24.1"
587599

588-
babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1, babel-plugin-transform-es2015-modules-commonjs@^6.26.0:
600+
babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1:
589601
version "6.26.0"
590602
resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz#0d8394029b7dc6abe1a97ef181e00758dd2e5d8a"
591603
dependencies:
@@ -594,6 +606,15 @@ babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-e
594606
babel-template "^6.26.0"
595607
babel-types "^6.26.0"
596608

609+
babel-plugin-transform-es2015-modules-commonjs@^6.26.2:
610+
version "6.26.2"
611+
resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3"
612+
dependencies:
613+
babel-plugin-transform-strict-mode "^6.24.1"
614+
babel-runtime "^6.26.0"
615+
babel-template "^6.26.0"
616+
babel-types "^6.26.0"
617+
597618
babel-plugin-transform-es2015-modules-systemjs@^6.23.0:
598619
version "6.24.1"
599620
resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23"
@@ -1210,6 +1231,13 @@ create-error-class@^3.0.0:
12101231
dependencies:
12111232
capture-stack-trace "^1.0.0"
12121233

1234+
cross-env@^5.1.4:
1235+
version "5.1.4"
1236+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.1.4.tgz#f61c14291f7cc653bb86457002ea80a04699d022"
1237+
dependencies:
1238+
cross-spawn "^5.1.0"
1239+
is-windows "^1.0.0"
1240+
12131241
cross-spawn@^5.0.1, cross-spawn@^5.1.0:
12141242
version "5.1.0"
12151243
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
@@ -1423,6 +1451,10 @@ duplexer3@^0.1.4:
14231451
version "0.1.4"
14241452
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
14251453

1454+
duplexer@~0.1.1:
1455+
version "0.1.1"
1456+
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
1457+
14261458
ecc-jsbn@~0.1.1:
14271459
version "0.1.1"
14281460
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"
@@ -1453,7 +1485,7 @@ error-ex@^1.2.0, error-ex@^1.3.1:
14531485
dependencies:
14541486
is-arrayish "^0.2.1"
14551487

1456-
es-abstract@^1.5.1:
1488+
es-abstract@^1.4.3, es-abstract@^1.5.1:
14571489
version "1.11.0"
14581490
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.11.0.tgz#cce87d518f0496893b1a30cd8461835535480681"
14591491
dependencies:
@@ -1692,6 +1724,18 @@ esutils@^2.0.2:
16921724
version "2.0.2"
16931725
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
16941726

1727+
event-stream@~3.3.0:
1728+
version "3.3.4"
1729+
resolved "http://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571"
1730+
dependencies:
1731+
duplexer "~0.1.1"
1732+
from "~0"
1733+
map-stream "~0.1.0"
1734+
pause-stream "0.0.11"
1735+
split "0.3"
1736+
stream-combiner "~0.0.4"
1737+
through "~2.3.1"
1738+
16951739
exec-sh@^0.2.0:
16961740
version "0.2.1"
16971741
resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.2.1.tgz#163b98a6e89e6b65b47c2a28d215bc1f63989c38"
@@ -1965,6 +2009,10 @@ fragment-cache@^0.2.1:
19652009
dependencies:
19662010
map-cache "^0.2.2"
19672011

2012+
from@~0:
2013+
version "0.1.7"
2014+
resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe"
2015+
19682016
fs-readdir-recursive@^1.0.0:
19692017
version "1.1.0"
19702018
resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27"
@@ -2683,7 +2731,7 @@ is-utf8@^0.2.0:
26832731
version "0.2.1"
26842732
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
26852733

2686-
is-windows@^1.0.2:
2734+
is-windows@^1.0.0, is-windows@^1.0.2:
26872735
version "1.0.2"
26882736
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
26892737

@@ -3427,6 +3475,10 @@ map-obj@^2.0.0:
34273475
version "2.0.0"
34283476
resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-2.0.0.tgz#a65cd29087a92598b8791257a523e021222ac1f9"
34293477

3478+
map-stream@~0.1.0:
3479+
version "0.1.0"
3480+
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"
3481+
34303482
map-visit@^1.0.0:
34313483
version "1.0.0"
34323484
resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f"
@@ -3439,6 +3491,10 @@ mem@^1.1.0:
34393491
dependencies:
34403492
mimic-fn "^1.0.0"
34413493

3494+
memorystream@^0.3.1:
3495+
version "0.3.1"
3496+
resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2"
3497+
34423498
meow@^4.0.0:
34433499
version "4.0.0"
34443500
resolved "https://registry.yarnpkg.com/meow/-/meow-4.0.0.tgz#fd5855dd008db5b92c552082db1c307cba20b29d"
@@ -3658,6 +3714,20 @@ npm-path@^2.0.2:
36583714
dependencies:
36593715
which "^1.2.10"
36603716

3717+
npm-run-all@^4.1.2:
3718+
version "4.1.2"
3719+
resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.2.tgz#90d62d078792d20669139e718621186656cea056"
3720+
dependencies:
3721+
ansi-styles "^3.2.0"
3722+
chalk "^2.1.0"
3723+
cross-spawn "^5.1.0"
3724+
memorystream "^0.3.1"
3725+
minimatch "^3.0.4"
3726+
ps-tree "^1.1.0"
3727+
read-pkg "^3.0.0"
3728+
shell-quote "^1.6.1"
3729+
string.prototype.padend "^3.0.0"
3730+
36613731
npm-run-path@^2.0.0:
36623732
version "2.0.2"
36633733
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
@@ -3940,6 +4010,12 @@ path-type@^3.0.0:
39404010
dependencies:
39414011
pify "^3.0.0"
39424012

4013+
4014+
version "0.0.11"
4015+
resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445"
4016+
dependencies:
4017+
through "~2.3"
4018+
39434019
performance-now@^0.2.0:
39444020
version "0.2.0"
39454021
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5"
@@ -4056,6 +4132,12 @@ proto-props@^1.1.0:
40564132
version "1.1.0"
40574133
resolved "https://registry.yarnpkg.com/proto-props/-/proto-props-1.1.0.tgz#e2606581dd24aa22398aeeeb628fc08e2ec89c91"
40584134

4135+
ps-tree@^1.1.0:
4136+
version "1.1.0"
4137+
resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.1.0.tgz#b421b24140d6203f1ed3c76996b4427b08e8c014"
4138+
dependencies:
4139+
event-stream "~3.3.0"
4140+
40594141
pseudomap@^1.0.2:
40604142
version "1.0.2"
40614143
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
@@ -4510,6 +4592,15 @@ shebang-regex@^1.0.0:
45104592
version "1.0.0"
45114593
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
45124594

4595+
shell-quote@^1.6.1:
4596+
version "1.6.1"
4597+
resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767"
4598+
dependencies:
4599+
array-filter "~0.0.0"
4600+
array-map "~0.0.0"
4601+
array-reduce "~0.0.0"
4602+
jsonify "~0.0.0"
4603+
45134604
shellwords@^0.1.1:
45144605
version "0.1.1"
45154606
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
@@ -4645,6 +4736,12 @@ split-string@^3.0.1, split-string@^3.0.2:
46454736
dependencies:
46464737
extend-shallow "^3.0.0"
46474738

4739+
4740+
version "0.3.3"
4741+
resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f"
4742+
dependencies:
4743+
through "2"
4744+
46484745
sprintf-js@~1.0.2:
46494746
version "1.0.3"
46504747
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
@@ -4682,6 +4779,12 @@ stealthy-require@^1.1.0:
46824779
version "1.1.1"
46834780
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
46844781

4782+
stream-combiner@~0.0.4:
4783+
version "0.0.4"
4784+
resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14"
4785+
dependencies:
4786+
duplexer "~0.1.1"
4787+
46854788
stream-to-observable@^0.2.0:
46864789
version "0.2.0"
46874790
resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.2.0.tgz#59d6ea393d87c2c0ddac10aa0d561bc6ba6f0e10"
@@ -4714,6 +4817,14 @@ string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1:
47144817
is-fullwidth-code-point "^2.0.0"
47154818
strip-ansi "^4.0.0"
47164819

4820+
string.prototype.padend@^3.0.0:
4821+
version "3.0.0"
4822+
resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.0.0.tgz#f3aaef7c1719f170c5eab1c32bf780d96e21f2f0"
4823+
dependencies:
4824+
define-properties "^1.1.2"
4825+
es-abstract "^1.4.3"
4826+
function-bind "^1.0.2"
4827+
47174828
string_decoder@~1.1.1:
47184829
version "1.1.1"
47194830
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
@@ -4854,7 +4965,7 @@ throat@^4.0.0:
48544965
version "4.1.0"
48554966
resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a"
48564967

4857-
through@^2.3.6:
4968+
through@2, through@^2.3.6, through@~2.3, through@~2.3.1:
48584969
version "2.3.8"
48594970
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
48604971

0 commit comments

Comments
 (0)