arcadible 0.1.19 → 0.1.21
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/bin/arc-build.js +8 -6
- package/bin/arc-default.js +16 -11
- package/bin/arc-deploy.js +29 -25
- package/bin/arc-init.js +13 -9
- package/bin/arc-inspect.js +31 -16
- package/bin/arc-login.js +18 -10
- package/bin/arc-logout.js +29 -7
- package/bin/arc-open.js +114 -0
- package/bin/arc-pack.js +8 -6
- package/bin/arc-play.js +68 -18
- package/bin/arc-validate.js +10 -9
- package/bin/arc-whoami.js +14 -12
- package/bin/arc.js +7 -5
- package/package.json +3 -4
- package/product.json +9 -0
- package/src/account.js +14 -12
- package/src/action/deploy/tool-git.js +3 -3
- package/src/action/deploy/tool.js +6 -6
- package/src/action/init/manifest.js +3 -1
- package/src/action/inspect/media.js +6 -1
- package/src/action/inspect/tool.js +25 -9
- package/src/action/open/tool.js +24 -0
- package/src/action/pack/tool.js +10 -4
- package/src/action/play/tool.js +23 -26
- package/src/action/predeploy/ac.js +47 -12
- package/src/action/predeploy/git.js +3 -1
- package/src/action/predeploy/pm.js +41 -0
- package/src/action/predeploy/tool-git.js +25 -5
- package/src/action/predeploy/tool.js +14 -7
- package/src/api.js +16 -3
- package/src/cli/deploy.js +2 -2
- package/src/cli/index.js +2 -2
- package/src/cli/inspect.js +2 -2
- package/src/cli/{count.js → open.js} +2 -2
- package/src/cli/play.js +2 -2
- package/src/cli/predeploy.js +2 -2
- package/src/config/package.js +5 -0
- package/src/config/product.js +5 -0
- package/src/config/uri.js +13 -5
- package/src/config/url.js +3 -2
- package/src/config/workflow.js +9 -1
- package/src/parser/manifest.js +3 -1
- package/src/parser/media.js +3 -1
- package/src/parser/readme.js +6 -4
- package/src/phrase.js +73 -9
- package/src/prompt/template.js +14 -9
- package/src/schema/game.js +5 -2
- package/src/schema/workflow.js +5 -2
- package/src/util/http.js +3 -2
- package/src/util/output.js +2 -2
- package/src/util/rc.js +1 -1
- package/src/util/request.js +8 -6
- package/src/util/shell.js +52 -0
- package/src/util/video.js +6 -6
- package/bin/arc-count.js +0 -115
- package/bin/arc-predeploy.js +0 -2
- package/src/action/count/tool.js +0 -45
package/src/config/workflow.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
// [import]
|
|
4
|
+
|
|
5
|
+
const cfgproduct = require("./product");
|
|
6
|
+
|
|
7
|
+
// [declare]
|
|
8
|
+
|
|
9
|
+
const HANDLE = cfgproduct.handle;
|
|
10
|
+
|
|
3
11
|
// [export]
|
|
4
12
|
|
|
5
13
|
module.exports = {
|
|
6
14
|
/* eslint-disable camelcase */
|
|
7
15
|
build: "",
|
|
8
|
-
deploy_dir:
|
|
16
|
+
deploy_dir: `.${HANDLE}-public`,
|
|
9
17
|
/* eslint-enable camelcase */
|
|
10
18
|
};
|
package/src/parser/manifest.js
CHANGED
|
@@ -10,6 +10,7 @@ const fs = require("fs-extra");
|
|
|
10
10
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
|
+
const cfgproduct = require("../config/product");
|
|
13
14
|
const objs = require("../util/objs");
|
|
14
15
|
const phrase = require("../phrase");
|
|
15
16
|
const TOML = require("../util/toml");
|
|
@@ -23,7 +24,8 @@ const readFile = fs.readFile;
|
|
|
23
24
|
|
|
24
25
|
// [declare]
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const HANDLE = cfgproduct.handle;
|
|
28
|
+
const MANIFEST = `${HANDLE}.toml`;
|
|
27
29
|
|
|
28
30
|
// [function]
|
|
29
31
|
|
package/src/parser/media.js
CHANGED
|
@@ -10,6 +10,7 @@ const fs = require("fs-extra");
|
|
|
10
10
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
|
+
const cfgproduct = require("../config/product");
|
|
13
14
|
const objs = require("../util/objs");
|
|
14
15
|
|
|
15
16
|
// [use]
|
|
@@ -38,7 +39,8 @@ const ART = [
|
|
|
38
39
|
|
|
39
40
|
// [declare]
|
|
40
41
|
|
|
41
|
-
const
|
|
42
|
+
const HANDLE = cfgproduct.handle;
|
|
43
|
+
const MEDIA = `.${HANDLE}`;
|
|
42
44
|
|
|
43
45
|
// [function]
|
|
44
46
|
|
package/src/parser/readme.js
CHANGED
|
@@ -10,6 +10,7 @@ const fs = require("fs-extra");
|
|
|
10
10
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
|
+
const cfgproduct = require("../config/product");
|
|
13
14
|
const dom = require("../util/dom");
|
|
14
15
|
const MD = require("../util/md");
|
|
15
16
|
const objs = require("../util/objs");
|
|
@@ -26,7 +27,8 @@ const trimWhitespace = strs.trimWhitespace;
|
|
|
26
27
|
|
|
27
28
|
// [declare]
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
+
const HANDLE = cfgproduct.handle;
|
|
31
|
+
const README = [`${HANDLE}.md`, "README.md"];
|
|
30
32
|
|
|
31
33
|
// [function]
|
|
32
34
|
|
|
@@ -95,7 +97,7 @@ const extractDescription = function (doc) {
|
|
|
95
97
|
const parts = [];
|
|
96
98
|
let node = first.nextSibling;
|
|
97
99
|
while (node && node !== last) {
|
|
98
|
-
parts.push(node.outerHTML
|
|
100
|
+
parts.push(node.outerHTML ?? node.textContent);
|
|
99
101
|
node = node.nextSibling;
|
|
100
102
|
}
|
|
101
103
|
return trimWhitespace(parts.join(""));
|
|
@@ -135,7 +137,7 @@ const findReadme = function (root) {
|
|
|
135
137
|
README.map((file) =>
|
|
136
138
|
pathExists(join(root, file)).then((exists) => (exists ? file : null)),
|
|
137
139
|
),
|
|
138
|
-
).then((files) => files.find(Boolean)
|
|
140
|
+
).then((files) => files.find(Boolean) ?? null);
|
|
139
141
|
};
|
|
140
142
|
|
|
141
143
|
// [function]
|
|
@@ -145,7 +147,7 @@ const main = function (root) {
|
|
|
145
147
|
.then((file) => (file ? readFile(join(root, file), "utf8") : null))
|
|
146
148
|
.then((buf) => (buf === null ? null : parseReadme(buf)))
|
|
147
149
|
.then(deepCompact)
|
|
148
|
-
.then((game) => ({ game: game
|
|
150
|
+
.then((game) => ({ game: game ?? null }));
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
// [export]
|
package/src/phrase.js
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
// [import]
|
|
4
|
+
|
|
5
|
+
const cfgproduct = require("./config/product");
|
|
6
|
+
|
|
7
|
+
// [declare]
|
|
8
|
+
|
|
9
|
+
const TOOL = cfgproduct.tool;
|
|
10
|
+
|
|
11
|
+
// [function]
|
|
12
|
+
|
|
13
|
+
const cmdInit = function () {
|
|
14
|
+
return `\`${TOOL} init\``;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// [function]
|
|
18
|
+
|
|
19
|
+
const cmdInspect = function () {
|
|
20
|
+
return `\`${TOOL} inspect\``;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// [function]
|
|
24
|
+
|
|
25
|
+
const cmdLogin = function () {
|
|
26
|
+
return `\`${TOOL} login\``;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// [function]
|
|
30
|
+
|
|
31
|
+
const cmdValidate = function () {
|
|
32
|
+
return `\`${TOOL} validate\``;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// [function]
|
|
36
|
+
|
|
37
|
+
const gameExists = function (idOrHandle) {
|
|
38
|
+
return `Game exists: ${idOrHandle}`;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// [function]
|
|
42
|
+
|
|
43
|
+
const gameVersionExists = function (version) {
|
|
44
|
+
return `Game version exists: ${version}`;
|
|
45
|
+
};
|
|
46
|
+
|
|
3
47
|
// [function]
|
|
4
48
|
|
|
5
49
|
const gitChangesPresent = function () {
|
|
@@ -57,7 +101,7 @@ const gitVersionExists = function () {
|
|
|
57
101
|
// [function]
|
|
58
102
|
|
|
59
103
|
const issuesFound = function (count) {
|
|
60
|
-
return `${count} ${count === 1 ? "issue" : "issues"} found. Run
|
|
104
|
+
return `${count} ${count === 1 ? "issue" : "issues"} found. Run ${cmdValidate()} for details.`;
|
|
61
105
|
};
|
|
62
106
|
|
|
63
107
|
// [function]
|
|
@@ -74,6 +118,18 @@ const loginFailed = function () {
|
|
|
74
118
|
|
|
75
119
|
// [function]
|
|
76
120
|
|
|
121
|
+
const noGameId = function () {
|
|
122
|
+
return "No game handle or ID.";
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// [function]
|
|
126
|
+
|
|
127
|
+
const noLockFile = function () {
|
|
128
|
+
return "No lock file found.";
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// [function]
|
|
132
|
+
|
|
77
133
|
const noProductionBuild = function () {
|
|
78
134
|
return "No production build found.";
|
|
79
135
|
};
|
|
@@ -81,7 +137,7 @@ const noProductionBuild = function () {
|
|
|
81
137
|
// [function]
|
|
82
138
|
|
|
83
139
|
const notLoggedIn = function () {
|
|
84
|
-
return
|
|
140
|
+
return `Not logged in. Run ${cmdLogin()} to log in.`;
|
|
85
141
|
};
|
|
86
142
|
|
|
87
143
|
// [function]
|
|
@@ -122,25 +178,31 @@ const timedOut = function () {
|
|
|
122
178
|
|
|
123
179
|
// [function]
|
|
124
180
|
|
|
125
|
-
const
|
|
126
|
-
return `Unable to
|
|
181
|
+
const unableToFind = function (file) {
|
|
182
|
+
return `Unable to find: ${file}`;
|
|
127
183
|
};
|
|
128
184
|
|
|
129
185
|
// [function]
|
|
130
186
|
|
|
131
|
-
const
|
|
132
|
-
return `
|
|
187
|
+
const unableToParse = function (file, message) {
|
|
188
|
+
return `Unable to parse ${file}: ${message}`;
|
|
133
189
|
};
|
|
134
190
|
|
|
135
191
|
// [function]
|
|
136
192
|
|
|
137
|
-
const
|
|
138
|
-
return `
|
|
193
|
+
const uploadFailed = function (status) {
|
|
194
|
+
return `Upload failed with status ${status}.`;
|
|
139
195
|
};
|
|
140
196
|
|
|
141
197
|
// [export]
|
|
142
198
|
|
|
143
199
|
module.exports = {
|
|
200
|
+
cmdInit,
|
|
201
|
+
cmdInspect,
|
|
202
|
+
cmdLogin,
|
|
203
|
+
cmdValidate,
|
|
204
|
+
gameExists,
|
|
205
|
+
gameVersionExists,
|
|
144
206
|
gitChangesPresent,
|
|
145
207
|
gitRemoteMissing,
|
|
146
208
|
gitRepoMissing,
|
|
@@ -150,6 +212,8 @@ module.exports = {
|
|
|
150
212
|
issuesFound,
|
|
151
213
|
loginExpired,
|
|
152
214
|
loginFailed,
|
|
215
|
+
noGameId,
|
|
216
|
+
noLockFile,
|
|
153
217
|
noProductionBuild,
|
|
154
218
|
noVideoMetadata,
|
|
155
219
|
noVideoTrack,
|
|
@@ -158,7 +222,7 @@ module.exports = {
|
|
|
158
222
|
packageFileMissing,
|
|
159
223
|
packageTooLarge,
|
|
160
224
|
timedOut,
|
|
225
|
+
unableToFind,
|
|
161
226
|
unableToParse,
|
|
162
227
|
uploadFailed,
|
|
163
|
-
versionExists,
|
|
164
228
|
};
|
package/src/prompt/template.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
// [import]
|
|
4
|
+
|
|
5
|
+
const cfgproduct = require("../config/product");
|
|
6
|
+
|
|
3
7
|
// [declare]
|
|
4
8
|
|
|
5
|
-
const
|
|
9
|
+
const HANDLE = cfgproduct.handle;
|
|
10
|
+
const STARTER = `${HANDLE}/starter`;
|
|
6
11
|
|
|
7
12
|
// [export]
|
|
8
13
|
|
|
@@ -10,32 +15,32 @@ module.exports = {
|
|
|
10
15
|
select: {
|
|
11
16
|
choices: [
|
|
12
17
|
{
|
|
13
|
-
description: "
|
|
14
|
-
name: "
|
|
15
|
-
value:
|
|
18
|
+
description: "Blank JavaScript starter.",
|
|
19
|
+
name: "Blank",
|
|
20
|
+
value: STARTER,
|
|
16
21
|
},
|
|
17
22
|
{
|
|
18
23
|
description: "Three.js starter.",
|
|
19
24
|
name: "Three.js",
|
|
20
|
-
value: `${
|
|
25
|
+
value: `${STARTER}-threejs`,
|
|
21
26
|
},
|
|
22
27
|
{
|
|
23
28
|
description: "Phaser starter.",
|
|
24
29
|
name: "Phaser",
|
|
25
|
-
value: `${
|
|
30
|
+
value: `${STARTER}-phaser`,
|
|
26
31
|
},
|
|
27
32
|
{
|
|
28
33
|
description: "PixiJS starter.",
|
|
29
34
|
name: "PixiJS",
|
|
30
|
-
value: `${
|
|
35
|
+
value: `${STARTER}-pixijs`,
|
|
31
36
|
},
|
|
32
37
|
{
|
|
33
38
|
description: "Babylon.js starter.",
|
|
34
39
|
name: "Babylon.js",
|
|
35
|
-
value: `${
|
|
40
|
+
value: `${STARTER}-babylonjs`,
|
|
36
41
|
},
|
|
37
42
|
],
|
|
38
|
-
default:
|
|
43
|
+
default: STARTER,
|
|
39
44
|
message: "Template",
|
|
40
45
|
},
|
|
41
46
|
};
|
package/src/schema/game.js
CHANGED
|
@@ -13,10 +13,12 @@ const cfggenre = require("../config/genre");
|
|
|
13
13
|
const cfghtml = require("../config/html");
|
|
14
14
|
const cfginput = require("../config/input");
|
|
15
15
|
const cfgorientation = require("../config/orientation");
|
|
16
|
+
const cfgproduct = require("../config/product");
|
|
16
17
|
const cfgurl = require("../config/url");
|
|
17
18
|
const cfgvisibility = require("../config/visibility");
|
|
18
19
|
const check = require("./check/game");
|
|
19
20
|
const dom = require("../util/dom");
|
|
21
|
+
const phrase = require("../phrase");
|
|
20
22
|
const size = require("../util/size");
|
|
21
23
|
const strs = require("../util/strs");
|
|
22
24
|
|
|
@@ -34,7 +36,8 @@ const videoCheck = check.video;
|
|
|
34
36
|
|
|
35
37
|
// [declare]
|
|
36
38
|
|
|
37
|
-
const
|
|
39
|
+
const HANDLE = cfgproduct.handle;
|
|
40
|
+
const MEDIA = `.${HANDLE}`;
|
|
38
41
|
|
|
39
42
|
// [function]
|
|
40
43
|
|
|
@@ -305,7 +308,7 @@ const zId = function () {
|
|
|
305
308
|
.string(
|
|
306
309
|
message(field, [
|
|
307
310
|
"Must be defined.",
|
|
308
|
-
|
|
311
|
+
`Run ${phrase.cmdInit()} to generate a new game ID.`,
|
|
309
312
|
]),
|
|
310
313
|
)
|
|
311
314
|
.uuid(message(field, ["Must be a valid UUID."]))
|
package/src/schema/workflow.js
CHANGED
|
@@ -7,8 +7,10 @@ const z = require("zod");
|
|
|
7
7
|
|
|
8
8
|
// [import]
|
|
9
9
|
|
|
10
|
+
const cfgproduct = require("../config/product");
|
|
10
11
|
const cfgurl = require("../config/url");
|
|
11
12
|
const check = require("./check/workflow");
|
|
13
|
+
const phrase = require("../phrase");
|
|
12
14
|
const strs = require("../util/strs");
|
|
13
15
|
|
|
14
16
|
// [use]
|
|
@@ -21,7 +23,8 @@ const isReservedCheck = check.isReserved;
|
|
|
21
23
|
|
|
22
24
|
// [declare]
|
|
23
25
|
|
|
24
|
-
const
|
|
26
|
+
const HANDLE = cfgproduct.handle;
|
|
27
|
+
const MEDIA = `.${HANDLE}`;
|
|
25
28
|
|
|
26
29
|
// [function]
|
|
27
30
|
|
|
@@ -71,7 +74,7 @@ const zDeployDir = function (root, { build }) {
|
|
|
71
74
|
(file) => build || existsCheck(root, file),
|
|
72
75
|
message(field, [
|
|
73
76
|
"Must exist when no build step is defined.",
|
|
74
|
-
|
|
77
|
+
`Run ${phrase.cmdInspect()} for details.`,
|
|
75
78
|
]),
|
|
76
79
|
);
|
|
77
80
|
};
|
package/src/util/http.js
CHANGED
|
@@ -6,10 +6,11 @@ const HttpError = class extends Error {
|
|
|
6
6
|
|
|
7
7
|
// [constructor]
|
|
8
8
|
|
|
9
|
-
constructor(status, message) {
|
|
9
|
+
constructor(status, { message, title }) {
|
|
10
10
|
super(message);
|
|
11
|
-
this.name = "HttpError";
|
|
12
11
|
this.status = status;
|
|
12
|
+
this.name = title;
|
|
13
|
+
this.message = `HttpError: ${this.name} (${this.status})`;
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
16
|
|
package/src/util/output.js
CHANGED
|
@@ -23,8 +23,8 @@ const printJson = function (data) {
|
|
|
23
23
|
|
|
24
24
|
// [function]
|
|
25
25
|
|
|
26
|
-
const printToml = function (data, key
|
|
27
|
-
const field = key.split(".").at(-1);
|
|
26
|
+
const printToml = function (data, key) {
|
|
27
|
+
const field = (key ?? "value").split(".").at(-1);
|
|
28
28
|
if (data === null) {
|
|
29
29
|
write(`# ${field} = null`);
|
|
30
30
|
return;
|
package/src/util/rc.js
CHANGED
|
@@ -33,7 +33,7 @@ const config = function (cmd, argv, option) {
|
|
|
33
33
|
// [function]
|
|
34
34
|
|
|
35
35
|
const findRc = function (cmd, subcmd, argv, option) {
|
|
36
|
-
return rc(cmd, {}, { config: config(cmd, argv, option) })[subcmd]
|
|
36
|
+
return rc(cmd, {}, { config: config(cmd, argv, option) })[subcmd] ?? {};
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
// [export]
|
package/src/util/request.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
// [import]
|
|
4
4
|
|
|
5
|
+
const cfgpackage = require("../config/package");
|
|
6
|
+
const cfgproduct = require("../config/product");
|
|
5
7
|
const http = require("./http");
|
|
6
|
-
const pkg = require("../../package.json");
|
|
7
8
|
|
|
8
9
|
// [use]
|
|
9
10
|
|
|
@@ -11,15 +12,16 @@ const HttpError = http.HttpError;
|
|
|
11
12
|
|
|
12
13
|
// [declare]
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
-
const
|
|
15
|
+
const CLIENT = cfgproduct.client;
|
|
16
|
+
const ID = cfgproduct.id;
|
|
17
|
+
const VERSION = cfgpackage.version;
|
|
16
18
|
|
|
17
19
|
// [function]
|
|
18
20
|
|
|
19
21
|
const parse = function (resp) {
|
|
20
22
|
return resp.json().then((json) => {
|
|
21
23
|
if (!resp.ok) {
|
|
22
|
-
throw new HttpError(resp.status, json.data
|
|
24
|
+
throw new HttpError(resp.status, json.data);
|
|
23
25
|
}
|
|
24
26
|
return json.data;
|
|
25
27
|
});
|
|
@@ -29,8 +31,8 @@ const parse = function (resp) {
|
|
|
29
31
|
|
|
30
32
|
const send = function (method, url, form, { token } = {}) {
|
|
31
33
|
const headers = [
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
+
[`X-${CLIENT}-Client-Id`, ID],
|
|
35
|
+
[`X-${CLIENT}-Client-Version`, VERSION],
|
|
34
36
|
];
|
|
35
37
|
if (token) {
|
|
36
38
|
headers.push(["Authorization", `Bearer ${token}`]);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// [import]
|
|
4
|
+
|
|
5
|
+
const cp = require("node:child_process");
|
|
6
|
+
|
|
7
|
+
// [import]
|
|
8
|
+
|
|
9
|
+
const open = require("open");
|
|
10
|
+
|
|
11
|
+
// [use]
|
|
12
|
+
|
|
13
|
+
const execFile = cp.execFile;
|
|
14
|
+
|
|
15
|
+
// [function]
|
|
16
|
+
|
|
17
|
+
const canLaunch = function (scheme) {
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
switch (process.platform) {
|
|
20
|
+
case "darwin":
|
|
21
|
+
execFile("open", ["-Ra", scheme], (err) => resolve(!err));
|
|
22
|
+
break;
|
|
23
|
+
case "win32":
|
|
24
|
+
execFile("reg", ["query", `HKCR\\${scheme}`], (err) => resolve(!err));
|
|
25
|
+
break;
|
|
26
|
+
case "linux":
|
|
27
|
+
execFile(
|
|
28
|
+
"xdg-mime",
|
|
29
|
+
["query", "default", `x-scheme-handler/${scheme}`],
|
|
30
|
+
(err, stdout) => resolve(!err && Boolean(stdout.trim())),
|
|
31
|
+
);
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
resolve(false);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// [function]
|
|
40
|
+
|
|
41
|
+
const launch = function (uri, fallback) {
|
|
42
|
+
const scheme = new URL(uri).protocol.slice(0, -1);
|
|
43
|
+
return scheme === "http" || scheme === "https"
|
|
44
|
+
? open(uri).catch(() => {})
|
|
45
|
+
: canLaunch(scheme)
|
|
46
|
+
.then((can) => (can ? open(uri) : fallback && open(fallback)))
|
|
47
|
+
.catch(() => {});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// [export]
|
|
51
|
+
|
|
52
|
+
module.exports = { launch };
|
package/src/util/video.js
CHANGED
|
@@ -46,12 +46,12 @@ const checkSize = function (file, maxSize) {
|
|
|
46
46
|
const readMp4 = function (file) {
|
|
47
47
|
const data = readFileSync(file);
|
|
48
48
|
const mp4 = createFile();
|
|
49
|
-
let
|
|
49
|
+
let err = null;
|
|
50
50
|
let video = null;
|
|
51
51
|
mp4.onReady = (info) => {
|
|
52
52
|
const track = info.tracks.find((t) => t.video);
|
|
53
|
-
if (!track
|
|
54
|
-
|
|
53
|
+
if (!track?.video) {
|
|
54
|
+
err = new Error(phrase.noVideoTrack());
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
video = {
|
|
@@ -61,7 +61,7 @@ const readMp4 = function (file) {
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
mp4.onError = (mod, msg) => {
|
|
64
|
-
|
|
64
|
+
err = new Error(msg);
|
|
65
65
|
};
|
|
66
66
|
const buffer = data.buffer.slice(
|
|
67
67
|
data.byteOffset,
|
|
@@ -70,8 +70,8 @@ const readMp4 = function (file) {
|
|
|
70
70
|
buffer.fileStart = 0;
|
|
71
71
|
mp4.appendBuffer(buffer);
|
|
72
72
|
mp4.flush();
|
|
73
|
-
if (
|
|
74
|
-
throw
|
|
73
|
+
if (err) {
|
|
74
|
+
throw err;
|
|
75
75
|
}
|
|
76
76
|
if (!video) {
|
|
77
77
|
throw new Error(phrase.noVideoMetadata());
|
package/bin/arc-count.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
// [import]
|
|
5
|
-
|
|
6
|
-
const path = require("node:path");
|
|
7
|
-
|
|
8
|
-
// [import]
|
|
9
|
-
|
|
10
|
-
const hideBin = require("yargs/helpers").hideBin;
|
|
11
|
-
const yargs = require("yargs/yargs");
|
|
12
|
-
|
|
13
|
-
// [import]
|
|
14
|
-
|
|
15
|
-
const count = require("../src/cli/count");
|
|
16
|
-
const log = require("../src/util/log");
|
|
17
|
-
const output = require("../src/util/output");
|
|
18
|
-
const pkg = require("../package.json");
|
|
19
|
-
const rc = require("../src/util/rc");
|
|
20
|
-
|
|
21
|
-
// [use]
|
|
22
|
-
|
|
23
|
-
const findRc = rc.findRc;
|
|
24
|
-
const print = output.print;
|
|
25
|
-
const resolve = path.resolve;
|
|
26
|
-
|
|
27
|
-
// [declare]
|
|
28
|
-
|
|
29
|
-
const CMD = "arc";
|
|
30
|
-
const SUBCMD = "count";
|
|
31
|
-
|
|
32
|
-
// [define]
|
|
33
|
-
|
|
34
|
-
const conf = {
|
|
35
|
-
game: "self",
|
|
36
|
-
json: false,
|
|
37
|
-
selector: "",
|
|
38
|
-
...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// [function]
|
|
42
|
-
|
|
43
|
-
const start = function (argv) {
|
|
44
|
-
const json = argv.json;
|
|
45
|
-
const selector = argv.selector;
|
|
46
|
-
return count({
|
|
47
|
-
game: argv.game,
|
|
48
|
-
root: resolve(process.cwd(), argv.cwd),
|
|
49
|
-
selector,
|
|
50
|
-
})
|
|
51
|
-
.then((data) => {
|
|
52
|
-
print(data, { key: selector, toml: !json });
|
|
53
|
-
})
|
|
54
|
-
.catch((ex) => {
|
|
55
|
-
const message = ex.message;
|
|
56
|
-
if (json) {
|
|
57
|
-
print({ error: { message } });
|
|
58
|
-
} else {
|
|
59
|
-
log.hd("Count aborted.");
|
|
60
|
-
log.p(message);
|
|
61
|
-
}
|
|
62
|
-
process.exit(1);
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// [function]
|
|
67
|
-
|
|
68
|
-
const main = function (argv) {
|
|
69
|
-
return start(
|
|
70
|
-
yargs(hideBin(argv))
|
|
71
|
-
.scriptName(`${CMD} ${SUBCMD}`)
|
|
72
|
-
.usage("$0 [selector] [options]")
|
|
73
|
-
.command("$0 [selector]", false, (cli) =>
|
|
74
|
-
cli.positional("selector", {
|
|
75
|
-
default: conf.selector,
|
|
76
|
-
describe: "Property selector",
|
|
77
|
-
type: "string",
|
|
78
|
-
}),
|
|
79
|
-
)
|
|
80
|
-
.option("game", {
|
|
81
|
-
alias: "g",
|
|
82
|
-
default: conf.game,
|
|
83
|
-
describe: "Game handle or ID",
|
|
84
|
-
type: "string",
|
|
85
|
-
})
|
|
86
|
-
.option("json", {
|
|
87
|
-
alias: "j",
|
|
88
|
-
default: conf.json,
|
|
89
|
-
describe: "Format output as JSON",
|
|
90
|
-
type: "boolean",
|
|
91
|
-
})
|
|
92
|
-
.option("cwd", {
|
|
93
|
-
alias: "C",
|
|
94
|
-
default: ".",
|
|
95
|
-
describe: "Set the working directory",
|
|
96
|
-
type: "string",
|
|
97
|
-
})
|
|
98
|
-
.help("help")
|
|
99
|
-
.alias("help", "h")
|
|
100
|
-
.version(pkg.version)
|
|
101
|
-
.alias("version", "v")
|
|
102
|
-
.strict()
|
|
103
|
-
.parse(),
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// [main]
|
|
108
|
-
|
|
109
|
-
if (require.main === module) {
|
|
110
|
-
main(process.argv);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// [export]
|
|
114
|
-
|
|
115
|
-
module.exports = { main };
|
package/bin/arc-predeploy.js
DELETED
package/src/action/count/tool.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
// [import]
|
|
4
|
-
|
|
5
|
-
const dotProp = require("dot-prop");
|
|
6
|
-
|
|
7
|
-
// [import]
|
|
8
|
-
|
|
9
|
-
const api = require("../../api");
|
|
10
|
-
const media = require("./media");
|
|
11
|
-
const phrase = require("../../phrase");
|
|
12
|
-
const project = require("../../parser/project");
|
|
13
|
-
|
|
14
|
-
// [function]
|
|
15
|
-
|
|
16
|
-
const inspect = function (proj, key) {
|
|
17
|
-
return key ? dotProp.get(proj, key, null) : proj;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// [function]
|
|
21
|
-
|
|
22
|
-
const main = function ({ game, root, selector }) {
|
|
23
|
-
if (!game || game === "self") {
|
|
24
|
-
return project(root).then((proj) => inspect(proj, selector));
|
|
25
|
-
}
|
|
26
|
-
return api
|
|
27
|
-
.discoverGameBuilds(game, {
|
|
28
|
-
channel: "production",
|
|
29
|
-
select: "manifest",
|
|
30
|
-
})
|
|
31
|
-
.then((builds) => {
|
|
32
|
-
if (!builds.length) {
|
|
33
|
-
throw new Error(phrase.noProductionBuild(game));
|
|
34
|
-
}
|
|
35
|
-
const manifest = builds[0].manifest || {};
|
|
36
|
-
if (manifest.game) {
|
|
37
|
-
media.dehydrate(manifest.game);
|
|
38
|
-
}
|
|
39
|
-
return inspect(manifest, selector);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// [export]
|
|
44
|
-
|
|
45
|
-
module.exports = main;
|