-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlayaair-cmd-ui.js
42 lines (37 loc) · 1.2 KB
/
layaair-cmd-ui.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
const path = require("path");
const program = require("commander");
const fs = require("fs");
const
{
printOk,
printErr,
printQuotation,
tr
} = require("./print.js");
program
.version("0.1.1")
.option('-c --clear', tr('clear will delete old ui code file.'))
.option('-a --atlas', tr('generate atlas'))
.option('-d --code', tr('generate ui code files'))
.option('-m --mode <mode>', tr("'normal' or 'release', specify 'release' will generate UI code files exclude unused resources."))
.parse(process.argv);
let clear = program.clear || false,
mode = program.mode || 'normal',
code = program.code || false,
atlas = program.atlas || false;
/////////////////////////////////////////////////////////////
// Call external interface define in LayaAirCmdTool.max.js //
/////////////////////////////////////////////////////////////
var args = [];
let exe = path.join(__dirname, "ProjectExportTools", "LayaAirCmdTool.max.js");
args.push(path.resolve("laya", ".laya"));
args.push(`clear=${clear}`);
args.push(`releasemode=${mode}`);
args.push(`exportUICode=${code}`);
args.push(`exportRes=${atlas}`);
var sp = require("child_process").fork(exe, args);
sp.on("close", (data) =>
{
printOk(tr("finish."));
process.exit();
});