-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
54 lines (47 loc) · 1.35 KB
/
gulpfile.js
File metadata and controls
54 lines (47 loc) · 1.35 KB
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
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tsd = require('gulp-tsd');
var header = require('gulp-header');
var thrift = require('gulp-typescript-thrift');
var tsProject = ts.createProject({
declarationFiles: true,
noExternalResolve: false,
sortOuptut: true,
module: "commonjs"
});
gulp.task("ts-compile", ['thrift'], function() {
var tsResult = gulp.src(['src/*.ts'])
.pipe(ts(tsProject))
tsResult.dts.pipe(gulp.dest('build'));
return tsResult.js
.pipe(header('#!/usr/bin/env node\n'))
.pipe(gulp.dest('build'));
});
gulp.task("thrift", function ()
{
var tStream = new thrift({
generator: 'js:node'
});
gulp.src('./CorfuDB/src/main/thrift/*.thrift')
.pipe(tStream)
.pipe(gulp.dest('./lib'));
tStream.definitions.pipe(gulp.dest('typings/gen-thrift'));
}
);
gulp.task("ts-typings", function(cb)
{
tsd({
command: 'reinstall',
config: './tsd.json'
}, cb);
});
gulp.task("clean", function(cb) {
del(['build','typings'], cb);
});
gulp.task('default', function()
{
gulp.start('ts-compile');
})
gulp.task('watch', function() {
gulp.watch('src/*.ts', ['ts-compile']);
})