Skip to content

Commit

Permalink
Update dependencies and make changes for Babel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhefner committed Aug 31, 2018
1 parent 711d08d commit 1b9e6b7
Show file tree
Hide file tree
Showing 6 changed files with 1,097 additions and 804 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ umd
!rollup.config.js
*.sublime-project
*.sublime-workspace
yarn-error.log
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"clean": "rm -f index.js && rm -rf es && rm -rf umd",
"prebuild": "npm run clean",
"build": "node ./tools/build.js",
"watch": "babel ./src -d . --ignore __tests__ --watch",
"watch": "babel ./src -d . --ignore __tests__,*.test.js --watch",
"prepare": "npm run build",
"prepublishOnly": "node ./tools/build.js",
"push-release": "git push origin master && git push --tags",
Expand All @@ -37,15 +37,16 @@
"prop-types": "^15.6.2"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.26.0",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-external-helpers": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-core": "^7.0.0-0",
"babel-jest": "^23.4.0",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"coveralls": "^3.0.2",
"enzyme": "^3.5.0",
"enzyme-adapter-react-16": "^1.3.1",
Expand Down
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const config = {
plugins: [
babel({
exclude: 'node_modules/**',
externalHelpers: process.env.BABEL_ENV === 'umd',
}),
resolve(),
commonjs({
Expand Down
38 changes: 18 additions & 20 deletions tools/babel-preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,30 @@ const BABEL_ENV = process.env.BABEL_ENV;
const building = BABEL_ENV != undefined && BABEL_ENV !== 'cjs';

const plugins = [
'transform-object-rest-spread',
'@babel/plugin-proposal-object-rest-spread',
];

if (BABEL_ENV === 'umd') {
plugins.push('external-helpers');
}

if (process.env.NODE_ENV === 'production') {
plugins.push(
'dev-expression',
'transform-react-remove-prop-types'
'babel-plugin-dev-expression',
'babel-plugin-transform-react-remove-prop-types'
);
}

module.exports = {
env: {
test: {
presets: [['env'], 'react'],
module.exports = () => {
return {
env: {
test: {
presets: [['@babel/preset-env'], '@babel/preset-react'],
},
},
},
presets: [
['env', {
'loose': true,
'modules': building ? false : 'commonjs'
}],
'react'
],
plugins: plugins
presets: [
['@babel/preset-env', {
'loose': true,
'modules': building ? false : 'commonjs'
}],
'@babel/preset-react'
],
plugins: plugins,
};
};
4 changes: 2 additions & 2 deletions tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const exec = (command, extraEnv) => {

console.log('Building CommonJS modules ...');

exec('babel src -d . --ignore __tests__,*.test.js', {
exec('babel src -d . --ignore __tests__,**/*.test.js', {
BABEL_ENV: 'cjs',
});

console.log('\nBuilding ES modules ...');

exec('babel src -d es --ignore __tests__,*.test.js', {
exec('babel src -d es --ignore __tests__,**/*.test.js', {
BABEL_ENV: 'es',
});

Expand Down
Loading

0 comments on commit 1b9e6b7

Please sign in to comment.