forked from nonplus/angular-ui-router-uib-modal
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
116 lines (102 loc) · 2.71 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
// dependencies
var gulp = require('gulp');
var git = require('gulp-git');
var bump = require('gulp-bump');
var filter = require('gulp-filter');
var tag_version = require('gulp-tag-version');
var tslint = require("gulp-tslint");
var runSequence = require('run-sequence');
var wrap = require("gulp-wrap");
var gutil = require('gulp-util');
var serve = require('gulp-serve');
var files = require('./files.conf');
var testFiles = [].concat(files.libs, files.src, files.test);
var port = 8083;
gulp.task('bump-version', function () {
return gulp.src(['./bower.json', './package.json'])
.pipe(bump({type: "patch"}).on('error', gutil.log))
.pipe(gulp.dest('./'));
});
gulp.task('commit-changes', ['test'], function () {
return gulp.src('.')
.pipe(git.commit('Bumped version number', {args: '-a'}));
});
gulp.task('tag-version', function() {
return gulp.src('package.json')
.pipe(tag_version());
});
gulp.task('push-changes', function (cb) {
git.push('origin', 'master', cb);
});
gulp.task('release', ['ts-compile', 'test'], function (callback) {
runSequence(
'bump-version',
'build',
'commit-changes',
'tag-version',
function (error) {
if (error) {
console.log(error.message);
} else {
console.log('RELEASE FINISHED SUCCESSFULLY');
}
callback(error);
});
});
gulp.task('tag-version', function() {
return gulp.src('./package.json')
.pipe(tag_version());
});
gulp.task('build', ['ts-compile'], function() {
return gulp.src("src/angular-ui-router-uib-modal.js")
.pipe(wrap({ src: './build.txt' }, { info: require('./package.json') }))
.pipe(gulp.dest('.'));
});
gulp.task('ts-compile', function() {
var ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json');
return tsProject.src(['src/**/*.ts', 'test/**/*.ts'])
.pipe(tsProject()).js
.pipe(gulp.dest('.'));
});
gulp.task('serve', serve({
root: __dirname,
port: port,
middleware: function(req, resp, next) {
console.log(req.originalUrl);
if(req.originalUrl == '/') {
resp.statusCode = 302;
resp.setHeader('Location', '/sample/');
resp.setHeader('Content-Length', '0');
resp.end();
} else {
next();
}
}
}));
gulp.task('demo', ['serve'], function() {
require('open')('http://localhost:' + port);
});
gulp.task('test', ['lint'], function (done) {
var Server = require('karma').Server;
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true
}, done).start();
});
gulp.task('watch', function (done) {
var Server = require('karma').Server;
new Server({
configFile: __dirname + '/karma.conf.js'
}, done).start();
});
gulp.task('lint', function () {
return gulp.src([
"./src/**/*.ts",
"./test/**/*.ts"
])
.pipe(tslint({
formatter: "verbose"
}))
.pipe(tslint.report());
});