forked from IdentityModel/oidc-client-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
146 lines (132 loc) · 4.18 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
var gulp = require('gulp');
var concat = require('gulp-concat');
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', ['jsrsasign'], function() {
// run webpack
return 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', ['jsrsasign'], function() {
// run webpack
return 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', ['jsrsasign'], function() {
// run webpack
return 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', ['jsrsasign'], function() {
// run webpack
return 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/'));
});
// this is used to manually build jsrsasign with the fewest modules to reduce its size
var files = [
'jsrsasign/header.js'
,'jsrsasign/ext/yahoo-min.js'
,'jsrsasign/ext/cj/cryptojs-312-core-fix-min.js'
,'jsrsasign/ext/cj/x64-core_min.js'
// ,'jsrsasign/ext/cj/cipher-core_min.js'
// ,'jsrsasign/ext/cj/aes_min.js'
// ,'jsrsasign/ext/cj/tripledes_min.js'
,'jsrsasign/ext/cj/enc-base64_min.js'
// ,'jsrsasign/ext/cj/md5_min.js'
// ,'jsrsasign/ext/cj/sha1_min.js'
,'jsrsasign/ext/cj/sha256_min.js'
// ,'jsrsasign/ext/cj/sha224_min.js'
,'jsrsasign/ext/cj/sha512_min.js'
,'jsrsasign/ext/cj/sha384_min.js'
// ,'jsrsasign/ext/cj/ripemd160_min.js'
// ,'jsrsasign/ext/cj/hmac_min.js'
// ,'jsrsasign/ext/cj/pbkdf2_min.js'
,'jsrsasign/ext/base64-min.js'
,'jsrsasign/ext/jsbn-min.js'
,'jsrsasign/ext/jsbn2-min.js'
,'jsrsasign/ext/prng4-min.js'
,'jsrsasign/ext/rng-min.js'
,'jsrsasign/ext/rsa-min.js'
// ,'jsrsasign/ext/rsa2-min.js'
,'jsrsasign/ext/ec-min.js'
// ,'jsrsasign/ext/ec-patch-min.js'
,'jsrsasign/ext/json-sans-eval-min.js'
,'jsrsasign/min/asn1-1.0.min.js'
,'jsrsasign/min/asn1hex-1.1.min.js'
,'jsrsasign/min/asn1x509-1.0.min.js'
// ,'jsrsasign/min/asn1cms-1.0.min.js'
// ,'jsrsasign/min/asn1tsp-1.0.min.js'
// ,'jsrsasign/min/asn1cades-1.0.min.js'
// ,'jsrsasign/min/asn1csr-1.0.min.js'
// ,'jsrsasign/min/asn1ocsp-1.0.min.js'
,'jsrsasign/min/base64x-1.1.min.js'
,'jsrsasign/min/crypto-1.1.min.js'
,'jsrsasign/min/ecdsa-modified-1.0.min.js'
,'jsrsasign/min/ecparam-1.0.min.js'
// ,'jsrsasign/min/dsa-2.0.min.js'
,'jsrsasign/min/keyutil-1.0.min.js'
,'jsrsasign/min/rsapem-1.1.min.js'
,'jsrsasign/min/rsasign-1.2.min.js'
,'jsrsasign/min/x509-1.1.min.js'
,'jsrsasign/min/jws-3.3.min.js'
// ,'jsrsasign/min/jwsjs-2.0.min.js'
,'jsrsasign/footer.js'
];
gulp.task('jsrsasign', function () {
return gulp.src(files)
.pipe(concat('jsrsasign.js'))
.pipe(gulp.dest('jsrsasign/dist/'));
});
// putting it all together
gulp.task('build', ['build-lib-sourcemap','build-lib-min','build-dist-sourcemap','build-dist-min']);