-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
61 lines (46 loc) · 1.58 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
var gulp = require('gulp');
var bower = require('gulp-bower');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var typescript = require('gulp-typescript');
var runSequence = require('run-sequence');
var del = require('del');
var request = require('request');
var fs = require('fs');
var nuget = require('gulp-nuget');
gulp.task('clean', function () {
del.sync(['dist/*.*']);
});
gulp.task('bower-restore', function () {
return bower();
});
gulp.task('typescript-build', function () {
var tsProject = typescript.createProject('tsconfig.json', { declarationFiles : true } );
var tsResult = tsProject.src()
.pipe(typescript(tsProject));
return tsResult.js.pipe(gulp.dest('dist'));
});
gulp.task('minify', function() {
return gulp.src('dist/dfz-angular-uiextensions.js')
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('dist'));
});
gulp.task('nuget-download', function(done) {
if(fs.existsSync('nuget.exe')) {
done();
return;
}
request.get('http://nuget.org/nuget.exe')
.pipe(fs.createWriteStream('nuget.exe'))
.on('close', done);
});
gulp.task('nuget-pack-n-push', function() {
var nugetPath = 'nuget.exe';
gulp.src('dist/*.js')
.pipe(nuget.pack({ nuspec: 'Package.nuspec', nuget: nugetPath }))
.pipe(nuget.push({ feed: 'http://nuget.defriesland.nl/nuget/DFZ', nuget: nugetPath, apiKey: 'dfz-vm307:dfz-vm307' }));
});
gulp.task('default', function () {
runSequence('clean', 'bower-restore', 'typescript-build', 'minify','nuget-download','nuget-pack-n-push');
});