-
Notifications
You must be signed in to change notification settings - Fork 20
/
gulpfile.js
69 lines (60 loc) · 2.29 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
const gulp = require('gulp');
const typedoc = require("gulp-typedoc");
const ts = require('gulp-typescript');
const del = require('del');
const sourcemaps = require('gulp-sourcemaps');
const merge = require('merge2');
const webpack = require('webpack-stream');
gulp.task('clean', function () {
return del([
'dist/**/*'
]);
});
/**
* transpiles the typescript source, generates source maps, and type definitions.
*/
gulp.task('transpile', gulp.series(['clean'], () => {
const tsProject = ts.createProject('tsconfig.json', {});
const tsResult = gulp.src(["src/**/*.ts"])
.pipe(sourcemaps.init())
.pipe(tsProject());
return merge([
tsResult.dts.pipe(gulp.dest('dist/definitions')),
tsResult.js
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('dist/'))
]);
}));
gulp.task('bundle', gulp.series(['transpile'], () => {
return gulp.src('./index.js')
.pipe(webpack(require('./webpack.config.js')))
.pipe(gulp.dest('dist/bundle/'));
}));
gulp.task("typedoc", () => {
return gulp
.src([
"src/com/clover/remote/client/CloverConnectorFactoryBuilder.ts",
"src/com/clover/remote/client/ICloverConnectorFactory.ts",
"src/com/clover/remote/client/CloverConnectorFactoryV2.ts",
"src/com/clover/remote/client/CloverConnectorFactory.ts",
"src/com/clover/remote/client/CardEntryMethods.ts",
"src/com/clover/remote/client/device/WebSocketPairedCloverDeviceConfiguration.ts",
"src/com/clover/remote/client/device/WebSocketCloudCloverDeviceConfiguration.ts",
"src/com/clover/websocket/CloverWebSocketInterface.ts",
"src/com/clover/websocket/BrowserWebSocketImpl.ts",
"src/com/clover/websocket/WebSocketListener.ts",
"src/com/clover/websocket/WebSocketState.ts",
"src/com/clover/util/ImageUtil.ts",
"src/com/clover/util/IImageUtil.ts",
"src/com/clover/Version.ts"
])
.pipe(typedoc({
exclude: "**/*.d.ts",
excludeExternals: true,
module: "commonjs",
target: "es5",
out: "docs/",
name: "Clover SDK for Javascript Integration"
}));
});
gulp.task('default', gulp.series(['clean', 'bundle', 'typedoc']));