forked from RemoteDebug/remotedebug-ios-webkit-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (63 loc) · 1.68 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
//
// Copyright (C) Microsoft. All rights reserved.
//
'use strict'
const gulp = require('gulp')
const mocha = require('gulp-mocha')
const sourcemaps = require('gulp-sourcemaps')
const tslint = require('gulp-tslint')
const ts = require('gulp-typescript')
const log = require('gulp-util').log
const typescript = require('typescript')
const fs = require('fs')
const path = require('path')
const shellSources = [
'src/**/*.ts',
'test/**/*.ts',
'test/*.ts',
'typings/globals/**/*.ts',
'!src/**/*.json'
]
const lintSources = [
'src/**/*.ts',
'test/**/*.ts'
]
let isWatch = false
gulp.task('build', function () {
var tsProject = ts.createProject('tsconfig.json')
return gulp.src(shellSources, { base: '' })
.pipe(tsProject())
.pipe(gulp.dest('./out'))
})
gulp.task('build-tests', function () {
const sources = [
'test/**/*.ts',
'test/*.ts'
]
var tsProject = ts.createProject('tsconfig.json')
return gulp.src(shellSources, { base: '' })
.pipe(tsProject())
.pipe(gulp.dest('./out/test'))
})
gulp.task('lint', function () {
console.log(lintSources)
return gulp.src(lintSources)
.pipe(tslint({formatter: 'full'}))
.pipe(tslint.report('verbose'))
})
gulp.task('test', ['build-tests'], function () {
process.env.NODE_ENV = 'development'
return gulp.src('out/test/**/*.test.js', { read: false })
.pipe(mocha({ ui: 'tdd' }))
.on('error', function (e) {
log(e ? e.toString() : 'error in test task!')
this.emit('end')
})
})
gulp.task('watch-test', ['build-tests'], function () {
return gulp.watch(shellSources, ['build-tests'])
})
gulp.task('watch', ['build'], function () {
const all = shellSources
gulp.watch(all, ['build'])
})