forked from benbaran/adal-angular4
-
Notifications
You must be signed in to change notification settings - Fork 19
/
gulpfile.js
103 lines (81 loc) · 2.42 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
var bump = require('gulp-bump'),
del = require('del'),
exec = require('child_process').exec,
gulp = require('gulp'),
merge = require('merge2'),
typescript = require('gulp-typescript'),
fs = require('fs');
gulp.task('clean', function () {
del(['dist/*']);
});
gulp.task('bump', ['clean'], function () {
gulp.src('./package.json')
.pipe(bump({
type: 'patch'
}))
.pipe(gulp.dest('./'));
});
gulp.task('bundle', ['bump'], function () {
var tsResult = gulp.src('src/*.ts')
.pipe(typescript({
module: "commonjs",
target: "es5",
noImplicitAny: true,
experimentalDecorators: true,
outDir: "dist/",
rootDir: "src/",
sourceMap: true,
declaration: true,
moduleResolution: "node",
removeComments: false,
lib: [
"es2015",
"dom"
],
types: ["jasmine"]
}));
return merge([
tsResult.dts.pipe(gulp.dest('dist/')),
tsResult.js.pipe(gulp.dest('dist/'))
]);
});
gulp.task('copy', ['bundle'], () => {
gulp.src(['src/adal-angular.d.ts', 'README.md', 'LICENSE'])
.pipe(gulp.dest('dist/'));
});
gulp.task('package', ['copy'], () => {
const pkgjson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
delete pkgjson.scripts;
delete pkgjson.devDependencies;
const filepath = './dist/package.json';
fs.writeFileSync(filepath, JSON.stringify(pkgjson, null, 2), 'utf-8');
});
gulp.task('git-add', ['package'], function (cb) {
exec('git add -A', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('git-commit', ['git-add'], function (cb) {
var package = require('./package.json');
exec('git commit -m "Version ' + package.version + ' release."', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('git-push', ['git-commit'], function (cb) {
exec('git push', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('publish', ['git-push'], function (cb) {
exec('npm publish ./dist', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
});