forked from marcel-hofer/markdown-document
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (46 loc) · 1.27 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
const gulp = require('gulp');
const del = require('del');
const ts = require('gulp-typescript');
const mocha = require('gulp-mocha');
const merge = require("merge-stream");
gulp.task('clean', function() {
return del([
'output',
'src/**/*.js',
'specs/**/*.js',
'specs/**/*.html',
'specs/**/*.pdf',
'!specs/testfiles/**'
]);
});
gulp.task('build', ['clean'], function() {
let tsProject = ts.createProject('tsconfig.json');
let build = gulp.src('src/**/*.ts')
.pipe(tsProject({
declaration: true
}));
let copyPackageJson = gulp.src('package.json')
.pipe(gulp.dest('.'));
return merge(
build.js.pipe(gulp.dest('output')),
build.dts.pipe(gulp.dest('output/definitions')),
copyPackageJson);
});
gulp.task('build-test', ['clean'], function() {
let tsProject = ts.createProject('tsconfig.json');
let build = gulp.src([
'src/**/*.ts',
'specs/**/*.ts'
], {
base: './'
})
.pipe(tsProject())
.pipe(gulp.dest('./'));
return merge(build);
});
gulp.task('test', ['build-test'], function() {
return gulp.src('specs/**/*.js')
.pipe(mocha({
timeout: 50
}));
});