-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
74 lines (61 loc) · 1.92 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
const path = require('path');
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const excludeGitignore = require('gulp-exclude-gitignore');
const ts = require('gulp-typescript');
const del = require('del');
const ghPages = require('gulp-gh-pages');
const jsdoc = require('gulp-jsdoc3');
const tsProject = ts.createProject('tsconfig.main.json');
const tsDocsProject = ts.createProject('tsconfig.docs.json');
gulp.task('clean:dist', function (done) {
del.sync(['dist/**']);
done();
});
gulp.task('clean:doc', function (done) {
del.sync(['doc/.circleci']);
del.sync(['doc/**']);
del.sync(['es6/**']);
done();
});
gulp.task('clean:jsii', function (done) {
del.sync(['lib/**/*.js', 'lib/**/*.d.ts']);
done();
});
gulp.task('static', function () {
return gulp.src('**/*.ts')
.pipe(excludeGitignore())
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('watch', function () {
gulp.watch(['lib/**/*.js', 'test/**'], ['test']);
});
gulp.task('compile', function () {
return tsProject.src()
.pipe(tsProject())
.pipe(gulp.dest('lib'));
});
gulp.task('compile:docs', function () {
return tsDocsProject.src()
.pipe(tsDocsProject())
.pipe(gulp.dest('es6'));
});
gulp.task('prepublish', gulp.series('clean:dist', 'clean:jsii', 'static', 'compile'));
gulp.task('jsdoc', gulp.series('clean:doc', 'compile:docs', function (done) {
const config = require('./jsdoc.json');
gulp.src(['README.md', './es6/**/*.js'], {read: false})
.pipe(jsdoc(config, done));
}));
gulp.task('copy-circleci-config', function() {
return gulp.src('./.circleci/config.yml')
.pipe(gulp.dest('./doc/.circleci'));
});
gulp.task('ghPages', function() {
return gulp.src(['./doc/**/*', './doc/.*/*'])
.pipe(ghPages({
remoteUrl: 'git@github.com:kollavarsham/kollavarsham-js.git'
}));
});
gulp.task('deployDoc', gulp.series('jsdoc', 'copy-circleci-config', 'ghPages'));