Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Add umd:min and es6 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
vaiRk committed Feb 13, 2016
1 parent 81c5ed8 commit 505224f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
"version": "2.0.0",
"author": "Viky Guerra <[email protected]>",
"description": "Responsive utility wrapper for Facebook's Fixed-Data-Table",
"main": "./lib/responsive-fixed-data-table.js",
"main": "lib/responsive-fixed-data-table.js",
"jsnext:main": "lib/responsive-fixed-data-table.es.js",
"files": [
"lib",
"src"
],
"repository": {
"type": "git",
"url": "https://github.com/vaiRk/responsive-fixed-data-table"
Expand Down Expand Up @@ -44,6 +49,7 @@
"karma-jasmine": "^0.3.7",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.7.0",
"ncp": "^2.0.0",
"react": "^0.14.7",
"react-addons-test-utils": "^0.14.7",
"react-dom": "^0.14.7",
Expand All @@ -52,7 +58,10 @@
},
"scripts": {
"prebuild": "rimraf lib",
"build": "cross-env BABEL_ENV=umd webpack",
"build": "npm run build:umd && npm run build:umd:min && npm run build:es",
"build:umd": "cross-env BABEL_ENV=umd webpack",
"build:umd:min": "cross-env BABEL_ENV=umd NODE_ENV=production webpack",
"build:es": "ncp src/responsive-fixed-data-table.js lib/responsive-fixed-data-table.es.js",
"prepublish": "npm run build",
"test": "./node_modules/karma/bin/karma start test/karma.conf.js",
"test:debug": "./node_modules/karma/bin/karma start test/karma.conf.js --no-single-run --auto-watch --log-level debug"
Expand Down
41 changes: 22 additions & 19 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,35 @@
var webpack = require('webpack');
var path = require('path');

var minify = process.env.NODE_ENV === 'production';
var plugins = [
new webpack.optimize.OccurenceOrderPlugin()
];

if (minify) {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
comments: false,
compress: {
warnings: false,
screw_ie8: true,
dead_code: true,
drop_debugger: true,
drop_console: true
}
})
);
}

module.exports = {
context: __dirname,
entry: path.resolve(__dirname, 'src', 'responsive-fixed-data-table.js'),
output: {
path: path.resolve(__dirname, 'lib'),
filename: 'responsive-fixed-data-table.js',
sourceMapFileName: '[file].map',
filename: 'responsive-fixed-data-table' + (minify ? '.min.js' : '.js'),
library: 'ResponsiveFixedDataTable',
libraryTarget: 'umd'
},
devtool: 'source-map',
externals: {
react: {
root: 'React',
Expand Down Expand Up @@ -42,20 +60,5 @@ module.exports = {
{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel' }
]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
comments: false,
compress: {
warnings: false,
screw_ie8: true,
dead_code: true,
drop_debugger: true,
drop_console: true
}
})
]
plugins: plugins
}

0 comments on commit 505224f

Please sign in to comment.