-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.ts
39 lines (29 loc) · 1 KB
/
gulpfile.ts
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
//const eslint = require('gulp-eslint');
import gulp, {dest, series, src} from 'gulp';
import {ESLint} from 'eslint';
import del from 'del';
import ts from 'gulp-typescript';
const eslint = new ESLint({
useEslintrc: true
});
const srcPatterns = ['src/**.ts', 'src/**/*.ts'];
const tsc = ts.createProject('tsconfig.json');
async function linter() {
const result = await eslint.lintFiles(srcPatterns);
const formatter = await eslint.loadFormatter('stylish');
const output = formatter.format(result);
console.log(output);
}
function createDist() {
// Hack to create folder structures without actually reading files.
// Nested folders need to be created in their nested order.
return gulp.src('*.*', {read: false}).pipe(gulp.dest('./dist'));
}
function cleanDist() {
return del(`dist/**`, {force: true});
}
function buildSrc() {
// Build typescript sources and output them in './dist'.
return src(srcPatterns).pipe(tsc()).pipe(dest('dist'));
}
exports.default = series(createDist, cleanDist, linter, buildSrc);