Skip to content

Commit

Permalink
Provide umd target building pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
artkravchenko committed Oct 21, 2017
1 parent 1a54225 commit ecd5678
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
lib
coverage
.nyc_output
coverage
dist
lib
node_modules

npm-debug.log
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "lib/index.js",
"scripts": {
"clean": "rm -rf lib .nyc_output coverage",
"build": "babel src --loose --out-dir lib",
"build": "run-p build:lib build:umd",
"build:lib": "babel src --loose --out-dir lib",
"build:umd": "webpack --config webpack/umd.config.js",
"test": "cross-env NODE_ENV=test mocha",
"test:cover": "cross-env NODE_ENV=test nyc mocha",
"coverage": "cross-env NODE_ENV=test nyc report --reporter=text-lcov | coveralls",
Expand Down Expand Up @@ -39,12 +41,15 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-istanbul": "^4.1.5",
"babel-preset-es2015": "^6.24.1",
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"cross-env": "^5.1.0",
"mocha": "^4.0.1",
"nyc": "^11.2.1"
"npm-run-all": "^4.1.1",
"nyc": "^11.2.1",
"webpack": "^3.8.1"
}
}
40 changes: 40 additions & 0 deletions webpack/base.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const path = require('path');
const webpack = require('webpack');

const context = path.resolve(__dirname, '..');

module.exports = {
context: context,
entry: './src/index.js',
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true,
warnings: false,
},
sourceMap: false,
output: {
comments: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
})
],
resolve: {
extensions: ['.js']
}
};
11 changes: 11 additions & 0 deletions webpack/umd.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path');
const baseConfig = require('./base.config.js');

module.exports = Object.assign({}, baseConfig, {
output: {
path: path.join(baseConfig.context, 'dist'),
filename: 't8on.min.js',
library: 't8on',
libraryTarget: 'umd'
}
});

0 comments on commit ecd5678

Please sign in to comment.