This repository has been archived by the owner on Feb 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
/
build.ts
87 lines (75 loc) · 1.86 KB
/
build.ts
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
#!/usr/bin/env node
import * as yargs from 'yargs';
const debug = require('debug')('build:commandline:build');
import { Builder } from '../lib';
const argv = require('yargs')
.option('win', {
type: 'boolean',
describe: 'Build for Windows platform',
default: Builder.DEFAULT_OPTIONS.win,
alias: 'w',
})
.option('mac', {
type: 'boolean',
describe: 'Build for macOS platform',
default: Builder.DEFAULT_OPTIONS.mac,
alias: 'm',
})
.option('linux', {
type: 'boolean',
describe: 'Build for Linux platform',
default: Builder.DEFAULT_OPTIONS.linux,
alias: 'l',
})
.option('x86', {
type: 'boolean',
describe: 'Build for x86 arch',
default: Builder.DEFAULT_OPTIONS.x86,
})
.option('x64', {
type: 'boolean',
describe: 'Build for x64 arch',
default: Builder.DEFAULT_OPTIONS.x64,
})
.option('tasks', {
type: 'string',
describe: 'List of <PLATFORM>-<ARCH> to build, separated by comma.',
default: '',
})
.option('chrome-app', {
type: 'boolean',
describe: 'Build from Chrome App',
default: Builder.DEFAULT_OPTIONS.chromeApp,
})
.option('mirror', {
describe: 'Modify NW.js mirror',
default: Builder.DEFAULT_OPTIONS.mirror,
})
.option('concurrent', {
type: 'boolean',
describe: 'Build concurrently',
default: Builder.DEFAULT_OPTIONS.concurrent,
})
.help()
.argv;
(async () => {
debug('in commandline', 'argv', argv);
const builder = new Builder({
win: argv.win,
mac: argv.mac,
linux: argv.linux,
x86: argv.x86,
x64: argv.x64,
tasks: argv.tasks.split(','),
chromeApp: argv['chrome-app'],
mirror: argv.mirror,
concurrent: argv.concurrent,
mute: false,
}, argv._.shift());
await builder.build();
process.exitCode = 0;
})()
.catch((err) => {
console.error(err);
process.exitCode = -1;
});