Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup #632

Merged
merged 4 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
{
"presets": [
"react",
"env"
["env", { "modules": false }]
],
"plugins": [
"transform-export-extensions",
"transform-class-properties",
"transform-object-rest-spread",
[
"transform-react-remove-prop-types",
{
"mode": "wrap"
}
]
]
}
"transform-object-rest-spread"
],
"env": {
"cjs": {
"plugins": [
"transform-es2015-modules-commonjs",
["transform-react-remove-prop-types", { "mode": "wrap" }]
]
},
"test": {
"plugins": [
"transform-es2015-modules-commonjs",
["transform-react-remove-prop-types", { "mode": "wrap" }]
]
}
}
}
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"check": "npm run lint && npm run dtslint && npm run test",
"prerelease": "npm run check && npm run build",
"build": "rimraf lib && npm run build:node && npm run build:production && npm run build:development",
"build:node": "babel ./src -d ./lib/src --source-maps && npm run build:css",
"build:development": "cross-env NODE_ENV=development webpack",
"build:production": "cross-env NODE_ENV=production webpack -p",
"build:node": "cross-env NODE_ENV=cjs babel ./src -d ./lib/src --source-maps && npm run build:css",
"build:development": "cross-env NODE_ENV=development rollup -c",
"build:production": "cross-env NODE_ENV=production rollup -c",
"build:css": "postcss src/style.css --use autoprefixer -d lib/ --no-map"
},
"repository": {
Expand Down Expand Up @@ -59,11 +59,12 @@
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"babel-eslint": "8.1.2",
"babel-loader": "7.1.2",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-class-properties": "6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-export-extensions": "6.22.0",
"babel-plugin-transform-object-rest-spread": "6.26.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.12",
"babel-plugin-transform-react-remove-prop-types": "0.4.13",
"babel-preset-env": "1.6.1",
"babel-preset-react": "6.24.1",
"babel-preset-stage-1": "6.24.1",
Expand All @@ -87,16 +88,18 @@
"jest-enzyme": "4.0.2",
"jest-junit-reporter": "1.1.0",
"moment": "2.20.1",
"null-loader": "0.1.1",
"postcss-cli": "4.1.1",
"prettier": "1.9.2",
"raf": "3.4.0",
"react": "16.2.0",
"react-dom": "16.2.0",
"react-test-renderer": "16.2.0",
"rimraf": "2.6.2",
"typescript": "2.6.2",
"webpack": "3.10.0"
"rollup": "^0.56.2",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-uglify": "^3.0.0",
"typescript": "2.6.2"
},
"dependencies": {
"prop-types": "^15.6.0"
Expand Down
31 changes: 31 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import babel from 'rollup-plugin-babel';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';

const isProduction = process.env.NODE_ENV === 'production';

export default {
input: './src/index.js',
output: {
file: `lib/daypicker${isProduction ? '.min' : ''}.js`,
sourcemap: true,
format: 'umd',
name: 'DayPicker',
globals: {
react: 'React',
},
},
external: ['react'],
plugins: [
babel({
plugins: [
'external-helpers',
['transform-react-remove-prop-types', { removeImport: true }],
],
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
isProduction ? uglify() : {},
],
};
Loading