-
Notifications
You must be signed in to change notification settings - Fork 16
/
gulpfile.js
54 lines (46 loc) · 1.39 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
var gulp = require('gulp');
var ts = require('gulp-typescript');
var uglify = require('gulp-uglify');
var tsProject = ts.createProject("tsconfig.json");
var concat = require('gulp-concat');
var pump = require('pump');
var watch = require('gulp-watch');
var rename = require('gulp-rename');
var gulpSequence = require('gulp-sequence');
const headerComment = require('gulp-header-comment');
gulp.task('ts', function () {
gulp.src('src/**/*.ts')
.pipe(tsProject())
.pipe(concat('scheme-designer.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('all', function (cb) {
gulpSequence('ts', 'compress', cb)
});
gulp.task('compress', function(cb) {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd
}
if (mm < 10) {
mm = '0' + mm
}
pump([
gulp.src('dist/scheme-designer.js'),
rename({suffix: '.min'}),
uglify(),
headerComment('https://github.com/NikitchenkoSergey/scheme-designer \
Generated on ' + (mm + '/' + dd + '/' + yyyy) + '\
Author: Nikitchenko Sergey <[email protected]>'),
gulp.dest('dist')
],
cb
);
});
gulp.task('watch', function () {
gulp.watch('src/**/*.ts', ['all']);
});
gulp.task('default', ['watch']);