Skip to content

Commit ef8d176

Browse files
committed
CoffeeScript 1.11 now supports ES modules!
- Fixed all source code to use ES import/export - Added Babel build toolchain after CS compilation - npm run build will now build a CommonJS module (lib/) and an ES6 module (es/) - package.json includes a jsnext:main directive for ES6 imports - main now points at lib/ (no more git submodule free rides)
1 parent 5f8ce53 commit ef8d176

18 files changed

+130
-88
lines changed

.babelrc

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
{ "presets": ["es2015", "stage-1"] }
1+
{
2+
"plugins": [
3+
["transform-es2015-template-literals", { "loose": true }],
4+
"transform-es2015-literals",
5+
"transform-es2015-function-name",
6+
"transform-es2015-arrow-functions",
7+
"transform-es2015-block-scoped-functions",
8+
["transform-es2015-classes", { "loose": true }],
9+
"transform-es2015-object-super",
10+
"transform-es2015-shorthand-properties",
11+
["transform-es2015-computed-properties", { "loose": true }],
12+
["transform-es2015-for-of", { "loose": true }],
13+
"transform-es2015-sticky-regex",
14+
"transform-es2015-unicode-regex",
15+
"check-es2015-constants",
16+
["transform-es2015-spread", { "loose": true }],
17+
"transform-es2015-parameters",
18+
["transform-es2015-destructuring", { "loose": true }],
19+
"transform-es2015-block-scoping",
20+
"transform-object-rest-spread",
21+
"transform-es3-member-expression-literals",
22+
"transform-es3-property-literals"
23+
],
24+
"env": {
25+
"commonjs": {
26+
"plugins": [
27+
["transform-es2015-modules-commonjs", { "loose": true }]
28+
]
29+
},
30+
"es": {
31+
"plugins": [
32+
]
33+
}
34+
}
35+
}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ node_modules
3737

3838
# Build products
3939
dist
40-
lib
40+
lib/
41+
build/
42+
es/

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ test/
44
*.swp
55
.DS_Store
66
src/
7+
coverage/
78
scripts/
9+
build/
810
book.json
911
coffeelint.json
1012
.eslintrc

ReduxComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
///////////////////////////////////////////////////////////////////////
22
// ES5 EXPORT STUB
33
///////////////////////////////////////////////////////////////////////
4-
module.exports = require('./lib/ReduxComponent');
4+
module.exports = require('./lib').ReduxComponent;

SubtreeMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
///////////////////////////////////////////////////////////////////////
22
// ES5 EXPORT STUB
33
///////////////////////////////////////////////////////////////////////
4-
module.exports = require('./lib/subtree').SubtreeMixin;
4+
module.exports = require('./lib').SubtreeMixin;

createClass.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
///////////////////////////////////////////////////////////////////////
22
// ES5 EXPORT STUB
33
///////////////////////////////////////////////////////////////////////
4-
module.exports = require('./lib/createClass');
4+
module.exports = require('./lib').createClass;

createComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
///////////////////////////////////////////////////////////////////////
22
// ES5 EXPORT STUB
33
///////////////////////////////////////////////////////////////////////
4-
module.exports = require('./lib/subtree').createComponent;
4+
module.exports = require('./lib').createComponent;

index.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
// Default exports for redux-components
2-
module.exports = {
3-
createClass: require('./createClass.js'),
4-
createComponent: require('./createComponent.js'),
5-
mountComponent: require('./mountComponent.js'),
6-
ReduxComponent: require('./ReduxComponent.js'),
7-
SubtreeMixin: require('./SubtreeMixin.js')
8-
};
1+
///////////////////////////////////////////////////////////////////////
2+
// ES5 EXPORT STUB
3+
///////////////////////////////////////////////////////////////////////
4+
module.exports = require('./lib');

mountComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
///////////////////////////////////////////////////////////////////////
22
// ES5 EXPORT STUB
33
///////////////////////////////////////////////////////////////////////
4-
module.exports = require('./lib/mountComponent');
4+
module.exports = require('./lib').mountComponent;

package.json

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
{
22
"name": "redux-components",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "A component model for Redux state trees based on the React.js component model.",
5-
"main": "./index.js",
5+
"main": "lib/index.js",
6+
"jsnext:main": "es/index.js",
67
"scripts": {
7-
"clean": "rm -rf lib",
8-
"build": "mkdir -p lib && coffee -o lib src/*.coffee",
9-
"prepublish": "npm run clean && npm run build"
8+
"clean": "rimraf lib build es coverage",
9+
"build:babel:commonjs": "cross-env BABEL_ENV=commonjs babel build --out-dir lib",
10+
"build:babel:es": "cross-env BABEL_ENV=es babel build --out-dir es",
11+
"build:coffee": "mkdir -p build && coffee -o build src/*.coffee",
12+
"build": "npm run build:coffee && npm run build:babel:commonjs && npm run build:babel:es",
13+
"prepublish": "npm run clean && npm run build",
14+
"test": "node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register",
15+
"coverage": "node_modules/.bin/mocha --recursive --compilers coffee:coffee-script/register --require coffee-coverage/register-istanbul",
16+
"coverageReport": "node_modules/.bin/istanbul report"
1017
},
1118
"repository": {
1219
"type": "git",
@@ -24,17 +31,43 @@
2431
},
2532
"homepage": "https://github.com/",
2633
"devDependencies": {
27-
"babel-preset-es2015": "^6.6.0",
28-
"babel-preset-stage-1": "^6.5.0",
29-
"babel-register": "^6.7.2",
34+
"babel-cli": "^6.3.15",
35+
"babel-core": "^6.3.15",
36+
"babel-eslint": "^4.1.6",
37+
"babel-plugin-check-es2015-constants": "^6.3.13",
38+
"babel-plugin-transform-es2015-arrow-functions": "^6.3.13",
39+
"babel-plugin-transform-es2015-block-scoped-functions": "^6.3.13",
40+
"babel-plugin-transform-es2015-block-scoping": "^6.3.13",
41+
"babel-plugin-transform-es2015-classes": "^6.3.13",
42+
"babel-plugin-transform-es2015-computed-properties": "^6.3.13",
43+
"babel-plugin-transform-es2015-destructuring": "^6.3.13",
44+
"babel-plugin-transform-es2015-for-of": "^6.3.13",
45+
"babel-plugin-transform-es2015-function-name": "^6.3.13",
46+
"babel-plugin-transform-es2015-literals": "^6.3.13",
47+
"babel-plugin-transform-es2015-modules-commonjs": "^6.3.13",
48+
"babel-plugin-transform-es2015-object-super": "^6.3.13",
49+
"babel-plugin-transform-es2015-parameters": "^6.3.13",
50+
"babel-plugin-transform-es2015-shorthand-properties": "^6.3.13",
51+
"babel-plugin-transform-es2015-spread": "^6.3.13",
52+
"babel-plugin-transform-es2015-sticky-regex": "^6.3.13",
53+
"babel-plugin-transform-es2015-template-literals": "^6.3.13",
54+
"babel-plugin-transform-es2015-unicode-regex": "^6.3.13",
55+
"babel-plugin-transform-es3-member-expression-literals": "^6.5.0",
56+
"babel-plugin-transform-es3-property-literals": "^6.5.0",
57+
"babel-plugin-transform-object-rest-spread": "^6.3.13",
58+
"babel-register": "^6.3.13",
3059
"chai": "^3.5.0",
31-
"coffee-script": "^1.10.0",
60+
"coffee-coverage": "^1.0.1",
61+
"coffee-script": "^1.11.1",
62+
"coffeelint": "^1.16.0",
63+
"cross-env": "^1.0.7",
64+
"istanbul": "^0.4.5",
3265
"mocha": "^2.4.5"
3366
},
3467
"dependencies": {
3568
"inv": "0.0.1"
3669
},
3770
"peerDependencies": {
38-
"redux": "^3.3.1"
71+
"redux": "^3.6.0"
3972
}
4073
}

0 commit comments

Comments
 (0)