forked from dottgonzo/hostapdjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
60 lines (51 loc) · 1.73 KB
/
gulpfile.js
File metadata and controls
60 lines (51 loc) · 1.73 KB
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
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var ts = require('gulp-typescript');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var tsProject = ts.createProject('tsconfig.json');
var spawn = require('child_process').spawn;
var bump = require('gulp-bump');
var prompt = require('gulp-prompt');
var git = require('gulp-git');
gulp.task('quickpatch', ['pushPatch'], function (done) {
spawn('npm', ['publish'], { stdio: 'inherit' }).on('close', done);
});
gulp.task('bumpPatch', function () {
return gulp.src('./package.json').pipe(bump({
type: 'patch'
})).pipe(gulp.dest('./'));
});
gulp.task('Addbumped', ['bumpPatch'], function () {
return gulp.src('.').pipe(git.add({ args: '-A' }));
});
gulp.task('pushPatch', ['Addbumped'], function () {
return gulp.src('.').pipe(prompt.prompt({
type: 'input',
name: 'commit',
message: 'enter a commit msg, eg initial commit'
}, function (res) {
return gulp.src('.').pipe(git.commit(res.commit)).on('end', function () {
git.push()
});;
}));
});
gulp.task('test', function (done) {
return gulp.src('test/**/*.js', { read: false })
.pipe(mocha({ reporter: 'spec' }).on('error', function (err) {
throw err;
}).on('close', function () {
process.exit(-1);
}));
});
gulp.task('build', function () {
var tsResult = tsProject.src() // instead of gulp.src(...)
.pipe(sourcemaps.init()) // This means sourcemaps will be generated
.pipe(tsProject({
sortOutput: true,
}));
return tsResult
.pipe(sourcemaps.write()) // Now the sourcemaps are added to the .js file
.pipe(gulp.dest('.'));
});