-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
49 lines (39 loc) · 1.28 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
'use strict';
const gulp = require('gulp');
const ts = require('gulp-typescript');
const replace = require('gulp-string-replace');
const fs = require('fs-extra');
exports.build_electron_script = () => {
return gulp.src('electron/src/**/*.ts')
.pipe(ts({
noImplicitAny: true
}))
.pipe(gulp.dest('dist'));
}
exports.add_electron_config_file = () => {
return fs.copy('electron/config/*.json', 'dist/');
}
exports.fix_angular_index = () => {
var anchor = '<app-root></app-root>';
return gulp.src('dist/index.html')
.pipe(replace(anchor, anchor + '\n<script src="preload.js"></script>'))
.pipe(gulp.dest('dist'));
}
exports.import_node_lib = async () => {
let angularCustomModules = [
'custom-electron-titlebar'
];
fs.mkdirSync('dist/node_modules');
angularCustomModules.forEach(function(moduleName) {
let moduleSrc = `node_modules/${moduleName}`;
let moduleDest = `dist/node_modules/${moduleName}`;
fs.copySync(moduleSrc, moduleDest);
console.log(`Copied ${moduleSrc} to ${moduleDest}`);
});
}
var build = gulp.series(
exports.build_electron_script,
exports.fix_angular_index,
exports.import_node_lib
);
exports.default = build;