/
gulpfile.js
52 lines (46 loc) · 1.17 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
const { src, dest, pipe, series } = require('gulp')
, fs = require('fs')
, jshint = require('gulp-jshint')
, jest = require('gulp-jest').default
, uglifyjs = require('gulp-uglify')
, mocha = require('gulp-mocha')
, header = require('gulp-header')
, pkg = require('./package.json');
function lint() {
return src(['./src/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
}
function uglify() {
return src('src/translitbg.js')
.pipe(uglifyjs())
.pipe(dest('./build/'));
}
function dist() {
return src('./build/translitbg.js')
.pipe(header(fs.readFileSync('./src/header.txt', 'utf8'), { pkg } ))
.pipe(dest('./build/'));
}
function test() {
return src('test/*.js', {read: false})
.pipe(mocha());
}
function jestit() {
return src('test').pipe(jest({
"preprocessorIgnorePatterns": [
"<rootDir>/dist/", "<rootDir>/node_modules/"
],
"testMatch": [
"**/test/**/*.js"
],
"automock": false,
"reporters": [
"default",
"jest-junit"
]
}));
}
exports.lint = lint;
exports.test = series(lint, test);
exports.build = series(lint, test, jestit, uglify, dist);
exports.default = exports.build