Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
fix warning on rollup build
Browse files Browse the repository at this point in the history
  • Loading branch information
lemes committed Feb 1, 2018
1 parent 890756e commit 6511de1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"env": {
"browser": true,
"node": false,
"jest": true
},
"extends": ["airbnb", "plugin:jest/recommended", "prettier"],
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rollup.config.js
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"name": "redux-shelf",
"version": "0.0.1",
"main": "index.js",
"description":
"Helper reducers and actions to take away your boilerplate code from both Data and Communication state types",
"scripts": {
"format": "prettier --write {src,test}/**/*.js",
"precommit": "pretty-quick --staged",
Expand All @@ -18,7 +20,10 @@
"build":
"npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:umd:min"
},
"repository": "https://github.com/lemes/redux-shelf.git",
"repository": {
"type": "git",
"url": "https://github.com/lemes/redux-shelf.git"
},
"authors": [
"Guilherme Popolin (https://github.com/guilhermespopolin)",
"Rener Baffa (https://github.com/renerbaffa)",
Expand All @@ -31,6 +36,7 @@
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-jest": "^22.1.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
Expand Down
32 changes: 18 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
/* global process */
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';

const env = process.env.NODE_ENV;
const babelcfg = babel({ exclude: 'node_modules/**' });
const config = {
input: 'src/index.js',
plugins: [],
};

if (env === 'es' || env === 'cjs') {
config.output = { format: env };
config.plugins.push(babelcfg);
config.plugins.push(
babel({
plugins: ['external-helpers'],
})
);
}

if (env === 'development' || env === 'production') {
config.output = { format: 'umd' };
config.name = 'Redux Shelf';
config.plugins.push(babel({ exclude: 'node_modules/**' }));
config.plugins.push(
babel({ exclude: 'node_modules/**', plugins: ['external-helpers'] })
);
}

if (env === 'production') {
const uglifyConfig = uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
});
config.plugins.push(uglifyConfig);
config.plugins.push(babelcfg);
config.plugins.push(
uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false,
},
})
);
}

export default config;
6 changes: 6 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ babel-plugin-check-es2015-constants@^6.22.0:
dependencies:
babel-runtime "^6.22.0"

babel-plugin-external-helpers@^6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-external-helpers/-/babel-plugin-external-helpers-6.22.0.tgz#2285f48b02bd5dede85175caf8c62e86adccefa1"
dependencies:
babel-runtime "^6.22.0"

babel-plugin-istanbul@^4.1.5:
version "4.1.5"
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz#6760cdd977f411d3e175bb064f2bc327d99b2b6e"
Expand Down

0 comments on commit 6511de1

Please sign in to comment.