forked from lukka/run-cmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (53 loc) · 1.91 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
// Copyright (c) 2019 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');
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')))
}
// Copy action's library to its deployment directory.
var copyLib = function () {
return gulp.src(
['./build/libs/run-cmake-lib/src/**/*.js'])
.pipe(gulp.dest('./build/src/'))
}
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 shared library files to consumers.
var copyBaseLib = function () {
return gulp.src(
['./build/libs/action-base-lib/src/*.js',
'./build/libs/base-lib/src/*.js'])
.pipe(gulp.dest('./build/src/'));
}
gulp.task('eslint', eslinter);
gulp.task('copyLib', copyLib);
gulp.task('copyBaseLib', copyBaseLib);
gulp.task('build', build);
gulp.task('installPackages', installPackages);
gulp.task('default', gulp.series('installPackages', 'eslint', 'build', 'copyLib', 'copyBaseLib'));