-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
100 lines (93 loc) · 2.9 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
var gulp = require('gulp'),
sourcemaps = require("gulp-sourcemaps"),
rev = require('gulp-rev'),
inject = require('gulp-inject'),
babel = require("gulp-babel"),
concat = require("gulp-concat"),
gulpDocs = require('gulp-ngdocs'),
uglify = require('gulp-uglify'),
templateCache = require('gulp-angular-templatecache'),
addStream = require('add-stream'),
Server = require('karma').Server,
jshint = require('gulp-jshint'),
webserver = require('gulp-webserver'),
proxy = require('http-proxy-middleware');
gulp.task('lint', function() {
return gulp.src('eureka/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail', {'ignoreWarning': true}));
});
gulp.task('compile', ['lint'], function () {
var target = gulp.src('./index.html');
var sources = gulp.src(['eureka/**/module.js', 'eureka/**/*.js', '!eureka/**/*-spec.js'])
.pipe(sourcemaps.init())
.pipe(addStream.obj(gulp.src('eureka/**/*.html')
.pipe(templateCache('templates.js', {module: 'eureka', root: 'eureka/'}))))
.pipe(babel({presets: ['es2015']}))
.pipe(concat('app.js'))
.pipe(rev())
.pipe(uglify())
.pipe(sourcemaps.write('.'))
.pipe(addStream.obj(gulp.src('assets/**/*', { "base" : "." })))
.pipe(addStream.obj(gulp.src('config.json')))
.pipe(gulp.dest('target'));
return target.pipe(inject(sources,{ignorePath: '/target/', relative: true}))
.pipe(gulp.dest('./target'));
});
gulp.task('test', ['compile'], function (done) {
return new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('ngdocs', function () {
var options = {
title: 'Eureka! Clinical Analytics Web Client Documentation',
html5Mode: false
};
return gulp.src(['eureka/**/module.js', 'eureka/**/*.js', '!eureka/**/*-spec.js'])
.pipe(gulpDocs.process(options))
.pipe(gulp.dest('./ng-docs'));
});
gulp.task('webserver', function () {
gulp.src('target')
.pipe(webserver({
open: true,
https: {
key: 'pki/key.pem',
cert: 'pki/cert.pem'
},
middleware: [
proxy('/eurekaclinical-analytics-webapp', {
target: 'https://localhost:8443',
secure: false
}),
proxy('/eurekaclinical-analytics-service', {
target: 'https://localhost:8443',
secure: false
}),
proxy('/eurekaclinical-phenotype-service', {
target: 'https://localhost:8443',
secure: false
}),
proxy('/eurekaclinical-protempa-service', {
target: 'https://localhost:8443',
secure: false
}),
proxy('/cas-mock', {
target: 'https://localhost:8443',
secure: false
}),
proxy('/eurekaclinical-user-webapp', {
target: 'https://localhost:8443',
secure: false
}),
proxy('/eurekaclinical-user-service', {
target: 'https://localhost:8443',
secure: false
})
]
}));
});
gulp.task('default', ['ngdocs', 'test']);