arcadible 0.1.28 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -2
- package/bin/arc-build.js +18 -25
- package/bin/arc-default.js +3 -2
- package/bin/arc-deploy.js +198 -58
- package/bin/arc-init.js +32 -51
- package/bin/arc-inspect.js +7 -37
- package/bin/arc-login.js +6 -7
- package/bin/arc-logout.js +7 -8
- package/bin/arc-open.js +21 -21
- package/bin/arc-pack.js +11 -27
- package/bin/arc-play.js +28 -20
- package/bin/arc-validate.js +8 -20
- package/bin/arc-whoami.js +16 -10
- package/bin/arc.js +2 -2
- package/package.json +20 -6
- package/src/account.js +60 -7
- package/src/action/build/tool.js +12 -3
- package/src/action/deploy/tool-git.js +61 -11
- package/src/action/deploy/tool.js +47 -29
- package/src/action/deploy/wait.js +145 -0
- package/src/action/init/tool-patch.js +5 -28
- package/src/action/init/tool.js +8 -21
- package/src/action/inspect/tool.js +3 -38
- package/src/action/login/flow.js +1 -1
- package/src/action/open/tool.js +15 -3
- package/src/action/pack/limits.js +43 -0
- package/src/action/pack/tool.js +3 -7
- package/src/action/play/tool.js +74 -13
- package/src/action/predeploy/ac.js +14 -43
- package/src/action/predeploy/git.js +40 -61
- package/src/action/predeploy/published.js +69 -0
- package/src/action/predeploy/tool-git.js +58 -15
- package/src/action/predeploy/tool.js +5 -11
- package/src/action/validate/tool.js +28 -7
- package/src/api.js +56 -19
- package/src/cli/inspect.js +2 -2
- package/src/config/html.js +2 -1
- package/src/config/image.js +0 -1
- package/src/config/uri.js +1 -0
- package/src/parser/env.js +8 -3
- package/src/parser/manifest.js +16 -3
- package/src/parser/media.js +16 -11
- package/src/parser/project.js +38 -16
- package/src/parser/readme-file.js +69 -0
- package/src/parser/readme.js +37 -109
- package/src/parser/sections.js +107 -0
- package/src/phrase.js +382 -53
- package/src/schema/check/workflow.js +42 -5
- package/src/schema/game.js +164 -99
- package/src/schema/message.js +46 -0
- package/src/schema/readme.js +38 -0
- package/src/schema/workflow.js +27 -26
- package/src/util/argv.js +49 -0
- package/src/util/chars.js +30 -0
- package/src/util/delay.js +1 -1
- package/src/util/doc.js +50 -29
- package/src/util/http.js +5 -3
- package/src/util/image.js +46 -23
- package/src/util/links.js +63 -0
- package/src/util/log.js +36 -51
- package/src/util/md.js +39 -2
- package/src/util/output.js +34 -9
- package/src/util/paths.js +3 -1
- package/src/util/progress.js +19 -5
- package/src/util/rc.js +67 -11
- package/src/util/request.js +36 -32
- package/src/util/schema.js +12 -4
- package/src/util/shell.js +39 -7
- package/src/util/spinner.js +14 -3
- package/src/util/term.js +28 -0
- package/src/util/uris.js +8 -1
- package/src/util/video.js +49 -17
- package/src/util/zip.js +15 -0
- package/.eslintrc +0 -6
- package/src/action/inspect/media.js +0 -34
- package/src/config/game.js +0 -5
- package/src/util/dom.js +0 -46
package/bin/arc-init.js
CHANGED
|
@@ -14,17 +14,20 @@ const yargs = require("yargs/yargs");
|
|
|
14
14
|
|
|
15
15
|
// [import]
|
|
16
16
|
|
|
17
|
+
const args = require("../src/util/argv");
|
|
17
18
|
const cfgpackage = require("../src/config/package");
|
|
18
19
|
const cfgproduct = require("../src/config/product");
|
|
19
20
|
const cfgtemplate = require("../src/config/template");
|
|
20
21
|
const init = require("../src/cli/init");
|
|
21
22
|
const log = require("../src/util/log");
|
|
22
23
|
const output = require("../src/util/output");
|
|
24
|
+
const phrase = require("../src/phrase");
|
|
23
25
|
const rc = require("../src/util/rc");
|
|
24
26
|
const spinner = require("../src/util/spinner");
|
|
25
27
|
|
|
26
28
|
// [use]
|
|
27
29
|
|
|
30
|
+
const abort = output.abort;
|
|
28
31
|
const findRc = rc.findRc;
|
|
29
32
|
const join = path.join;
|
|
30
33
|
const pathExists = fs.pathExists;
|
|
@@ -46,7 +49,7 @@ const conf = {
|
|
|
46
49
|
project: ".",
|
|
47
50
|
quiet: false,
|
|
48
51
|
yes: false,
|
|
49
|
-
...findRc(TOOL, COMMAND, process.argv
|
|
52
|
+
...findRc(TOOL, COMMAND, process.argv),
|
|
50
53
|
};
|
|
51
54
|
|
|
52
55
|
// [function]
|
|
@@ -56,17 +59,6 @@ const handler = function ({ json, quiet, sw }) {
|
|
|
56
59
|
onInitBegin() {
|
|
57
60
|
sw.start(json || quiet);
|
|
58
61
|
},
|
|
59
|
-
onLogInfo({ level, message }) {
|
|
60
|
-
if (!json && !quiet) {
|
|
61
|
-
switch (level) {
|
|
62
|
-
case "warn":
|
|
63
|
-
sw.stop(true);
|
|
64
|
-
log.pw(`⚠ ${message}`);
|
|
65
|
-
sw.start(json || quiet);
|
|
66
|
-
// no default
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
62
|
};
|
|
71
63
|
};
|
|
72
64
|
|
|
@@ -77,7 +69,6 @@ const start = function (argv) {
|
|
|
77
69
|
const quiet = argv.quiet;
|
|
78
70
|
const sw = new SpinnerWheel("Initializing... %s");
|
|
79
71
|
return init({
|
|
80
|
-
force: true,
|
|
81
72
|
handler: handler({ json, quiet, sw }),
|
|
82
73
|
patch: argv.patch,
|
|
83
74
|
project: argv.project,
|
|
@@ -87,31 +78,15 @@ const start = function (argv) {
|
|
|
87
78
|
.then((project) => {
|
|
88
79
|
if (json) {
|
|
89
80
|
print({ project });
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
if (!quiet) {
|
|
81
|
+
} else if (!quiet) {
|
|
93
82
|
sw.stop(true);
|
|
94
|
-
log.hs("
|
|
95
|
-
|
|
96
|
-
print(project, { toml: true });
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
log.p("Nothing to do.");
|
|
83
|
+
log.hs("Initialized.");
|
|
84
|
+
print(project, { nl: true, toml: true });
|
|
100
85
|
}
|
|
101
|
-
// degit sometimes hangs
|
|
102
|
-
process.exit(0);
|
|
86
|
+
// degit sometimes hangs, so exit once stdout is written.
|
|
87
|
+
process.stdout.write("", () => process.exit(0));
|
|
103
88
|
})
|
|
104
|
-
.catch((ex) => {
|
|
105
|
-
const message = ex.message;
|
|
106
|
-
if (json) {
|
|
107
|
-
print({ error: { message } });
|
|
108
|
-
} else {
|
|
109
|
-
sw.stop(true);
|
|
110
|
-
log.hd("Init aborted.");
|
|
111
|
-
log.p(message);
|
|
112
|
-
}
|
|
113
|
-
process.exit(1);
|
|
114
|
-
});
|
|
89
|
+
.catch((ex) => abort("Init aborted.", ex, { json, sw }));
|
|
115
90
|
};
|
|
116
91
|
|
|
117
92
|
// [function]
|
|
@@ -130,6 +105,10 @@ const prompt = async function ({ yes, ...argv }) {
|
|
|
130
105
|
return opts;
|
|
131
106
|
}
|
|
132
107
|
if (!opts.template) {
|
|
108
|
+
// without a terminal, the prompt would read end-of-input and exit.
|
|
109
|
+
if (!process.stdin.isTTY) {
|
|
110
|
+
throw new Error(phrase.noTemplate());
|
|
111
|
+
}
|
|
133
112
|
opts.template = await select(cfgtemplate);
|
|
134
113
|
}
|
|
135
114
|
return opts;
|
|
@@ -137,9 +116,22 @@ const prompt = async function ({ yes, ...argv }) {
|
|
|
137
116
|
|
|
138
117
|
// [function]
|
|
139
118
|
|
|
119
|
+
const inquire = function (argv) {
|
|
120
|
+
return prompt(argv)
|
|
121
|
+
.then(start)
|
|
122
|
+
.catch((ex) => {
|
|
123
|
+
if (ex?.name === "ExitPromptError") {
|
|
124
|
+
process.exit(130);
|
|
125
|
+
}
|
|
126
|
+
abort("Init aborted.", ex, { json: argv.json });
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// [function]
|
|
131
|
+
|
|
140
132
|
const main = function (argv) {
|
|
141
|
-
return
|
|
142
|
-
yargs(hideBin(argv))
|
|
133
|
+
return inquire(
|
|
134
|
+
yargs(args.normalize(hideBin(argv)))
|
|
143
135
|
.scriptName(`${TOOL} ${COMMAND}`)
|
|
144
136
|
.usage("$0 [project] [options]")
|
|
145
137
|
.command("$0 [project]", false, (cli) =>
|
|
@@ -175,28 +167,17 @@ const main = function (argv) {
|
|
|
175
167
|
describe: "Output only errors",
|
|
176
168
|
type: "boolean",
|
|
177
169
|
})
|
|
178
|
-
.option("cwd",
|
|
179
|
-
alias: "C",
|
|
180
|
-
default: ".",
|
|
181
|
-
describe: "Set the working directory",
|
|
182
|
-
type: "string",
|
|
183
|
-
})
|
|
170
|
+
.option("cwd", args.CWD)
|
|
184
171
|
.help("help")
|
|
185
172
|
.alias("help", "h")
|
|
186
173
|
.version(VERSION)
|
|
187
174
|
.alias("version", "v")
|
|
188
175
|
.strict()
|
|
189
176
|
.parse(),
|
|
190
|
-
)
|
|
191
|
-
.then(start)
|
|
192
|
-
.catch((ex) => {
|
|
193
|
-
if (ex && ex.name === "ExitPromptError") {
|
|
194
|
-
process.exit(0);
|
|
195
|
-
}
|
|
196
|
-
});
|
|
177
|
+
);
|
|
197
178
|
};
|
|
198
179
|
|
|
199
|
-
// [
|
|
180
|
+
// [start]
|
|
200
181
|
|
|
201
182
|
if (require.main === module) {
|
|
202
183
|
main(process.argv);
|
package/bin/arc-inspect.js
CHANGED
|
@@ -12,20 +12,19 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const args = require("../src/util/argv");
|
|
15
16
|
const cfgpackage = require("../src/config/package");
|
|
16
17
|
const cfgproduct = require("../src/config/product");
|
|
17
18
|
const inspect = require("../src/cli/inspect");
|
|
18
|
-
const log = require("../src/util/log");
|
|
19
19
|
const output = require("../src/util/output");
|
|
20
20
|
const rc = require("../src/util/rc");
|
|
21
|
-
const spinner = require("../src/util/spinner");
|
|
22
21
|
|
|
23
22
|
// [use]
|
|
24
23
|
|
|
24
|
+
const abort = output.abort;
|
|
25
25
|
const findRc = rc.findRc;
|
|
26
26
|
const print = output.print;
|
|
27
27
|
const resolve = path.resolve;
|
|
28
|
-
const SpinnerWheel = spinner.SpinnerWheel;
|
|
29
28
|
|
|
30
29
|
// [declare]
|
|
31
30
|
|
|
@@ -38,17 +37,7 @@ const VERSION = cfgpackage.version;
|
|
|
38
37
|
const conf = {
|
|
39
38
|
json: false,
|
|
40
39
|
selector: null,
|
|
41
|
-
...findRc(TOOL, COMMAND, process.argv
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// [function]
|
|
45
|
-
|
|
46
|
-
const handler = function ({ json, sw }) {
|
|
47
|
-
return {
|
|
48
|
-
onInspectFetch() {
|
|
49
|
-
sw.start(json);
|
|
50
|
-
},
|
|
51
|
-
};
|
|
40
|
+
...findRc(TOOL, COMMAND, process.argv),
|
|
52
41
|
};
|
|
53
42
|
|
|
54
43
|
// [function]
|
|
@@ -56,10 +45,7 @@ const handler = function ({ json, sw }) {
|
|
|
56
45
|
const start = function (argv) {
|
|
57
46
|
const json = argv.json;
|
|
58
47
|
const selector = argv.selector;
|
|
59
|
-
const sw = new SpinnerWheel("Loading... %s");
|
|
60
48
|
return inspect({
|
|
61
|
-
game: null,
|
|
62
|
-
handler: handler({ json, sw }),
|
|
63
49
|
root: resolve(process.cwd(), argv.cwd),
|
|
64
50
|
selector,
|
|
65
51
|
})
|
|
@@ -68,27 +54,16 @@ const start = function (argv) {
|
|
|
68
54
|
print(data);
|
|
69
55
|
return;
|
|
70
56
|
}
|
|
71
|
-
sw.stop(true);
|
|
72
57
|
print(data, { key: selector, toml: true });
|
|
73
58
|
})
|
|
74
|
-
.catch((ex) => {
|
|
75
|
-
const message = ex.message;
|
|
76
|
-
if (json) {
|
|
77
|
-
print({ error: { message } });
|
|
78
|
-
} else {
|
|
79
|
-
sw.stop(true);
|
|
80
|
-
log.hd("Inspect aborted.");
|
|
81
|
-
log.p(message);
|
|
82
|
-
}
|
|
83
|
-
process.exit(1);
|
|
84
|
-
});
|
|
59
|
+
.catch((ex) => abort("Inspect aborted.", ex, { json }));
|
|
85
60
|
};
|
|
86
61
|
|
|
87
62
|
// [function]
|
|
88
63
|
|
|
89
64
|
const main = function (argv) {
|
|
90
65
|
return start(
|
|
91
|
-
yargs(hideBin(argv))
|
|
66
|
+
yargs(args.normalize(hideBin(argv)))
|
|
92
67
|
.scriptName(`${TOOL} ${COMMAND}`)
|
|
93
68
|
.usage("$0 [selector] [options]")
|
|
94
69
|
.command("$0 [selector]", false, (cli) =>
|
|
@@ -104,12 +79,7 @@ const main = function (argv) {
|
|
|
104
79
|
describe: "Format output as JSON",
|
|
105
80
|
type: "boolean",
|
|
106
81
|
})
|
|
107
|
-
.option("cwd",
|
|
108
|
-
alias: "C",
|
|
109
|
-
default: ".",
|
|
110
|
-
describe: "Set the working directory",
|
|
111
|
-
type: "string",
|
|
112
|
-
})
|
|
82
|
+
.option("cwd", args.CWD)
|
|
113
83
|
.help("help")
|
|
114
84
|
.alias("help", "h")
|
|
115
85
|
.version(VERSION)
|
|
@@ -119,7 +89,7 @@ const main = function (argv) {
|
|
|
119
89
|
);
|
|
120
90
|
};
|
|
121
91
|
|
|
122
|
-
// [
|
|
92
|
+
// [start]
|
|
123
93
|
|
|
124
94
|
if (require.main === module) {
|
|
125
95
|
main(process.argv);
|
package/bin/arc-login.js
CHANGED
|
@@ -9,6 +9,7 @@ const yargs = require("yargs/yargs");
|
|
|
9
9
|
|
|
10
10
|
// [import]
|
|
11
11
|
|
|
12
|
+
const args = require("../src/util/argv");
|
|
12
13
|
const cfgpackage = require("../src/config/package");
|
|
13
14
|
const cfgproduct = require("../src/config/product");
|
|
14
15
|
const log = require("../src/util/log");
|
|
@@ -35,7 +36,7 @@ const VERSION = cfgpackage.version;
|
|
|
35
36
|
const conf = {
|
|
36
37
|
browser: true,
|
|
37
38
|
qrcode: true,
|
|
38
|
-
...findRc(TOOL, COMMAND, process.argv
|
|
39
|
+
...findRc(TOOL, COMMAND, process.argv),
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
// [function]
|
|
@@ -86,7 +87,6 @@ const handler = function ({ browser, qrcode: qr, sw }) {
|
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
89
|
},
|
|
89
|
-
onLoginPoll() {},
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
92
|
|
|
@@ -105,14 +105,13 @@ const start = function (argv) {
|
|
|
105
105
|
}
|
|
106
106
|
sw.stop(true);
|
|
107
107
|
process.stdin.pause();
|
|
108
|
-
log.
|
|
109
|
-
log.p(user.display_name);
|
|
108
|
+
log.result("Logged in.", [user.display_name], { nl: true });
|
|
110
109
|
})
|
|
111
110
|
.catch((ex) => {
|
|
112
111
|
sw.stop(true);
|
|
113
112
|
process.stdin.pause();
|
|
114
113
|
log.nlhd("Login aborted.");
|
|
115
|
-
log.
|
|
114
|
+
log.pd(ex.message);
|
|
116
115
|
process.exit(1);
|
|
117
116
|
});
|
|
118
117
|
};
|
|
@@ -121,7 +120,7 @@ const start = function (argv) {
|
|
|
121
120
|
|
|
122
121
|
const main = function (argv) {
|
|
123
122
|
return start(
|
|
124
|
-
yargs(hideBin(argv))
|
|
123
|
+
yargs(args.normalize(hideBin(argv)))
|
|
125
124
|
.scriptName(`${TOOL} ${COMMAND}`)
|
|
126
125
|
.usage("$0 [options]")
|
|
127
126
|
.option("browser", {
|
|
@@ -143,7 +142,7 @@ const main = function (argv) {
|
|
|
143
142
|
);
|
|
144
143
|
};
|
|
145
144
|
|
|
146
|
-
// [
|
|
145
|
+
// [start]
|
|
147
146
|
|
|
148
147
|
if (require.main === module) {
|
|
149
148
|
main(process.argv);
|
package/bin/arc-logout.js
CHANGED
|
@@ -8,14 +8,17 @@ const yargs = require("yargs/yargs");
|
|
|
8
8
|
|
|
9
9
|
// [import]
|
|
10
10
|
|
|
11
|
+
const args = require("../src/util/argv");
|
|
11
12
|
const cfgpackage = require("../src/config/package");
|
|
12
13
|
const cfgproduct = require("../src/config/product");
|
|
13
14
|
const log = require("../src/util/log");
|
|
14
15
|
const logout = require("../src/cli/logout");
|
|
16
|
+
const output = require("../src/util/output");
|
|
15
17
|
const rc = require("../src/util/rc");
|
|
16
18
|
|
|
17
19
|
// [use]
|
|
18
20
|
|
|
21
|
+
const abort = output.abort;
|
|
19
22
|
const findRc = rc.findRc;
|
|
20
23
|
|
|
21
24
|
// [declare]
|
|
@@ -28,7 +31,7 @@ const VERSION = cfgpackage.version;
|
|
|
28
31
|
|
|
29
32
|
const conf = {
|
|
30
33
|
quiet: false,
|
|
31
|
-
...findRc(TOOL, COMMAND, process.argv
|
|
34
|
+
...findRc(TOOL, COMMAND, process.argv),
|
|
32
35
|
};
|
|
33
36
|
|
|
34
37
|
// [function]
|
|
@@ -40,18 +43,14 @@ const start = function (argv) {
|
|
|
40
43
|
log.hs("Logged out.");
|
|
41
44
|
}
|
|
42
45
|
})
|
|
43
|
-
.catch((ex) =>
|
|
44
|
-
log.hd("Logout aborted.");
|
|
45
|
-
log.p(ex.message);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
});
|
|
46
|
+
.catch((ex) => abort("Logout aborted.", ex));
|
|
48
47
|
};
|
|
49
48
|
|
|
50
49
|
// [function]
|
|
51
50
|
|
|
52
51
|
const main = function (argv) {
|
|
53
52
|
return start(
|
|
54
|
-
yargs(hideBin(argv))
|
|
53
|
+
yargs(args.normalize(hideBin(argv)))
|
|
55
54
|
.scriptName(`${TOOL} ${COMMAND}`)
|
|
56
55
|
.usage("$0 [options]")
|
|
57
56
|
.option("quiet", {
|
|
@@ -69,7 +68,7 @@ const main = function (argv) {
|
|
|
69
68
|
);
|
|
70
69
|
};
|
|
71
70
|
|
|
72
|
-
// [
|
|
71
|
+
// [start]
|
|
73
72
|
|
|
74
73
|
if (require.main === module) {
|
|
75
74
|
main(process.argv);
|
package/bin/arc-open.js
CHANGED
|
@@ -12,17 +12,20 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const args = require("../src/util/argv");
|
|
15
16
|
const cfgpackage = require("../src/config/package");
|
|
16
17
|
const cfgproduct = require("../src/config/product");
|
|
17
18
|
const cfguri = require("../src/config/uri");
|
|
18
19
|
const log = require("../src/util/log");
|
|
19
20
|
const open = require("../src/cli/open");
|
|
21
|
+
const output = require("../src/util/output");
|
|
20
22
|
const phrase = require("../src/phrase");
|
|
21
23
|
const rc = require("../src/util/rc");
|
|
22
24
|
const shell = require("../src/util/shell");
|
|
23
25
|
|
|
24
26
|
// [use]
|
|
25
27
|
|
|
28
|
+
const abort = output.abort;
|
|
26
29
|
const findRc = rc.findRc;
|
|
27
30
|
const launch = shell.launch;
|
|
28
31
|
const resolve = path.resolve;
|
|
@@ -38,7 +41,7 @@ const VERSION = cfgpackage.version;
|
|
|
38
41
|
const conf = {
|
|
39
42
|
browser: false,
|
|
40
43
|
game: "self",
|
|
41
|
-
...findRc(TOOL, COMMAND, process.argv
|
|
44
|
+
...findRc(TOOL, COMMAND, process.argv),
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
// [function]
|
|
@@ -53,27 +56,29 @@ const start = function (argv) {
|
|
|
53
56
|
if (!page) {
|
|
54
57
|
throw new Error(phrase.noGameId());
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
const url = `${cfguri.HOST_HTTP_WWW}${page}`;
|
|
60
|
+
const opening = argv.browser
|
|
61
|
+
? launch(url)
|
|
62
|
+
: launch(`${cfguri.HOST_APP_STORE}${page}`, url);
|
|
63
|
+
return Promise.all([opening, url]);
|
|
64
|
+
})
|
|
65
|
+
.then(([where, url]) => {
|
|
66
|
+
if (where) {
|
|
67
|
+
log.result(phrase.opened(where), [url]);
|
|
68
|
+
} else {
|
|
69
|
+
log.result(phrase.unableToOpen(), [url, phrase.openToContinue()], {
|
|
70
|
+
color: "yellow",
|
|
71
|
+
});
|
|
59
72
|
}
|
|
60
|
-
launch(
|
|
61
|
-
`${cfguri.HOST_APP_STORE}${page}`,
|
|
62
|
-
`${cfguri.HOST_HTTP_WWW}${page}`,
|
|
63
|
-
);
|
|
64
73
|
})
|
|
65
|
-
.catch((ex) =>
|
|
66
|
-
log.hd("Open aborted.");
|
|
67
|
-
log.p(ex.message);
|
|
68
|
-
process.exit(1);
|
|
69
|
-
});
|
|
74
|
+
.catch((ex) => abort("Open aborted.", ex));
|
|
70
75
|
};
|
|
71
76
|
|
|
72
77
|
// [function]
|
|
73
78
|
|
|
74
79
|
const main = function (argv) {
|
|
75
80
|
return start(
|
|
76
|
-
yargs(hideBin(argv))
|
|
81
|
+
yargs(args.normalize(hideBin(argv)))
|
|
77
82
|
.scriptName(`${TOOL} ${COMMAND}`)
|
|
78
83
|
.usage("$0 [game] [options]")
|
|
79
84
|
.command("$0 [game]", false, (cli) =>
|
|
@@ -88,12 +93,7 @@ const main = function (argv) {
|
|
|
88
93
|
describe: "Open in a web browser",
|
|
89
94
|
type: "boolean",
|
|
90
95
|
})
|
|
91
|
-
.option("cwd",
|
|
92
|
-
alias: "C",
|
|
93
|
-
default: ".",
|
|
94
|
-
describe: "Set the working directory",
|
|
95
|
-
type: "string",
|
|
96
|
-
})
|
|
96
|
+
.option("cwd", args.CWD)
|
|
97
97
|
.help("help")
|
|
98
98
|
.alias("help", "h")
|
|
99
99
|
.version(VERSION)
|
|
@@ -103,7 +103,7 @@ const main = function (argv) {
|
|
|
103
103
|
);
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
// [
|
|
106
|
+
// [start]
|
|
107
107
|
|
|
108
108
|
if (require.main === module) {
|
|
109
109
|
main(process.argv);
|
package/bin/arc-pack.js
CHANGED
|
@@ -12,6 +12,7 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const args = require("../src/util/argv");
|
|
15
16
|
const cfgpackage = require("../src/config/package");
|
|
16
17
|
const cfgproduct = require("../src/config/product");
|
|
17
18
|
const log = require("../src/util/log");
|
|
@@ -24,6 +25,7 @@ const validate = require("../src/cli/validate");
|
|
|
24
25
|
|
|
25
26
|
// [use]
|
|
26
27
|
|
|
28
|
+
const abort = output.abort;
|
|
27
29
|
const findRc = rc.findRc;
|
|
28
30
|
const print = output.print;
|
|
29
31
|
const resolve = path.resolve;
|
|
@@ -42,7 +44,7 @@ const conf = {
|
|
|
42
44
|
json: false,
|
|
43
45
|
output: null,
|
|
44
46
|
quiet: false,
|
|
45
|
-
...findRc(TOOL, COMMAND, process.argv
|
|
47
|
+
...findRc(TOOL, COMMAND, process.argv),
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
// [function]
|
|
@@ -52,13 +54,14 @@ const start = function (argv) {
|
|
|
52
54
|
const quiet = argv.quiet;
|
|
53
55
|
const root = resolve(process.cwd(), argv.cwd);
|
|
54
56
|
let sw = new SpinnerWheel("Validating... %s");
|
|
57
|
+
sw.start(json || quiet);
|
|
55
58
|
return validate({ root })
|
|
56
59
|
.then((issues) => {
|
|
57
60
|
const count = issues.length;
|
|
58
61
|
if (count) {
|
|
59
62
|
throw new Error(phrase.issuesFound(count));
|
|
60
63
|
}
|
|
61
|
-
sw.stop();
|
|
64
|
+
sw.stop(true);
|
|
62
65
|
sw = new SpinnerWheel("Packing... %s");
|
|
63
66
|
sw.start(json || quiet);
|
|
64
67
|
return pack({ input: argv.input, output: argv.output, root });
|
|
@@ -70,32 +73,18 @@ const start = function (argv) {
|
|
|
70
73
|
}
|
|
71
74
|
if (!quiet) {
|
|
72
75
|
sw.stop(true);
|
|
73
|
-
log.hs("
|
|
74
|
-
|
|
75
|
-
print(artifact, { toml: true });
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
log.p("Nothing to do.");
|
|
76
|
+
log.hs("Packed.");
|
|
77
|
+
print(artifact, { nl: true, toml: true });
|
|
79
78
|
}
|
|
80
79
|
})
|
|
81
|
-
.catch((ex) => {
|
|
82
|
-
const message = ex.message;
|
|
83
|
-
if (json) {
|
|
84
|
-
print({ error: { message } });
|
|
85
|
-
} else {
|
|
86
|
-
sw.stop(true);
|
|
87
|
-
log.hd("Pack aborted.");
|
|
88
|
-
log.p(message);
|
|
89
|
-
}
|
|
90
|
-
process.exit(1);
|
|
91
|
-
});
|
|
80
|
+
.catch((ex) => abort("Pack aborted.", ex, { json, sw }));
|
|
92
81
|
};
|
|
93
82
|
|
|
94
83
|
// [function]
|
|
95
84
|
|
|
96
85
|
const main = function (argv) {
|
|
97
86
|
return start(
|
|
98
|
-
yargs(hideBin(argv))
|
|
87
|
+
yargs(args.normalize(hideBin(argv)))
|
|
99
88
|
.scriptName(`${TOOL} ${COMMAND}`)
|
|
100
89
|
.usage("$0 [options]")
|
|
101
90
|
.option("input", {
|
|
@@ -122,12 +111,7 @@ const main = function (argv) {
|
|
|
122
111
|
describe: "Output only errors",
|
|
123
112
|
type: "boolean",
|
|
124
113
|
})
|
|
125
|
-
.option("cwd",
|
|
126
|
-
alias: "C",
|
|
127
|
-
default: ".",
|
|
128
|
-
describe: "Set the working directory",
|
|
129
|
-
type: "string",
|
|
130
|
-
})
|
|
114
|
+
.option("cwd", args.CWD)
|
|
131
115
|
.help("help")
|
|
132
116
|
.alias("help", "h")
|
|
133
117
|
.version(VERSION)
|
|
@@ -137,7 +121,7 @@ const main = function (argv) {
|
|
|
137
121
|
);
|
|
138
122
|
};
|
|
139
123
|
|
|
140
|
-
// [
|
|
124
|
+
// [start]
|
|
141
125
|
|
|
142
126
|
if (require.main === module) {
|
|
143
127
|
main(process.argv);
|
package/bin/arc-play.js
CHANGED
|
@@ -12,10 +12,12 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const args = require("../src/util/argv");
|
|
15
16
|
const cfgpackage = require("../src/config/package");
|
|
16
17
|
const cfgproduct = require("../src/config/product");
|
|
17
18
|
const cfguri = require("../src/config/uri");
|
|
18
19
|
const log = require("../src/util/log");
|
|
20
|
+
const output = require("../src/util/output");
|
|
19
21
|
const phrase = require("../src/phrase");
|
|
20
22
|
const play = require("../src/cli/play");
|
|
21
23
|
const rc = require("../src/util/rc");
|
|
@@ -24,6 +26,7 @@ const spinner = require("../src/util/spinner");
|
|
|
24
26
|
|
|
25
27
|
// [use]
|
|
26
28
|
|
|
29
|
+
const abort = output.abort;
|
|
27
30
|
const findRc = rc.findRc;
|
|
28
31
|
const launch = shell.launch;
|
|
29
32
|
const resolve = path.resolve;
|
|
@@ -41,8 +44,7 @@ const conf = {
|
|
|
41
44
|
browser: false,
|
|
42
45
|
game: "self",
|
|
43
46
|
quiet: false,
|
|
44
|
-
|
|
45
|
-
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
47
|
+
...findRc(TOOL, COMMAND, process.argv),
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
// [function]
|
|
@@ -72,25 +74,33 @@ const start = function (argv) {
|
|
|
72
74
|
throw new Error(phrase.noGameId());
|
|
73
75
|
}
|
|
74
76
|
sw.stop(true);
|
|
75
|
-
if (argv.
|
|
76
|
-
|
|
77
|
-
return;
|
|
77
|
+
if (data.fallback && !argv.quiet) {
|
|
78
|
+
log.pw(phrase.noProductionRelease());
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
const opening = argv.browser
|
|
81
|
+
? launch(url)
|
|
82
|
+
: launch(`${cfguri.HOST_APP_PLAY}/${orientation}/${url}`, url);
|
|
83
|
+
return Promise.all([opening, url]);
|
|
80
84
|
})
|
|
81
|
-
.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
.then(([where, url]) => {
|
|
86
|
+
if (!argv.quiet) {
|
|
87
|
+
if (where) {
|
|
88
|
+
log.result(phrase.opened(where), [url]);
|
|
89
|
+
} else {
|
|
90
|
+
log.result(phrase.unableToOpen(), [url, phrase.openToContinue()], {
|
|
91
|
+
color: "yellow",
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
.catch((ex) => abort("Play aborted.", ex, { sw }));
|
|
87
97
|
};
|
|
88
98
|
|
|
89
99
|
// [function]
|
|
90
100
|
|
|
91
101
|
const main = function (argv) {
|
|
92
102
|
return start(
|
|
93
|
-
yargs(hideBin(argv))
|
|
103
|
+
yargs(args.normalize(hideBin(argv)))
|
|
94
104
|
.scriptName(`${TOOL} ${COMMAND}`)
|
|
95
105
|
.usage("$0 [game] [options]")
|
|
96
106
|
.command("$0 [game]", false, (cli) =>
|
|
@@ -103,6 +113,9 @@ const main = function (argv) {
|
|
|
103
113
|
.option("release", {
|
|
104
114
|
alias: "r",
|
|
105
115
|
default: conf.release,
|
|
116
|
+
// without one, the action picks production, or staging when there's
|
|
117
|
+
// no production release yet (docs: arc-play.md).
|
|
118
|
+
defaultDescription: '"production"',
|
|
106
119
|
describe: "Release channel or version",
|
|
107
120
|
type: "string",
|
|
108
121
|
})
|
|
@@ -117,12 +130,7 @@ const main = function (argv) {
|
|
|
117
130
|
describe: "Output only errors",
|
|
118
131
|
type: "boolean",
|
|
119
132
|
})
|
|
120
|
-
.option("cwd",
|
|
121
|
-
alias: "C",
|
|
122
|
-
default: ".",
|
|
123
|
-
describe: "Set the working directory",
|
|
124
|
-
type: "string",
|
|
125
|
-
})
|
|
133
|
+
.option("cwd", args.CWD)
|
|
126
134
|
.help("help")
|
|
127
135
|
.alias("help", "h")
|
|
128
136
|
.version(VERSION)
|
|
@@ -132,7 +140,7 @@ const main = function (argv) {
|
|
|
132
140
|
);
|
|
133
141
|
};
|
|
134
142
|
|
|
135
|
-
// [
|
|
143
|
+
// [start]
|
|
136
144
|
|
|
137
145
|
if (require.main === module) {
|
|
138
146
|
main(process.argv);
|