-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
62 lines (56 loc) · 1.58 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
const eslint = require('gulp-eslint')
const gulp = require('gulp')
const log = require('fancy-log')
const sourcemaps = require('gulp-sourcemaps')
const mocha = require('gulp-mocha')
const ts = require('gulp-typescript')
const typedoc = require('gulp-typedoc')
gulp.task('readme', () => {
log('Generating documentation...')
return gulp.src(['src/**/*.ts']).pipe(
typedoc({
excludeExternals: true,
ignoreCompilerErrors: false,
includeDeclarations: true,
name: 'cso2-users-service',
out: './docs',
plugins: ['mdFlavour github'],
theme: 'markdown',
tsconfig: 'tsconfig.json',
version: true
})
)
})
gulp.task('eslint', () => {
log('Linting source code...')
return gulp
.src(['src/**/*.ts'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError())
})
gulp.task('typescript', () => {
log('Transpiling source code...')
const project = ts.createProject('tsconfig.json')
return project
.src()
.pipe(sourcemaps.init())
.pipe(project())
.pipe(
sourcemaps.write('.', {
includeContent: false,
sourceRoot: '../src'
})
)
.pipe(gulp.dest('dist'))
})
gulp.task('build', gulp.series('eslint', 'typescript'))
gulp.task('test', () => {
log('Testing code...')
return gulp.src('test/**/*.ts').pipe(
mocha({
require: 'ts-node/register'
})
)
})
gulp.task('default', gulp.series('typescript'))