forked from koltyakov/sp-rest-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (44 loc) · 1.4 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
'use strict';
const gulp = require('gulp');
const merge = require('merge-stream');
const tslint = require('gulp-tslint');
const tsc = require('gulp-typescript');
const tsconfig = require('./tsconfig.json');
gulp.task('clean', () => {
const del = require('del');
return del(['dist/**']);
});
gulp.task('prepublish', ['clean'], () => {
let tsSourcesResult = gulp
.src(['./src/**/*.ts'])
.pipe(tsc.createProject('tsconfig.json')());
return merge[
tsSourcesResult.js.pipe(gulp.dest('./dist')),
tsSourcesResult.dts.pipe(gulp.dest('./dist'))
];
});
gulp.task('tsc', () => {
const sourcemaps = require('gulp-sourcemaps');
let tsSourcesResult = gulp.src(['src/**/*.ts'])
.pipe(sourcemaps.init())
.pipe(tsc.createProject('tsconfig.json')());
let sources = tsSourcesResult.js
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./dist'));
let declarations = tsSourcesResult.dts
.pipe(gulp.dest('./dist'));
return merge(sources, declarations);
});
gulp.task('tslint', () => {
const yargs = require('yargs');
let emitError = yargs.argv.emitError;
return gulp.src(['src/**/*.ts'])
.pipe(tslint({
configuration: './tslint.json',
formatter: 'verbose'
}))
.pipe(tslint.report({
summarizeFailureOutput: true,
emitError: emitError
}));
});