diff --git a/.babelrc b/.babelrc index 9e27feb..c6b9792 100644 --- a/.babelrc +++ b/.babelrc @@ -1,7 +1,35 @@ { - "presets": ["es2015", "stage-2"], + "presets": ["stage-2"], "sourceMaps": true, "plugins": [ - ["transform-react-jsx", {"pragma": "h"}] - ] + ["transform-react-jsx", {"pragma": "h"}], + "transform-es2015-template-literals", + "transform-es2015-literals", + "transform-es2015-function-name", + "transform-es2015-arrow-functions", + "transform-es2015-block-scoped-functions", + "transform-es2015-classes", + "transform-es2015-object-super", + "transform-es2015-shorthand-properties", + "transform-es2015-duplicate-keys", + "transform-es2015-computed-properties", + "transform-es2015-for-of", + "transform-es2015-sticky-regex", + "transform-es2015-unicode-regex", + "check-es2015-constants", + "transform-es2015-spread", + "transform-es2015-parameters", + "transform-es2015-destructuring", + "transform-es2015-block-scoping", + "transform-es2015-typeof-symbol", + ["transform-regenerator", { "async": false, "asyncGenerators": false }], + ], + "env": { + "commonjs": { + "plugins": [ + ["transform-es2015-modules-commonjs", { "loose": true }] + ] + }, + "es": {} + } } diff --git a/.gitignore b/.gitignore index fd82010..b950123 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules _book dist lib +es npm-debug.log diff --git a/.npmignore b/.npmignore index 121ef01..ed30236 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,3 @@ +.babelrc test src diff --git a/package.json b/package.json index 2764315..cf6d88f 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,15 @@ "repository": "dekujs/deku", "description": "Render interfaces using pure functions and virtual DOM", "main": "lib/index.js", - "jsnext:main": "src/index.js", + "jsnext:main": "es/index.js", "scripts": { "clean": "rimraf lib _book", - "build": "babel src --out-dir lib", - "test": "hihat test/index.js -- --debug -t babelify -p tap-dev-tool", - "test:headless": "browserify test/index.js -t babelify | tape-run", - "test:browsers": "zuul -- ./test/index.js", + "build": "npm run build:commonjs && npm run build:es", + "build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib", + "build:es": "cross-env BABEL_ENV=es babel src --out-dir es", + "test": "cross-env BABEL_ENV=commonjs hihat test/index.js -- --debug -t babelify -p tap-dev-tool", + "test:headless": "cross-env BABEL_ENV=commonjs browserify test/index.js -t babelify | tape-run", + "test:browsers": "cross-env BABEL_ENV=commonjs zuul -- ./test/index.js", "test:lint": "standard src/**/*.js test/**/*.js | snazzy", "docs:install": "gitbook install", "docs:build": "npm run docs:install && gitbook build", @@ -26,14 +28,35 @@ }, "devDependencies": { "babel-cli": "6.3.17", + "babel-plugin-check-es2015-constants": "^6.7.2", + "babel-plugin-transform-es2015-arrow-functions": "^6.5.2", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.6.5", + "babel-plugin-transform-es2015-block-scoping": "^6.7.1", + "babel-plugin-transform-es2015-classes": "^6.6.5", + "babel-plugin-transform-es2015-computed-properties": "^6.6.5", + "babel-plugin-transform-es2015-destructuring": "^6.6.5", + "babel-plugin-transform-es2015-duplicate-keys": "^6.6.4", + "babel-plugin-transform-es2015-for-of": "^6.6.0", + "babel-plugin-transform-es2015-function-name": "^6.5.0", + "babel-plugin-transform-es2015-literals": "^6.5.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.7.4", + "babel-plugin-transform-es2015-object-super": "^6.6.5", + "babel-plugin-transform-es2015-parameters": "^6.7.0", + "babel-plugin-transform-es2015-shorthand-properties": "^6.5.0", + "babel-plugin-transform-es2015-spread": "^6.6.5", + "babel-plugin-transform-es2015-sticky-regex": "^6.5.0", + "babel-plugin-transform-es2015-template-literals": "^6.6.5", + "babel-plugin-transform-es2015-typeof-symbol": "^6.6.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.5.0", "babel-plugin-transform-react-jsx": "6.1.18", + "babel-plugin-transform-regenerator": "^6.6.5", "babel-polyfill": "6.1.19", - "babel-preset-es2015": "6.1.18", "babel-preset-stage-2": "6.1.18", "babelify": "7.2.0", "browserify": "13.0.0", "browserify-hmr": "^0.3.1", "budo": "7.1.0", + "cross-env": "^1.0.7", "gh-pages": "0.8.0", "gitbook": "2.6.6", "hihat": "2.6.4",