Skip to content

Commit

Permalink
deps: update babel-preset-lux to version 2.0.1 (#570)
Browse files Browse the repository at this point in the history
* deps: update babel-preset-lux to version 2.0.0

* fix: update babel-hook to not include missing plugins

* deps: update babel-preset-lux to version 2.0.1

* fix: update babel-hook

* fix: do not set node_env in package.json
  • Loading branch information
zacharygolba authored Dec 17, 2016
1 parent ac08ca4 commit 4fad8cb
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"presets": ["lux"]
"presets": ["lux"],
"minified": true,
"comments": false
}
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
}
},
"rules": {
"strict": 0,
"max-len": ["error", 80],
"arrow-parens": 0,
"comma-dangle": [2, "only-multiline"],
"prefer-reflect": 2,
"global-require": 0,
"class-methods-use-this": 0,
"no-restricted-syntax": [
"error",
Expand All @@ -49,6 +51,7 @@
],
"newlines-between": "always"
}],
"import/no-dynamic-require": 0,
"import/prefer-default-export": 0,
"flowtype/semi": 2,
"flowtype/no-dupe-keys": 2,
Expand Down
37 changes: 24 additions & 13 deletions lib/babel-hook.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
'use strict'; // eslint-disable-line strict, lines-around-directive
'use strict';

// Require this module to use code in the /src dir prior to transpilation.
const IS_NODE_SEVEN = process.version.charAt(1) === '7';
const HAS_HARMONY_FLAG = process.execArgv.includes('--harmony');

const plugins = (...items) => items.concat([
'transform-async-to-generator',
'transform-class-properties',
'transform-es2015-destructuring',
'transform-es2015-parameters',
'transform-es2015-spread',
'transform-exponentiation-operator',
'transform-flow-strip-types',
'transform-object-rest-spread',
'transform-es2015-modules-commonjs'
]);
const plugins = (...items) => {
const defaultPlugins = [
'transform-class-properties',
'transform-flow-strip-types',
'transform-es2015-modules-commonjs',
['transform-object-rest-spread', {
useBuiltIns: true
}]
];

if (!IS_NODE_SEVEN) {
defaultPlugins.push(
'babel-plugin-transform-exponentiation-operator',
'babel-plugin-transform-async-to-generator'
);
} else if (!HAS_HARMONY_FLAG) {
defaultPlugins.push('babel-plugin-transform-async-to-generator');
}

return items.concat(defaultPlugins);
};

// eslint-disable-next-line import/no-extraneous-dependencies
require('babel-core/register')({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"babel-core": "6.21.0",
"babel-plugin-istanbul": "2.0.3",
"babel-plugin-transform-es2015-modules-commonjs": "6.18.0",
"babel-preset-lux": "1.3.0",
"babel-preset-lux": "2.0.1",
"chai": "3.5.0",
"eslint-config-airbnb-base": "11.0.0",
"eslint-plugin-flowtype": "2.29.1",
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'; // eslint-disable-line strict, lines-around-directive

process.env.NODE_ENV = 'production';

require('../../lib/babel-hook');

const { EOL } = require('os');
Expand Down

0 comments on commit 4fad8cb

Please sign in to comment.