UNPKG

1.77 kBJavaScriptView Raw
1'use strict';
2var gulp = require('gulp');
3var mocha = require('gulp-mocha');
4var ts = require('gulp-typescript');
5var concat = require('gulp-concat');
6var sourcemaps = require('gulp-sourcemaps');
7var tsProject = ts.createProject('tsconfig.json');
8var spawn = require('child_process').spawn;
9var bump = require('gulp-bump');
10
11var prompt = require('gulp-prompt');
12var git = require('gulp-git');
13
14gulp.task('quickpatch', ['pushPatch'], function (done) {
15 spawn('npm', ['publish'], { stdio: 'inherit' }).on('close', done);
16});
17
18gulp.task('bumpPatch', function () {
19 return gulp.src('./package.json').pipe(bump({
20 type: 'patch'
21 })).pipe(gulp.dest('./'));
22});
23
24
25gulp.task('Addbumped', ['bumpPatch'], function () {
26 return gulp.src('.').pipe(git.add({ args: '-A' }));
27});
28gulp.task('pushPatch', ['Addbumped'], function () {
29 return gulp.src('.').pipe(prompt.prompt({
30 type: 'input',
31 name: 'commit',
32 message: 'enter a commit msg, eg initial commit'
33 }, function (res) {
34 return gulp.src('.').pipe(git.commit(res.commit)).on('end', function () {
35 git.push()
36 });;
37 }));
38});
39
40gulp.task('test', function (done) {
41 return gulp.src('test/**/*.js', { read: false })
42 .pipe(mocha({ reporter: 'spec' }).on('error', function (err) {
43 throw err;
44 }).on('close', function () {
45 process.exit(-1);
46 }));
47});
48
49gulp.task('build', function () {
50 var tsResult = tsProject.src() // instead of gulp.src(...)
51 .pipe(sourcemaps.init()) // This means sourcemaps will be generated
52
53 .pipe(ts(tsProject, {
54 sortOutput: true,
55 }));
56
57 return tsResult
58 .pipe(sourcemaps.write()) // Now the sourcemaps are added to the .js file
59 .pipe(gulp.dest('.'));
60});
\No newline at end of file