-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (39 loc) · 943 Bytes
/
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
/*jshint globalstrict: true*/
/*global require*/
'use strict'
const gulp = require('gulp')
const util = require('util')
const jdists = require('gulp-jdists')
const rename = require('gulp-rename')
const examplejs = require('gulp-examplejs')
const typescript = require('gulp-typescript')
const merge2 = require('merge2')
gulp.task('build', function () {
var tsResult = gulp.src(`src/index.ts`)
.pipe(jdists())
.pipe(gulp.dest('lib'))
.pipe(typescript({
target: 'ES5',
module: 'commonjs',
declaration: true,
}))
return merge2([
tsResult.dts.pipe(gulp.dest('./lib')),
tsResult.js.pipe(gulp.dest('./lib'))
])
})
gulp.task('example', function () {
return gulp.src([
'src/*.ts'
])
.pipe(examplejs({
header: `
global.processor = require('../')
`
}))
.pipe(rename({
extname: '.js'
}))
.pipe(gulp.dest('test'))
})
gulp.task('dist', ['build', 'example'])