-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
108 lines (83 loc) · 2.14 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const gulp = require('gulp');
const ts = require('gulp-typescript');
const merge = require('merge2');
const clean = require('gulp-clean');
const nexe = require('nexe');
const paths = {
src: './src/',
ts_build: './src/ts/build/',
ts_build_js: './src/ts/build/js/ts/',
ic_build: './src/icons/build/',
build: './build/',
}
const files = {
main_js: 'js/ts/achart-creator.js',
js: 'acreate.js',
min_js: 'achart-creator.min.js'
}
function deleteBuilds()
{
return gulp.src(['binaries/', 'build/', 'src/ts/build/'],
{
read: false,
allowEmpty: true
})
.pipe(clean());
}
function deleteModules()
{
return gulp.src('node_modules/',
{
read: false,
allowEmpty: true
})
.pipe(clean());
}
function tsc()
{
const ts_result = gulp.src(paths.src + '**/*.ts')
.pipe( ts.createProject(require('./tsconfig').compilerOptions)() );
return merge([
ts_result.dts.pipe( gulp.dest(paths.ts_build + 'd/') ),
ts_result.js.pipe( gulp.dest(paths.ts_build + 'js/') )
]);
}
function aChartCreatorCopy()
{
return gulp.src(
[paths.ts_build_js + '*.js'],
{base: paths.ts_build + 'js/ts'}
)
.pipe(gulp.dest(paths.build));
}
function nexeBuild(cb)
{
const target_version = "12.9.1";
let target = target_version;
let target_dir = process.platform + "-" + process.arch;
if ( (process.argv.length > 4) && (process.argv[3].toLowerCase() === "--target" ) )
{
target = process.argv[4];
target_dir = target;
if (target.indexOf(".") === -1)
{
target += "-" + target_version;
}
}
else
{
console.info("No output target specified. Creating executable for host platform...");
}
nexe.compile(
{
input: "build/acreate.js",
output: "binaries/" + target_dir + "/acreate",
target: target
});
cb();
}
exports.clean = deleteBuilds;
exports.cleanall = gulp.series(deleteBuilds, deleteModules);
exports.build = gulp.series(tsc, aChartCreatorCopy);
exports.binary = gulp.series(exports.build, nexeBuild);
exports.default = exports.build;