-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgulpfile.js
36 lines (30 loc) · 985 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
const fs = require('fs');
const gulp = require('gulp');
const shell = require('gulp-shell');
const merge = require('merge-stream');
const browserify = require('browserify');
const tsify = require('tsify');
gulp.task('tsc', shell.task([
'echo "tsc for nodejs"',
'tsc -p src/tsconfig.json',
]));
// 'echo "tsc for browser"'
// 'tsc -p tsconfig-cjs.json'
gulp.task('browserify', function () {
const bfi = browserify({
entries: ['./src/index.ts'],
debug: true,
basedir: '.'
})
.plugin(tsify, { noImplicitAny: false })
.bundle()
.pipe(fs.createWriteStream('./lib/openflow-api.js'));
return bfi;
});
gulp.task("watch", function () {
const web = gulp.watch([].concat("./src/**/*.ts"), gulp.series('tsc', 'browserify'));
return web;
});
gulp.task('compose', gulp.series('tsc', 'browserify'));
gulp.task('build', gulp.series('tsc', 'browserify'));
gulp.task('default', gulp.series('tsc', 'browserify', 'watch'));