Skip to content

Commit ffaceb7

Browse files
committed
fix: convert to poly package
BREAKING CHANGE: if you are building for legacy browsers with webpack or similar bundlers you may need to add a rule to transpile this package to ES5.
2 parents 0f2cd11 + 83bcb67 commit ffaceb7

File tree

7 files changed

+63
-82
lines changed

7 files changed

+63
-82
lines changed

.babelrc

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
{
2-
presets: [
3-
'flow',
2+
"plugins": [
3+
"syntax-dynamic-import",
4+
"transform-class-properties",
5+
"transform-export-extensions",
6+
"transform-object-rest-spread",
7+
"lodash"
48
],
5-
env: {
6-
test: {
7-
presets: [
8-
[
9-
'env',
10-
{
11-
targets: {
12-
node: 'current',
13-
},
14-
},
15-
],
16-
],
17-
plugins: [
18-
'transform-runtime',
19-
'istanbul',
20-
'lodash',
9+
"presets": [
10+
"flow"
11+
],
12+
"env": {
13+
"test": {
14+
"presets": [
15+
["env", {"targets": {"node": "current"}}],
16+
"stage-1", "flow"
2117
],
18+
"plugins": [
19+
"transform-runtime",
20+
"lodash"
21+
]
2222
},
23-
es5: {
24-
presets: [
25-
[
26-
'env',
27-
{
28-
forceAllTransforms: true,
29-
},
30-
],
23+
"coverage": {
24+
"presets": [
25+
["env", {"targets": {"node": "current"}}],
26+
"stage-1", "flow"
3127
],
32-
plugins: [
33-
'transform-runtime',
34-
'lodash',
28+
"plugins": [
29+
"istanbul",
30+
"transform-runtime",
31+
"lodash"
32+
]
33+
},
34+
"es5": {
35+
"presets": [
36+
["env", {"forceAllTransforms": true}],
37+
"stage-1", "flow"
3538
],
3639
},
3740
},
38-
}
41+
}

.flowconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[ignore]
22
<PROJECT_ROOT>/lib/.*
3-
<PROJECT_ROOT>/module/.*
3+
<PROJECT_ROOT>/es/.*
4+
<PROJECT_ROOT>/node_modules/fbjs/.*
5+
<PROJECT_ROOT>/node_modules/.*/fbjs/.*
46

57
[include]
68
./src

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ coverage
22
.nyc_output
33
node_modules
44
lib
5-
module
5+
es
66
.eslintcache

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
coverage
22
.nyc_output
3+
src
4+
lib
35
test
46
scripts
57
node_modules

README.md

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# mindfront-redux-utils-immutable
22

3-
<<<<<<< HEAD
43
[![Build Status](https://travis-ci.org/jcoreio/redux-utils-immutable.svg?branch=master)](https://travis-ci.org/jcoreio/redux-utils-immutable)
5-
[![Coverage Status](https://coveralls.io/repos/github/jcoreio/redux-utils-immutable/badge.svg?branch=master)](https://coveralls.io/github/jcoreio/redux-utils-immutable?branch=master)
6-
=======
7-
[![Build Status](https://travis-ci.org/jedwards1211/es2015-library-skeleton.svg?branch=master)](https://travis-ci.org/jedwards1211/es2015-library-skeleton)
8-
[![Coverage Status](https://codecov.io/gh/jedwards1211/es2015-library-skeleton/branch/master/graph/badge.svg)](https://codecov.io/gh/jedwards1211/es2015-library-skeleton)
9-
>>>>>>> bb3ada4e8867cc3ed4d5995dc8f48afa090f65d0
4+
[![Coverage Status](https://codecov.io/gh/jcoreio/redux-utils-immutable/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/redux-utils-immutable)
105
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
116
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
127

13-
<<<<<<< HEAD
8+
## Legacy build note
9+
10+
If you are building for legacy browsers with webpack or a similar bundler, make
11+
sure to add a rule to transpile this package to ES5.
12+
1413
## combineReducers
1514
```es6
1615
import {combineReducers} from 'mindfront-redux-utils-immutable'
@@ -131,35 +130,3 @@ has `actionHandlers`, the created reducer will have corresponding `actionHandler
131130

132131
If you pass a function for `path`, `subpathReducer` will get the actual path by calling `path(action)` for each
133132
`action`.
134-
135-
=======
136-
This is my personal skeleton for creating an ES2015 library npm package. You are welcome to use it.
137-
138-
## Quick start
139-
140-
```sh
141-
npm i -g howardroark/pollinate
142-
pollinate https://github.com/jedwards1211/es2015-library-skeleton.git --keep-history --name <package name> --author <your name> --organization <github organization> --description <package description>
143-
cd <package name>
144-
npm i
145-
```
146-
147-
## Tools used
148-
149-
* babel 6
150-
* babel-preset-env
151-
* mocha
152-
* chai
153-
* istanbul
154-
* nyc
155-
* babel-plugin-istanbul
156-
* eslint
157-
* eslint-watch
158-
* flow
159-
* flow-watch
160-
* pre-commit (runs eslnt and flow)
161-
* semantic-release
162-
* Travis CI
163-
* Coveralls
164-
>>>>>>> bb3ada4e8867cc3ed4d5995dc8f48afa090f65d0
165-

package.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
"name": "mindfront-redux-utils-immutable",
33
"version": "0.0.0-development",
44
"description": "utilities for working with redux and immutable.js",
5-
"main": "lib/index.js",
6-
"module": "module/index.js",
5+
"main": "index.js",
6+
"module": "es/index.js",
7+
"modules.root": "es",
8+
"sideEffects": false,
79
"scripts": {
810
"lint": "eslint src test --cache",
911
"lint:fix": "eslint --fix src test --cache",
1012
"lint:watch": "esw --watch src test --cache",
1113
"flow": "flow",
1214
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done",
13-
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore lib/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
14-
"build": "rimraf module && babel src --out-dir module && flow-copy-source -v src/ module && rimraf lib && BABEL_ENV=es5 babel src --out-dir lib && flow-copy-source -v src/ lib",
15-
"test": "NODE_ENV=production BABEL_ENV=es5 mocha $npm_package_config_mocha && NODE_ENV=production BABEL_ENV=test nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
16-
"test:watch": "mocha --watch $npm_package_config_mocha",
15+
"flow:watch": "flow-watch -e js,js.flow,flowconfig --ignore es/ --ignore node_modules/ --watch .flowconfig --watch src/ --watch test/",
16+
"clean": "rimraf *.js *.js.flow es lib && git checkout HEAD *.js",
17+
"build": "npm run clean && babel src --out-dir es && flow-copy-source -v src/ es && BABEL_ENV=es5 babel src --out-dir . && flow-copy-source -v src/ .",
18+
"test": "NODE_ENV=production BABEL_ENV=es5 mocha $npm_package_config_mocha && NODE_ENV=production BABEL_ENV=coverage nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
19+
"test:watch": "NODE_ENV=production BABEL_ENV=test mocha --watch $npm_package_config_mocha",
1720
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov",
1821
"commitmsg": "commitlint -e $GIT_PARAMS",
1922
"precommit": "npm run lint && flow",
@@ -65,6 +68,10 @@
6568
"babel-eslint": "^7.2.2",
6669
"babel-plugin-istanbul": "^4.1.1",
6770
"babel-plugin-lodash": "^3.3.4",
71+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
72+
"babel-plugin-transform-class-properties": "^6.24.1",
73+
"babel-plugin-transform-export-extensions": "^6.22.0",
74+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
6875
"babel-plugin-transform-runtime": "^6.23.0",
6976
"babel-preset-env": "^1.7.0",
7077
"babel-preset-flow": "^6.23.0",
@@ -78,7 +85,7 @@
7885
"eslint": "^4.1.0",
7986
"eslint-plugin-flowtype": "^2.30.4",
8087
"eslint-watch": "^3.1.0",
81-
"flow-bin": "^0.73.0",
88+
"flow-bin": "^0.74.0",
8289
"flow-copy-source": "^1.2.1",
8390
"flow-watch": "^1.1.1",
8491
"husky": "^0.14.3",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ babel-plugin-transform-flow-strip-types@^6.22.0:
994994
babel-plugin-syntax-flow "^6.18.0"
995995
babel-runtime "^6.22.0"
996996

997-
babel-plugin-transform-object-rest-spread@^6.22.0:
997+
babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.26.0:
998998
version "6.26.0"
999999
resolved "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
10001000
dependencies:
@@ -2413,9 +2413,9 @@ flat-cache@^1.2.1:
24132413
graceful-fs "^4.1.2"
24142414
write "^0.2.1"
24152415

2416-
flow-bin@^0.73.0:
2417-
version "0.73.0"
2418-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.73.0.tgz#da1b90a02b0ef9c439f068c2fc14968db83be425"
2416+
flow-bin@^0.74.0:
2417+
version "0.74.0"
2418+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.74.0.tgz#8017bb00efb37cbe8d81fbb7f464038bde06adc9"
24192419

24202420
flow-copy-source@^1.2.1:
24212421
version "1.2.1"

0 commit comments

Comments
 (0)