forked from borsi/sn-redux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
94 lines (84 loc) · 2.65 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
const gulp = require('gulp');
const ts = require('gulp-typescript');
const mocha = require('gulp-mocha');
const sourcemaps = require('gulp-sourcemaps');
const istanbul = require('gulp-istanbul');
const remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');
const typedoc = require("gulp-typedoc");
const del = require('del');
const __coverageThreshold = 60;
const tsProject = ts.createProject('./tsconfig.json');
const tslint = require("gulp-tslint");
gulp.task("build:lint", function () {
return gulp.src(["./**/*.ts", "!./node_modules/**/*", "!./test/**/*"])
.pipe(tslint({
configuration: {
rules: {
"variable-name": false,
"quotemark": [true, "single", "avoid-escape"],
"max-file-line-count": false
}
}
}))
.pipe(tslint.report())
});
gulp.task('build:clean', function () {
return del([
'./dist',
'./coverage',
'./coverage-report'
]);
});
gulp.task('build', ['build:clean'], function () {
return gulp.src([
'./src/**/*.ts',
'./test/**/*.ts'
], { base: '.' })
.pipe(sourcemaps.init())
.pipe(tsProject())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./dist'));
})
gulp.task('test:instrument', ['build'], function () {
return gulp.src('./dist/src/**/*.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test:cover', ['test:instrument'], function () {
return gulp.src('./dist/**/*Tests.js')
.pipe(mocha({ ui: 'bdd' }))
.pipe(istanbul.writeReports({
reporters: ['json', 'html']
})).on('end', remapCoverageFiles);
});
function remapCoverageFiles() {
return gulp.src('./coverage/coverage-final.json')
.pipe(remapIstanbul({
basePath: '.',
reports: {
'html': './coverage',
'text-summary': null,
'lcovonly': './coverage/lcov.info'
}
}));
}
gulp.task("typedoc", function () {
return gulp
.src(["src/*.ts", "!src/sn-redux.ts"])
.pipe(typedoc({
module: "commonjs",
target: "es2015",
includeDeclarations: false,
out: "./documentation",
name: "sn-redux",
theme: "default",
ignoreCompilerErrors: true,
version: true,
readme: "sn-redux/README.md",
excludeExternals: true,
excludePrivate: true,
includes: "docs"
}));
});
gulp.task('test', ['test:cover']);
gulp.task('default', ['build:lint', 'build', 'test', 'typedoc']);