forked from lukka/run-vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
64 lines (56 loc) · 2.08 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
// Copyright (c) 2019-2020-2021 Luca Cappa
// Released under the term specified in file LICENSE.txt
// SPDX short identifier: MIT
const gulp = require('gulp');
const path = require('path');
const install = require('gulp-install');
const ts = require("gulp-typescript");
const sourcemaps = require("gulp-sourcemaps");
const eslint = require('gulp-eslint');
const jest = require('gulp-jest-acierto').default;
var installPackages = function () {
return gulp.src([
"./package.json"]).pipe(install());
}
var build = function () {
tsProject = ts.createProject('./tsconfig.json');
return tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(path.join('build')))
}
var eslinter = function () {
// lint only the files of the action, e.g. not of the /libs/
return gulp.src(['src/**/*.ts'])
// eslint() attaches the lint output to the "eslint" property
// of the file object so it can be used by other modules.
.pipe(eslint())
// eslint.format() outputs the lint results to the console.
// Alternatively use eslint.formatEach() (see Docs).
.pipe(eslint.format())
// To have the process exit with an error code (1) on
// lint error, return the stream and pipe to failAfterError last.
.pipe(eslint.failAfterError());
}
// Copy the assets-lib provided matchers.
var copyMatchersJson = function () {
return gulp.src(
['./node_modules/@lukka/assets-lib/src/matchers/*.json'])
.pipe(gulp.dest('./dist/'));
}
var test = function () {
return gulp.src('__tests__').pipe(jest({
"preprocessorIgnorePatterns": [
"<rootDir>/dist/", "<rootDir>/node_modules/"
],
"automock": false
}));
}
gulp.task('test', test);
gulp.task('eslint', eslinter);
gulp.task('copyMatchersJson', copyMatchersJson);
gulp.task('build', build);
gulp.task('installPackages', installPackages);
// 'test' must not be part of the 'default' target, as it is started explicitly *after* ncc has been run by the package.json run script.
gulp.task('default', gulp.series('installPackages', 'eslint', 'build', 'copyMatchersJson'));