-
Notifications
You must be signed in to change notification settings - Fork 40
/
compiler.js
62 lines (52 loc) · 2.04 KB
/
compiler.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
const fs = require('fs');
const path = require('path');
const compile = require('nexe').compile;
module.exports = class Compiler {
constructor(path){
this.path = path
}
apply(compiler) {
fs.mkdirSync(path.resolve(__dirname, './dist/macos'), {recursive: true})
fs.mkdirSync(path.resolve(__dirname, './dist/linux'), {recursive: true})
fs.mkdirSync(path.resolve(__dirname, './dist/windows'), {recursive: true})
compiler.hooks.done.tapAsync(
'nexe-build',
(compilation, callback) => {
const builds = [];
builds.push(compile({
input: this.path,
output: path.resolve(__dirname, './dist/macos/arweave'),
build: false,
targets: [
{ version: '12.14.1', platform: 'macos', arch: 'x64' },
]
}));
builds.push(compile({
input: this.path,
output: path.resolve(__dirname, './dist/linux/arweave'),
build: false,
targets: [
{ version: '12.14.1', platform: 'linux', arch: 'x64' },
]
}));
builds.push(compile({
input: this.path,
output: path.resolve(__dirname, './dist/windows/arweave-x64.exe'),
build: false,
targets: [
{ version: '12.14.1', platform: 'windows', arch: 'x64' },
]
}));
builds.push(compile({
input: this.path,
output: path.resolve(__dirname, './dist/windows/arweave-x86.exe'),
build: false,
targets: [
{ version: '12.14.1', platform: 'windows', arch: 'x86' },
]
}));
Promise.all(builds).then(() => {callback()});
}
);
}
}