-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
65 lines (55 loc) · 1.74 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
const gulp = require('gulp');
const concat = require('gulp-concat');
const argv = require('yargs').argv;
const shelljs = require('shelljs');
const del = require('del');
const gulpSequence = require('gulp-sequence');
gulp.task('build', (cb) => {
const target = argv.t || argv.target || 'dev';
const buildCmd = (target === 'prod' || target === 'production') ?
'ng build --prod --aot --build-optimizer --output-hashing=none' :
'ng build --output-hashing=none';
const result = shelljs.exec(buildCmd);
if (result.code) {
console.log(result.stderr);
process.exit(1);
}
if (target === 'prod' || target === 'production') {
gulpSequence('prod-concat', 'prod-demo', 'prod-clean', cb)
}
});
gulp.task('prod-concat', () => {
return gulp.src([
'./dist/ng-auth-oidc/runtime.js',
'./dist/ng-auth-oidc/polyfills.js',
'./dist/ng-auth-oidc/main.js'
])
.pipe(concat('ng-auth-oidc.min.js'))
.pipe(gulp.dest('./dist/ng-auth-oidc/assets'));
});
gulp.task('prod-clean', () => {
return del([
'./dist/ng-auth-oidc/runtime.js',
'./dist/ng-auth-oidc/polyfills.js',
'./dist/ng-auth-oidc/main.js',
'./dist/ng-auth-oidc/styles.js',
'./dist/ng-auth-oidc/styles.css',
'./dist/ng-auth-oidc/*.html',
'./demo/main.html'
]);
});
gulp.task('prod-demo-html', () => {
return gulp.src('./dist/ng-auth-oidc/*.html')
.pipe(gulp.dest('./demo'));
});
gulp.task('prod-demo-config', () => {
return gulp.src('./src/templates/auth-oidc-config-template.js')
.pipe(gulp.dest('./demo/assets'));
});
gulp.task('prod-demo-assets', () => {
return gulp.src('./dist/ng-auth-oidc/assets/**/*')
.pipe(gulp.dest('./demo/assets'));
});
gulp.task('prod-demo', (cb) => {
gulpSequence(['prod-demo-html', 'prod-demo-config', 'prod-demo-assets'], cb)
});