forked from aaronhuggins/sf-composite-call
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
72 lines (53 loc) · 1.64 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
const fs = require('fs')
const gulp = require('gulp')
const shell = require('gulp-shell')
const zip = require('gulp-zip')
const pkg = require('./package.json')
gulp.task('mkdir', async done => {
if (!fs.existsSync('coverage')) {
fs.mkdirSync('coverage')
}
return done()
})
gulp.task('clean:dist', shell.task(['del-cli ./dist']))
gulp.task('clean:index', shell.task(['del-cli ./index.js ./index.d.ts']))
gulp.task('clean', gulp.parallel('clean:dist', 'clean:index'))
gulp.task('compile', shell.task(['tsc', 'webpack']))
gulp.task(
'compile:docs',
shell.task([
'jsdoc2md --no-cache --files ./src/*.ts --configure ./jsdoc2md.json > ./docs/API.md'
])
)
gulp.task('release:js', shell.task(['npm pack']))
gulp.task('release:ts', async done => {
gulp
.src(['src/**', 'index.ts', 'LICENSE', 'README.md', 'package.json'], {
base: '.'
})
.pipe(zip(`${pkg.name}-${pkg.version}-ts.zip`))
.pipe(gulp.dest('./'))
done()
})
gulp.task('release', gulp.parallel('release:js', 'release:ts'))
gulp.task('mocha', shell.task(['mocha']))
gulp.task('mocha:coverage', shell.task(['nyc mocha']))
gulp.task(
'mocha:xunit',
shell.task([
'nyc mocha --reporter=xunit --reporter-options output=./coverage/mocha.xml'
])
)
gulp.task('eslint', shell.task(['eslint --ext .ts .']))
gulp.task('eslint:fix', shell.task(['eslint --ext .ts --fix .']))
gulp.task(
'eslint:xunit',
shell.task(['eslint --format junit --ext .ts . > ./coverage/eslint.xml'], {
ignoreErrors: true
})
)
gulp.task(
'test',
gulp.parallel(gulp.series('mkdir', 'eslint:xunit'), 'mocha:xunit')
)
gulp.task('test:local', gulp.parallel('eslint', 'mocha:coverage'))