forked from IdentityModel/oidc-client-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (76 loc) · 2.06 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var gulp = require('gulp');
var webpackStream = require('webpack-stream');
var webpack = require('webpack');
var createWebpackConfig = require('./webpack.base');
// entry points for both configs
var npmEntry = './index.js';
var classicEntry = ['babel-polyfill', npmEntry];
// uglify plugin for minification
var uglifyPlugins = [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
screw_ie8: true,
},
})
];
// npm compliant build with source-maps
gulp.task('build-lib-sourcemap', function() {
// run webpack
gulp.src('index.js').pipe(webpackStream(createWebpackConfig({
entry: npmEntry,
output: {
filename: 'oidc-client.js',
libraryTarget: 'umd'
},
plugins: [],
devtool: 'inline-source-map'
})))
.pipe(gulp.dest('lib/'));
});
// npm compliant build without source-maps & minified
gulp.task('build-lib-min', function() {
// run webpack
gulp.src('index.js').pipe(webpackStream(createWebpackConfig({
entry: npmEntry,
output: {
filename: 'oidc-client.min.js',
libraryTarget: 'umd',
},
plugins: uglifyPlugins,
devtool: null
})))
.pipe(gulp.dest('lib/'));
});
// classic build with sourcemaps
gulp.task('build-dist-sourcemap', function() {
// run webpack
gulp.src('index.js').pipe(webpackStream(createWebpackConfig({
entry: classicEntry,
output: {
filename: 'oidc-client.js',
libraryTarget: 'var',
library: 'Oidc'
},
plugins: [],
devtool: 'inline-source-map'
})))
.pipe(gulp.dest('dist/'));
});
// classic build without sourcemaps & minified
gulp.task('build-dist-min', function() {
// run webpack
gulp.src('index.js').pipe(webpackStream(createWebpackConfig({
entry: classicEntry,
output: {
filename: 'oidc-client.min.js',
libraryTarget: 'var',
library: 'Oidc'
},
plugins: uglifyPlugins,
devtool: null
})))
.pipe(gulp.dest('dist/'));
});
// putting it all together
gulp.task('build', ['build-lib-sourcemap', 'build-lib-min', 'build-dist-sourcemap', 'build-dist-min']);