arcadible 0.1.32 → 0.1.33
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 +4 -4
- package/bin/arc-build.js +23 -5
- package/bin/arc-deploy.js +78 -13
- package/bin/arc-init.js +6 -1
- package/bin/arc-inspect.js +1 -0
- package/bin/arc-login.js +4 -1
- package/bin/arc-open.js +4 -1
- package/bin/arc-pack.js +23 -3
- package/bin/arc-play.js +4 -1
- package/bin/arc-validate.js +1 -0
- package/bin/arc-whoami.js +1 -0
- package/package.json +3 -3
- package/src/account.js +7 -4
- package/src/action/build/tool.js +8 -4
- package/src/action/deploy/tool-git.js +49 -61
- package/src/action/deploy/tool.js +50 -44
- package/src/action/deploy/wait.js +10 -9
- package/src/action/init/manifest.js +23 -6
- package/src/action/init/tool-patch.js +1 -7
- package/src/action/init/tool.js +12 -9
- package/src/action/login/flow.js +7 -3
- package/src/action/pack/limits.js +13 -3
- package/src/action/pack/tool.js +19 -6
- package/src/action/play/tool.js +7 -1
- package/src/action/predeploy/ac.js +39 -22
- package/src/action/predeploy/git.js +55 -58
- package/src/action/predeploy/pm.js +24 -17
- package/src/action/predeploy/published.js +15 -2
- package/src/action/predeploy/tool-git.js +45 -90
- package/src/action/predeploy/tool.js +7 -33
- package/src/action/validate/tool.js +5 -4
- package/src/api.js +0 -1
- package/src/config/code.js +111 -0
- package/src/config/url.js +2 -1
- package/src/parser/env.js +12 -2
- package/src/parser/given.js +17 -0
- package/src/parser/manifest.js +8 -1
- package/src/parser/media.js +5 -9
- package/src/parser/project.js +4 -1
- package/src/parser/readme-file.js +8 -1
- package/src/phrase.js +42 -0
- package/src/schema/check/game.js +5 -26
- package/src/schema/game.js +117 -210
- package/src/schema/message.js +46 -7
- package/src/schema/readme.js +8 -3
- package/src/schema/workflow.js +35 -15
- package/src/util/argv.js +33 -1
- package/src/util/delay.js +4 -1
- package/src/util/error.js +49 -0
- package/src/util/image.js +4 -30
- package/src/util/log.js +8 -0
- package/src/util/media.js +40 -0
- package/src/util/output.js +34 -4
- package/src/util/request.js +11 -2
- package/src/util/s3.js +37 -20
- package/src/util/schema.js +93 -30
- package/src/util/video.js +4 -27
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://developer.arcadible.com/references/arcadible-cli">Docs</a> ·
|
|
15
|
-
<a href="https://developer.arcadible.com/
|
|
15
|
+
<a href="https://developer.arcadible.com/getting-started">Getting Started</a> ·
|
|
16
16
|
<a href="https://arcadible.com">Arcadible</a> ·
|
|
17
17
|
<a href="https://studio.arcadible.com">Studio</a>
|
|
18
18
|
</p>
|
|
@@ -57,10 +57,10 @@ Run `arc <command> --help` for its options, or see the [CLI reference](https://d
|
|
|
57
57
|
|
|
58
58
|
## Learn more
|
|
59
59
|
|
|
60
|
-
- [Getting Started](https://developer.arcadible.com/
|
|
60
|
+
- [Getting Started](https://developer.arcadible.com/getting-started): from an empty directory to a public game.
|
|
61
61
|
- [The manifest](https://developer.arcadible.com/references/arcadible-manifest): every field in `arcadible.toml`.
|
|
62
|
-
- [Deploying from GitHub](https://developer.arcadible.com/
|
|
63
|
-
- [Releases](https://developer.arcadible.com/
|
|
62
|
+
- [Deploying from GitHub](https://developer.arcadible.com/publish/deploying-from-github): release with a tag, built by GitHub Actions.
|
|
63
|
+
- [Releases](https://developer.arcadible.com/publish/releases): where a release's result shows, and how to fix a failed one.
|
|
64
64
|
|
|
65
65
|
## License
|
|
66
66
|
|
package/bin/arc-build.js
CHANGED
|
@@ -14,11 +14,14 @@ const yargs = require("yargs/yargs");
|
|
|
14
14
|
|
|
15
15
|
const args = require("../src/util/argv");
|
|
16
16
|
const build = require("../src/cli/build");
|
|
17
|
+
const cfgcode = require("../src/config/code");
|
|
17
18
|
const cfgpackage = require("../src/config/package");
|
|
18
19
|
const cfgproduct = require("../src/config/product");
|
|
20
|
+
const error = require("../src/util/error");
|
|
19
21
|
const log = require("../src/util/log");
|
|
20
22
|
const output = require("../src/util/output");
|
|
21
23
|
const phrase = require("../src/phrase");
|
|
24
|
+
const project = require("../src/parser/project");
|
|
22
25
|
const rc = require("../src/util/rc");
|
|
23
26
|
const spinner = require("../src/util/spinner");
|
|
24
27
|
const validate = require("../src/cli/validate");
|
|
@@ -26,6 +29,7 @@ const validate = require("../src/cli/validate");
|
|
|
26
29
|
// [use]
|
|
27
30
|
|
|
28
31
|
const abort = output.abort;
|
|
32
|
+
const ArcError = error.ArcError;
|
|
29
33
|
const findRc = rc.findRc;
|
|
30
34
|
const print = output.print;
|
|
31
35
|
const relative = path.relative;
|
|
@@ -52,18 +56,28 @@ const start = function (argv) {
|
|
|
52
56
|
const json = argv.json;
|
|
53
57
|
const quiet = argv.quiet;
|
|
54
58
|
const root = resolve(process.cwd(), argv.cwd);
|
|
59
|
+
// the project, parsed once for both steps.
|
|
60
|
+
let parsed = null;
|
|
55
61
|
let sw = new SpinnerWheel("Validating... %s");
|
|
56
62
|
sw.start(json || quiet);
|
|
57
|
-
return
|
|
63
|
+
return project(root)
|
|
64
|
+
.then((proj) => {
|
|
65
|
+
parsed = proj;
|
|
66
|
+
return validate({ project: parsed, root });
|
|
67
|
+
})
|
|
58
68
|
.then((issues) => {
|
|
59
69
|
const count = issues.length;
|
|
60
70
|
if (count) {
|
|
61
|
-
throw new
|
|
71
|
+
throw new ArcError(
|
|
72
|
+
cfgcode.VALIDATION_FAILED,
|
|
73
|
+
phrase.issuesFound(count),
|
|
74
|
+
{ data: { issues } },
|
|
75
|
+
);
|
|
62
76
|
}
|
|
63
77
|
sw.stop(true);
|
|
64
78
|
sw = new SpinnerWheel("Building... %s");
|
|
65
79
|
sw.start(json || quiet);
|
|
66
|
-
return build({ root });
|
|
80
|
+
return build({ project: parsed, root });
|
|
67
81
|
})
|
|
68
82
|
.then((artifact) => {
|
|
69
83
|
if (json) {
|
|
@@ -72,16 +86,19 @@ const start = function (argv) {
|
|
|
72
86
|
}
|
|
73
87
|
if (!quiet) {
|
|
74
88
|
sw.stop(true);
|
|
75
|
-
|
|
89
|
+
// the heading says what happened: built, built without deploy_dir
|
|
90
|
+
// (a caveat, so yellow), or no build to run.
|
|
76
91
|
if (artifact?.path) {
|
|
92
|
+
log.hs("Built.");
|
|
77
93
|
print(artifact, { nl: true, toml: true });
|
|
78
94
|
return;
|
|
79
95
|
}
|
|
80
96
|
if (artifact?.missing) {
|
|
97
|
+
log.result("Built.", [], { color: "yellow" });
|
|
81
98
|
log.nlpw(phrase.buildOutputMissing(relative(root, artifact.missing)));
|
|
82
99
|
return;
|
|
83
100
|
}
|
|
84
|
-
log.
|
|
101
|
+
log.hs("Nothing to do.");
|
|
85
102
|
}
|
|
86
103
|
})
|
|
87
104
|
.catch((ex) => abort("Build aborted.", ex, { json, sw }));
|
|
@@ -111,6 +128,7 @@ const main = function (argv) {
|
|
|
111
128
|
.alias("help", "h")
|
|
112
129
|
.version(VERSION)
|
|
113
130
|
.alias("version", "v")
|
|
131
|
+
.fail(args.fail(argv))
|
|
114
132
|
.strict()
|
|
115
133
|
.parse(),
|
|
116
134
|
);
|
package/bin/arc-deploy.js
CHANGED
|
@@ -14,15 +14,18 @@ const yargs = require("yargs/yargs");
|
|
|
14
14
|
|
|
15
15
|
const args = require("../src/util/argv");
|
|
16
16
|
const build = require("../src/cli/build");
|
|
17
|
+
const cfgcode = require("../src/config/code");
|
|
17
18
|
const cfgpackage = require("../src/config/package");
|
|
18
19
|
const cfgproduct = require("../src/config/product");
|
|
19
20
|
const deploy = require("../src/cli/deploy");
|
|
21
|
+
const error = require("../src/util/error");
|
|
20
22
|
const log = require("../src/util/log");
|
|
21
23
|
const output = require("../src/util/output");
|
|
22
24
|
const pack = require("../src/cli/pack");
|
|
23
25
|
const phrase = require("../src/phrase");
|
|
24
26
|
const predeploy = require("../src/cli/predeploy");
|
|
25
27
|
const progress = require("../src/util/progress");
|
|
28
|
+
const project = require("../src/parser/project");
|
|
26
29
|
const rc = require("../src/util/rc");
|
|
27
30
|
const spinner = require("../src/util/spinner");
|
|
28
31
|
const validate = require("../src/cli/validate");
|
|
@@ -32,6 +35,7 @@ const whoami = require("../src/cli/whoami");
|
|
|
32
35
|
// [use]
|
|
33
36
|
|
|
34
37
|
const abort = output.abort;
|
|
38
|
+
const ArcError = error.ArcError;
|
|
35
39
|
const findRc = rc.findRc;
|
|
36
40
|
const print = output.print;
|
|
37
41
|
const ProgressBar = progress.ProgressBar;
|
|
@@ -138,6 +142,18 @@ const whoamiIfAny = function (opts) {
|
|
|
138
142
|
|
|
139
143
|
// [function]
|
|
140
144
|
|
|
145
|
+
// whether `current` can wait for a git release: only the game's owner can see
|
|
146
|
+
// its releases. A token's account isn't known, so it waits, and so does any
|
|
147
|
+
// account when the owner couldn't be looked up.
|
|
148
|
+
const canWait = function (current, owner) {
|
|
149
|
+
if (!current) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return Boolean(current.token) || owner === null || owner === current.user?.id;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// [function]
|
|
156
|
+
|
|
141
157
|
// the release, as `--json` prints it.
|
|
142
158
|
const releaseJson = function (row) {
|
|
143
159
|
if (!row) {
|
|
@@ -199,12 +215,21 @@ const waitAndReport = async function (
|
|
|
199
215
|
git,
|
|
200
216
|
studio,
|
|
201
217
|
});
|
|
202
|
-
abort("Wait timed out.", new
|
|
218
|
+
abort("Wait timed out.", new ArcError(cfgcode.WAIT_TIMED_OUT, reason), {
|
|
219
|
+
data,
|
|
220
|
+
json,
|
|
221
|
+
sw,
|
|
222
|
+
});
|
|
203
223
|
return;
|
|
204
224
|
}
|
|
205
225
|
if (release.status === "failed") {
|
|
206
226
|
const reason = phrase.releaseFailed(release, studio);
|
|
207
|
-
abort("Release failed.", new Error(reason), {
|
|
227
|
+
abort("Release failed.", new Error(reason), {
|
|
228
|
+
code: release.reason ?? cfgcode.INTERNAL,
|
|
229
|
+
data,
|
|
230
|
+
json,
|
|
231
|
+
sw,
|
|
232
|
+
});
|
|
208
233
|
return;
|
|
209
234
|
}
|
|
210
235
|
sw.stop(true);
|
|
@@ -217,20 +242,48 @@ const waitAndReport = async function (
|
|
|
217
242
|
|
|
218
243
|
// [function]
|
|
219
244
|
|
|
245
|
+
// fails unless the timeout is a number of seconds above 0: otherwise the
|
|
246
|
+
// wait would never end.
|
|
247
|
+
const checkTimeout = function (timeout) {
|
|
248
|
+
if (Number.isFinite(timeout) && timeout > 0) {
|
|
249
|
+
return Promise.resolve();
|
|
250
|
+
}
|
|
251
|
+
return Promise.reject(
|
|
252
|
+
new ArcError(cfgcode.ARGUMENT_INVALID, phrase.timeoutInvalid()),
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// [function]
|
|
257
|
+
|
|
220
258
|
const start = function (argv) {
|
|
221
259
|
const git = argv.method === "git";
|
|
222
260
|
const json = argv.json;
|
|
223
261
|
const quiet = argv.quiet;
|
|
224
|
-
|
|
262
|
+
// `.arcrc` values are strings, and a flag that isn't a number is NaN.
|
|
263
|
+
const timeout = Number(argv.timeout ?? TIMEOUT[git ? "git" : "direct"]);
|
|
225
264
|
const root = resolve(process.cwd(), argv.cwd);
|
|
226
265
|
let pb = null;
|
|
266
|
+
// the note when a git deploy doesn't wait: who can wait for it.
|
|
267
|
+
let notWaited = phrase.releaseNotWaited();
|
|
268
|
+
// the project, parsed once and given to each step. A build can write files
|
|
269
|
+
// the manifest reads, such as art, so it's parsed again after one runs.
|
|
270
|
+
let parsed = null;
|
|
227
271
|
let sw = new SpinnerWheel("Validating... %s");
|
|
228
272
|
sw.start(json || quiet);
|
|
229
|
-
return
|
|
273
|
+
return checkTimeout(timeout)
|
|
274
|
+
.then(() => project(root))
|
|
275
|
+
.then((proj) => {
|
|
276
|
+
parsed = proj;
|
|
277
|
+
return validate({ project: parsed, root });
|
|
278
|
+
})
|
|
230
279
|
.then((issues) => {
|
|
231
280
|
const count = issues.length;
|
|
232
281
|
if (count) {
|
|
233
|
-
throw new
|
|
282
|
+
throw new ArcError(
|
|
283
|
+
cfgcode.VALIDATION_FAILED,
|
|
284
|
+
phrase.issuesFound(count),
|
|
285
|
+
{ data: { issues } },
|
|
286
|
+
);
|
|
234
287
|
}
|
|
235
288
|
sw.stop(true);
|
|
236
289
|
sw = new SpinnerWheel("Checking... %s");
|
|
@@ -247,7 +300,7 @@ const start = function (argv) {
|
|
|
247
300
|
})
|
|
248
301
|
.then((current) => {
|
|
249
302
|
if (!current && !git) {
|
|
250
|
-
throw new
|
|
303
|
+
throw new ArcError(cfgcode.NOT_LOGGED_IN, phrase.notLoggedIn());
|
|
251
304
|
}
|
|
252
305
|
sw.stop(true);
|
|
253
306
|
sw = new SpinnerWheel("Preparing... %s");
|
|
@@ -259,22 +312,31 @@ const start = function (argv) {
|
|
|
259
312
|
current,
|
|
260
313
|
git,
|
|
261
314
|
handler: handler({ json, pb, quiet, sw }),
|
|
315
|
+
project: parsed,
|
|
262
316
|
root,
|
|
263
317
|
}),
|
|
264
318
|
]);
|
|
265
319
|
})
|
|
266
|
-
.then(([current]) => {
|
|
320
|
+
.then(([current, predeployed]) => {
|
|
267
321
|
sw.stop(true);
|
|
322
|
+
const waits = !git || canWait(current, predeployed.owner ?? null);
|
|
323
|
+
if (current && !waits) {
|
|
324
|
+
notWaited = phrase.releaseNotWaitedOwner();
|
|
325
|
+
}
|
|
268
326
|
sw = new SpinnerWheel("Building... %s");
|
|
269
327
|
sw.start(git || json || quiet);
|
|
270
328
|
return Promise.all([
|
|
271
|
-
// whoami
|
|
272
|
-
current,
|
|
329
|
+
// whoami, kept only to wait with
|
|
330
|
+
waits ? current : null,
|
|
273
331
|
// build
|
|
274
|
-
git ? null : build({ root }),
|
|
332
|
+
git ? null : build({ project: parsed, root }),
|
|
275
333
|
]);
|
|
276
334
|
})
|
|
277
|
-
.then(([current, artifact]) =>
|
|
335
|
+
.then(([current, artifact]) =>
|
|
336
|
+
Promise.all([current, artifact, artifact ? project(root) : parsed]),
|
|
337
|
+
)
|
|
338
|
+
.then(([current, artifact, proj]) => {
|
|
339
|
+
parsed = proj;
|
|
278
340
|
sw.stop(true);
|
|
279
341
|
sw = new SpinnerWheel("Packing... %s");
|
|
280
342
|
sw.start(git || json || quiet);
|
|
@@ -282,7 +344,7 @@ const start = function (argv) {
|
|
|
282
344
|
// whoami
|
|
283
345
|
current,
|
|
284
346
|
// pack
|
|
285
|
-
git ? null : pack({ input: artifact?.path, root }),
|
|
347
|
+
git ? null : pack({ input: artifact?.path, project: parsed, root }),
|
|
286
348
|
// build: whether workflow.build ran
|
|
287
349
|
Boolean(artifact),
|
|
288
350
|
]);
|
|
@@ -301,6 +363,7 @@ const start = function (argv) {
|
|
|
301
363
|
current,
|
|
302
364
|
git,
|
|
303
365
|
handler: handler({ json, pb, quiet, sw }),
|
|
366
|
+
project: parsed,
|
|
304
367
|
root,
|
|
305
368
|
}),
|
|
306
369
|
built,
|
|
@@ -333,7 +396,7 @@ const start = function (argv) {
|
|
|
333
396
|
} else if (!quiet) {
|
|
334
397
|
report(result, {
|
|
335
398
|
git,
|
|
336
|
-
note: argv.wait ?
|
|
399
|
+
note: argv.wait ? notWaited : null,
|
|
337
400
|
});
|
|
338
401
|
}
|
|
339
402
|
return null;
|
|
@@ -375,6 +438,7 @@ const main = function (argv) {
|
|
|
375
438
|
type: "boolean",
|
|
376
439
|
})
|
|
377
440
|
.option("timeout", {
|
|
441
|
+
default: conf.timeout,
|
|
378
442
|
describe: "Seconds to wait [default: 300, or 900 for git]",
|
|
379
443
|
type: "number",
|
|
380
444
|
})
|
|
@@ -383,6 +447,7 @@ const main = function (argv) {
|
|
|
383
447
|
.alias("help", "h")
|
|
384
448
|
.version(VERSION)
|
|
385
449
|
.alias("version", "v")
|
|
450
|
+
.fail(args.fail(argv))
|
|
386
451
|
.strict()
|
|
387
452
|
.parse(),
|
|
388
453
|
);
|
package/bin/arc-init.js
CHANGED
|
@@ -15,9 +15,11 @@ const yargs = require("yargs/yargs");
|
|
|
15
15
|
// [import]
|
|
16
16
|
|
|
17
17
|
const args = require("../src/util/argv");
|
|
18
|
+
const cfgcode = require("../src/config/code");
|
|
18
19
|
const cfgpackage = require("../src/config/package");
|
|
19
20
|
const cfgproduct = require("../src/config/product");
|
|
20
21
|
const cfgtemplate = require("../src/config/template");
|
|
22
|
+
const error = require("../src/util/error");
|
|
21
23
|
const init = require("../src/cli/init");
|
|
22
24
|
const log = require("../src/util/log");
|
|
23
25
|
const output = require("../src/util/output");
|
|
@@ -28,6 +30,7 @@ const spinner = require("../src/util/spinner");
|
|
|
28
30
|
// [use]
|
|
29
31
|
|
|
30
32
|
const abort = output.abort;
|
|
33
|
+
const ArcError = error.ArcError;
|
|
31
34
|
const findRc = rc.findRc;
|
|
32
35
|
const join = path.join;
|
|
33
36
|
const pathExists = fs.pathExists;
|
|
@@ -107,7 +110,7 @@ const prompt = async function ({ yes, ...argv }) {
|
|
|
107
110
|
if (!opts.template) {
|
|
108
111
|
// without a terminal, the prompt would read end-of-input and exit.
|
|
109
112
|
if (!process.stdin.isTTY) {
|
|
110
|
-
throw new
|
|
113
|
+
throw new ArcError(cfgcode.TEMPLATE_MISSING, phrase.noTemplate());
|
|
111
114
|
}
|
|
112
115
|
opts.template = await select(cfgtemplate);
|
|
113
116
|
}
|
|
@@ -143,6 +146,7 @@ const main = function (argv) {
|
|
|
143
146
|
)
|
|
144
147
|
.option("template", {
|
|
145
148
|
alias: "t",
|
|
149
|
+
default: conf.template,
|
|
146
150
|
describe: [
|
|
147
151
|
"Project template",
|
|
148
152
|
"Public GitHub repository (format: user/repo).",
|
|
@@ -172,6 +176,7 @@ const main = function (argv) {
|
|
|
172
176
|
.alias("help", "h")
|
|
173
177
|
.version(VERSION)
|
|
174
178
|
.alias("version", "v")
|
|
179
|
+
.fail(args.fail(argv))
|
|
175
180
|
.strict()
|
|
176
181
|
.parse(),
|
|
177
182
|
);
|
package/bin/arc-inspect.js
CHANGED
package/bin/arc-login.js
CHANGED
|
@@ -10,8 +10,10 @@ const yargs = require("yargs/yargs");
|
|
|
10
10
|
// [import]
|
|
11
11
|
|
|
12
12
|
const args = require("../src/util/argv");
|
|
13
|
+
const cfgcode = require("../src/config/code");
|
|
13
14
|
const cfgpackage = require("../src/config/package");
|
|
14
15
|
const cfgproduct = require("../src/config/product");
|
|
16
|
+
const error = require("../src/util/error");
|
|
15
17
|
const log = require("../src/util/log");
|
|
16
18
|
const login = require("../src/cli/login");
|
|
17
19
|
const phrase = require("../src/phrase");
|
|
@@ -21,6 +23,7 @@ const spinner = require("../src/util/spinner");
|
|
|
21
23
|
|
|
22
24
|
// [use]
|
|
23
25
|
|
|
26
|
+
const ArcError = error.ArcError;
|
|
24
27
|
const findRc = rc.findRc;
|
|
25
28
|
const launch = shell.launch;
|
|
26
29
|
const SpinnerWheel = spinner.SpinnerWheel;
|
|
@@ -101,7 +104,7 @@ const start = function (argv) {
|
|
|
101
104
|
.then((current) => {
|
|
102
105
|
const user = current?.user;
|
|
103
106
|
if (!user) {
|
|
104
|
-
throw new
|
|
107
|
+
throw new ArcError(cfgcode.NOT_LOGGED_IN, phrase.notLoggedIn());
|
|
105
108
|
}
|
|
106
109
|
sw.stop(true);
|
|
107
110
|
process.stdin.pause();
|
package/bin/arc-open.js
CHANGED
|
@@ -13,9 +13,11 @@ const yargs = require("yargs/yargs");
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
15
|
const args = require("../src/util/argv");
|
|
16
|
+
const cfgcode = require("../src/config/code");
|
|
16
17
|
const cfgpackage = require("../src/config/package");
|
|
17
18
|
const cfgproduct = require("../src/config/product");
|
|
18
19
|
const cfguri = require("../src/config/uri");
|
|
20
|
+
const error = require("../src/util/error");
|
|
19
21
|
const log = require("../src/util/log");
|
|
20
22
|
const open = require("../src/cli/open");
|
|
21
23
|
const output = require("../src/util/output");
|
|
@@ -26,6 +28,7 @@ const shell = require("../src/util/shell");
|
|
|
26
28
|
// [use]
|
|
27
29
|
|
|
28
30
|
const abort = output.abort;
|
|
31
|
+
const ArcError = error.ArcError;
|
|
29
32
|
const findRc = rc.findRc;
|
|
30
33
|
const launch = shell.launch;
|
|
31
34
|
const resolve = path.resolve;
|
|
@@ -54,7 +57,7 @@ const start = function (argv) {
|
|
|
54
57
|
.then((data) => {
|
|
55
58
|
const page = data?.page;
|
|
56
59
|
if (!page) {
|
|
57
|
-
throw new
|
|
60
|
+
throw new ArcError(cfgcode.GAME_ID_MISSING, phrase.noGameId());
|
|
58
61
|
}
|
|
59
62
|
const url = `${cfguri.HOST_HTTP_WWW}${page}`;
|
|
60
63
|
const opening = argv.browser
|
package/bin/arc-pack.js
CHANGED
|
@@ -13,12 +13,15 @@ const yargs = require("yargs/yargs");
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
15
|
const args = require("../src/util/argv");
|
|
16
|
+
const cfgcode = require("../src/config/code");
|
|
16
17
|
const cfgpackage = require("../src/config/package");
|
|
17
18
|
const cfgproduct = require("../src/config/product");
|
|
19
|
+
const error = require("../src/util/error");
|
|
18
20
|
const log = require("../src/util/log");
|
|
19
21
|
const output = require("../src/util/output");
|
|
20
22
|
const pack = require("../src/cli/pack");
|
|
21
23
|
const phrase = require("../src/phrase");
|
|
24
|
+
const project = require("../src/parser/project");
|
|
22
25
|
const rc = require("../src/util/rc");
|
|
23
26
|
const spinner = require("../src/util/spinner");
|
|
24
27
|
const validate = require("../src/cli/validate");
|
|
@@ -26,6 +29,7 @@ const validate = require("../src/cli/validate");
|
|
|
26
29
|
// [use]
|
|
27
30
|
|
|
28
31
|
const abort = output.abort;
|
|
32
|
+
const ArcError = error.ArcError;
|
|
29
33
|
const findRc = rc.findRc;
|
|
30
34
|
const print = output.print;
|
|
31
35
|
const resolve = path.resolve;
|
|
@@ -53,18 +57,33 @@ const start = function (argv) {
|
|
|
53
57
|
const json = argv.json;
|
|
54
58
|
const quiet = argv.quiet;
|
|
55
59
|
const root = resolve(process.cwd(), argv.cwd);
|
|
60
|
+
// the project, parsed once for both steps.
|
|
61
|
+
let parsed = null;
|
|
56
62
|
let sw = new SpinnerWheel("Validating... %s");
|
|
57
63
|
sw.start(json || quiet);
|
|
58
|
-
return
|
|
64
|
+
return project(root)
|
|
65
|
+
.then((proj) => {
|
|
66
|
+
parsed = proj;
|
|
67
|
+
return validate({ project: parsed, root });
|
|
68
|
+
})
|
|
59
69
|
.then((issues) => {
|
|
60
70
|
const count = issues.length;
|
|
61
71
|
if (count) {
|
|
62
|
-
throw new
|
|
72
|
+
throw new ArcError(
|
|
73
|
+
cfgcode.VALIDATION_FAILED,
|
|
74
|
+
phrase.issuesFound(count),
|
|
75
|
+
{ data: { issues } },
|
|
76
|
+
);
|
|
63
77
|
}
|
|
64
78
|
sw.stop(true);
|
|
65
79
|
sw = new SpinnerWheel("Packing... %s");
|
|
66
80
|
sw.start(json || quiet);
|
|
67
|
-
return pack({
|
|
81
|
+
return pack({
|
|
82
|
+
input: argv.input,
|
|
83
|
+
output: argv.output,
|
|
84
|
+
project: parsed,
|
|
85
|
+
root,
|
|
86
|
+
});
|
|
68
87
|
})
|
|
69
88
|
.then((artifact) => {
|
|
70
89
|
if (json) {
|
|
@@ -116,6 +135,7 @@ const main = function (argv) {
|
|
|
116
135
|
.alias("help", "h")
|
|
117
136
|
.version(VERSION)
|
|
118
137
|
.alias("version", "v")
|
|
138
|
+
.fail(args.fail(argv))
|
|
119
139
|
.strict()
|
|
120
140
|
.parse(),
|
|
121
141
|
);
|
package/bin/arc-play.js
CHANGED
|
@@ -13,9 +13,11 @@ const yargs = require("yargs/yargs");
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
15
|
const args = require("../src/util/argv");
|
|
16
|
+
const cfgcode = require("../src/config/code");
|
|
16
17
|
const cfgpackage = require("../src/config/package");
|
|
17
18
|
const cfgproduct = require("../src/config/product");
|
|
18
19
|
const cfguri = require("../src/config/uri");
|
|
20
|
+
const error = require("../src/util/error");
|
|
19
21
|
const log = require("../src/util/log");
|
|
20
22
|
const output = require("../src/util/output");
|
|
21
23
|
const phrase = require("../src/phrase");
|
|
@@ -27,6 +29,7 @@ const spinner = require("../src/util/spinner");
|
|
|
27
29
|
// [use]
|
|
28
30
|
|
|
29
31
|
const abort = output.abort;
|
|
32
|
+
const ArcError = error.ArcError;
|
|
30
33
|
const findRc = rc.findRc;
|
|
31
34
|
const launch = shell.launch;
|
|
32
35
|
const resolve = path.resolve;
|
|
@@ -71,7 +74,7 @@ const start = function (argv) {
|
|
|
71
74
|
const orientation = data?.orientation;
|
|
72
75
|
const url = data?.url;
|
|
73
76
|
if (!orientation || !url) {
|
|
74
|
-
throw new
|
|
77
|
+
throw new ArcError(cfgcode.GAME_ID_MISSING, phrase.noGameId());
|
|
75
78
|
}
|
|
76
79
|
sw.stop(true);
|
|
77
80
|
if (data.fallback && !argv.quiet) {
|
package/bin/arc-validate.js
CHANGED
package/bin/arc-whoami.js
CHANGED
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@inquirer/prompts": "^8.5.2",
|
|
19
|
-
"adm-zip": "^0.
|
|
19
|
+
"adm-zip": "^0.6.1",
|
|
20
20
|
"chalk": "^4.1.2",
|
|
21
21
|
"cli-progress": "^3.12.0",
|
|
22
22
|
"cli-spinner": "^0.2.10",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dot-prop": "^6.0.1",
|
|
25
25
|
"fast-json-stable-stringify": "^2.1.0",
|
|
26
26
|
"fs-extra": "^11.3.2",
|
|
27
|
-
"image-size": "^2.0.
|
|
27
|
+
"image-size": "^2.0.4",
|
|
28
28
|
"ini": "^6.0.0",
|
|
29
29
|
"jsdom": "^27.3.0",
|
|
30
30
|
"marked": "^17.0.1",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"scripts": {
|
|
76
76
|
"test": "node --test \"test/**/*.test.js\""
|
|
77
77
|
},
|
|
78
|
-
"version": "0.1.
|
|
78
|
+
"version": "0.1.33"
|
|
79
79
|
}
|
package/src/account.js
CHANGED
|
@@ -11,17 +11,20 @@ const fs = require("fs-extra");
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
13
|
const api = require("./api");
|
|
14
|
+
const cfgcode = require("./config/code");
|
|
14
15
|
const cfgproduct = require("./config/product");
|
|
16
|
+
const error = require("./util/error");
|
|
15
17
|
const objs = require("./util/objs");
|
|
16
18
|
const os = require("./util/os");
|
|
17
19
|
const phrase = require("./phrase");
|
|
18
20
|
|
|
19
21
|
// [use]
|
|
20
22
|
|
|
23
|
+
const ArcError = error.ArcError;
|
|
24
|
+
const chmod = fs.promises.chmod;
|
|
21
25
|
const configDir = os.configDir;
|
|
22
26
|
const deepSort = objs.deepSort;
|
|
23
27
|
const join = path.join;
|
|
24
|
-
const chmod = fs.promises.chmod;
|
|
25
28
|
const mkdir = fs.promises.mkdir;
|
|
26
29
|
const readFile = fs.promises.readFile;
|
|
27
30
|
const unlink = fs.promises.unlink;
|
|
@@ -37,7 +40,7 @@ const FILE_MODE = 0o600;
|
|
|
37
40
|
|
|
38
41
|
// the statuses that mean the refresh token itself was refused.
|
|
39
42
|
const REJECTED = [400, 401, 403];
|
|
40
|
-
const SESSION_EXPIRED =
|
|
43
|
+
const SESSION_EXPIRED = cfgcode.SESSION_EXPIRED;
|
|
41
44
|
|
|
42
45
|
// [declare]
|
|
43
46
|
|
|
@@ -85,8 +88,8 @@ const refresh = function ({ session, ...current }) {
|
|
|
85
88
|
(data) => save({ ...current, session: data }),
|
|
86
89
|
(ex) => {
|
|
87
90
|
if (REJECTED.includes(ex.status)) {
|
|
88
|
-
throw
|
|
89
|
-
|
|
91
|
+
throw new ArcError(cfgcode.SESSION_EXPIRED, phrase.sessionExpired(), {
|
|
92
|
+
cause: ex,
|
|
90
93
|
});
|
|
91
94
|
}
|
|
92
95
|
throw ex;
|
package/src/action/build/tool.js
CHANGED
|
@@ -11,11 +11,14 @@ const fs = require("fs-extra");
|
|
|
11
11
|
|
|
12
12
|
// [import]
|
|
13
13
|
|
|
14
|
+
const cfgcode = require("../../config/code");
|
|
15
|
+
const error = require("../../util/error");
|
|
16
|
+
const given = require("../../parser/given");
|
|
14
17
|
const phrase = require("../../phrase");
|
|
15
|
-
const project = require("../../parser/project");
|
|
16
18
|
|
|
17
19
|
// [use]
|
|
18
20
|
|
|
21
|
+
const ArcError = error.ArcError;
|
|
19
22
|
const exec = cp.exec;
|
|
20
23
|
const pathExists = fs.pathExists;
|
|
21
24
|
const resolvePath = path.resolve;
|
|
@@ -28,7 +31,7 @@ const execBuild = function (command, { cwdPath }) {
|
|
|
28
31
|
if (err) {
|
|
29
32
|
const { code, signal } = err;
|
|
30
33
|
reject(
|
|
31
|
-
new
|
|
34
|
+
new ArcError(cfgcode.BUILD_FAILED, phrase.buildFailed({ code, signal, stderr }), {
|
|
32
35
|
cause: err,
|
|
33
36
|
}),
|
|
34
37
|
);
|
|
@@ -54,8 +57,9 @@ const build = function (command, { cwdPath, outputPath }) {
|
|
|
54
57
|
|
|
55
58
|
// [function]
|
|
56
59
|
|
|
57
|
-
const main = function (
|
|
58
|
-
|
|
60
|
+
const main = function (conf) {
|
|
61
|
+
const root = conf.root;
|
|
62
|
+
return given(conf).then(({ workflow }) => {
|
|
59
63
|
const command = workflow.build;
|
|
60
64
|
return build(
|
|
61
65
|
Array.isArray(command)
|