forked from microsoftarchive/botauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (49 loc) · 1.72 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
var gulp = require("gulp");
var ts = require("gulp-typescript");
var run = require("gulp-run");
var merge = require('merge-stream');
var fs = require('fs');
var path = require("path");
function getFolders(dir) {
return fs.readdirSync(dir)
.filter(function(file) {
return fs.statSync(path.join(dir, file)).isDirectory();
});
}
var tsProject = ts.createProject("tsconfig.json");
gulp.task("default", ['build'], function () {
});
gulp.task("dev", ['build'], function(){
gulp.watch(['src/**/*.ts', 'locale/**/*.json'], ['update-examples-dev']);
});
gulp.task('build', function() {
return tsProject.src()
.pipe(tsProject())
.js.pipe(gulp.dest("lib"));
});
gulp.task('version-dev', ['build'], function(){
return run('npm version prerelease -f').exec();
});
gulp.task('publish-dev', ['version-dev'], function(){
return run('npm publish --tag next').exec();
});
gulp.task('update-examples-dev', ['publish-dev'], function(callback){
var folders = getFolders('examples');
var tasks = folders.map(function(folder){
return run('npm install --save botauth@next', { cwd: path.join(__dirname, 'examples', folder)}).exec();
});
return merge(tasks);
});
gulp.task('version', ['build'], function(){
return run('npm version patch').exec();
});
gulp.task('publish', ['version'], function(){
return run('npm publish').exec();
});
gulp.task('update-examples', ['publish'], function(callback){
var folders = getFolders('examples');
var tasks = folders.map(function(folder){
return run('npm install --save botauth@*', { cwd: path.join(__dirname, 'examples', folder)}).exec();
});
return merge(tasks);
});