Skip to content

Commit

Permalink
Add support umd
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantin committed Sep 6, 2015
1 parent 83b8235 commit 26898c4
Show file tree
Hide file tree
Showing 7 changed files with 1,441 additions and 654 deletions.
File renamed without changes.
20 changes: 15 additions & 5 deletions config/webpack-config-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var coverage = [{
exclude: /test|node_modules/,
loader: 'istanbul-instrumenter'
}];
var generateConf = function (postLoader) {
var generateConf = function (config) {
return {
resolve: {
root: [
Expand All @@ -16,7 +16,9 @@ var generateConf = function (postLoader) {
],
extensions: ['', '.js', '.json']
},
devtool: 'inline-source-map',
entry: config.entry || './',
output: config.output,
devtool: config.devtool || '',
module: {
loaders: [
{test: /\.css$/, loader: 'css-loader'},
Expand All @@ -26,7 +28,7 @@ var generateConf = function (postLoader) {
loader: 'babel-loader'
}
],
postLoaders: postLoader
postLoaders: config.postLoader || []
},
debug: false,
stats: {
Expand All @@ -38,6 +40,14 @@ var generateConf = function (postLoader) {
};

module.exports = {
coverage: generateConf(coverage),
default: generateConf([])
coverage: generateConf({postLoader: coverage, devtool: 'inline-source-map'}),
default: generateConf({}),
prod: generateConf({
output: {
libraryTarget: 'umd',
library: 'Tooltip',
filename: 'tooltip.js',
entry: './src/tooltip',
}
})
};
3 changes: 3 additions & 0 deletions config/webpack.conf.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var config = require('./webpack-config-creator').prod;

module.exports = require('./webpack-config-creator').prod;
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "tau-tooltip",
"version": "1.0.0",
"version": "1.1.0",
"description": "Pure JavaScript tooltip library",
"main": "tooltip.js",
"scripts": {
"test": "karma start config/karma.conf.js",
"localTest": "karma start config/karma.dev.conf.js"
"test": "karma start config/karma.conf.ci.js",
"localTest": "karma start config/karma.dev.conf.js",
"build":"webpack --config=config/webpack.conf.prod.js"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 26898c4

Please sign in to comment.