This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathgulpfile.js
72 lines (64 loc) · 2.34 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
var gulp = require("gulp");
var ts = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var tslint = require("gulp-tslint");
var minify = require('gulp-minify');
var git = require('gulp-git');
var versionBump = require('gulp-bump')
var tagVersion = require('gulp-tag-version');
var webpack = require('webpack-stream');
gulp.task("build_ES5", function() {
return gulp.src([
"src/**/*.ts",
"Speech.Browser.Sdk.ts"],
{base: '.'})
.pipe(tslint({
formatter: "prose",
configuration: "tslint.json"
}))
.pipe(tslint.report({
summarizeFailureOutput: true
}))
.pipe(sourcemaps.init())
.pipe(ts({
target: "ES5",
declaration: true,
noImplicitAny: true,
removeComments: false,
outDir: 'distrib'
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('distrib'));
});
gulp.task("build", gulp.series("build_ES5"));
gulp.task("bundle", gulp.series("build_ES5", function () {
return gulp.src('samples/browser/sample_app.js')
.pipe(webpack({
output: {filename: 'speech.sdk.bundle.js'},
devtool: 'source-map',
module: {
rules: [{
enforce: 'pre',
test: /\.js$/,
loader: "source-map-loader"
}]
}
}))
.pipe(gulp.dest('distrib'));
}));
// We don't want to release anything without a successful build. So build task is dependency for these tasks.
gulp.task('patchRelease', gulp.series('build', function() { return BumpVersionTagAndCommit('patch'); }))
gulp.task('featureRelease', gulp.series('build', function() { return BumpVersionTagAndCommit('minor'); }))
gulp.task('majorRelease', gulp.series('build', function() { return BumpVersionTagAndCommit('major'); }))
gulp.task('preRelease', gulp.series('build', function() { return BumpVersionTagAndCommit('prerelease'); }))
function BumpVersionTagAndCommit(versionType) {
return gulp.src(['./package.json'])
// bump the version number
.pipe(versionBump({type:versionType}))
// save it back to filesystem
.pipe(gulp.dest('./'))
// commit the changed version number
.pipe(git.commit('Bumping package version'))
// tag it in the repository
.pipe(tagVersion());
}