arcadible 1.0.23 → 1.0.24
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 +1 -0
- package/bin/arc.js +1 -85
- package/dist/account.js +197 -0
- package/dist/action/build/tool.js +65 -0
- package/dist/action/delete/tool.js +46 -0
- package/dist/action/deploy/rebuilt.js +25 -0
- package/dist/action/deploy/result.js +36 -0
- package/dist/action/deploy/timeout.js +18 -0
- package/dist/action/deploy/tool-git.js +54 -0
- package/dist/action/deploy/tool.js +54 -0
- package/dist/action/deploy/wait.js +104 -0
- package/dist/action/function/tool.js +127 -0
- package/dist/action/game.js +61 -0
- package/dist/action/init/manifest.js +64 -0
- package/dist/action/init/tool-patch.js +15 -0
- package/dist/action/init/tool.js +64 -0
- package/dist/action/inspect/tool.js +13 -0
- package/dist/action/key/tool.js +87 -0
- package/dist/action/login/flow.js +69 -0
- package/dist/action/login/tool.js +8 -0
- package/dist/action/logout/tool.js +8 -0
- package/dist/action/open/tool.js +29 -0
- package/dist/action/pack/limits.js +46 -0
- package/dist/action/pack/tool.js +150 -0
- package/dist/action/pack/unsound.js +51 -0
- package/dist/action/play/tool.js +83 -0
- package/dist/action/predeploy/ac.js +75 -0
- package/dist/action/predeploy/game.js +12 -0
- package/dist/action/predeploy/git.js +151 -0
- package/dist/action/predeploy/pm.js +20 -0
- package/dist/action/predeploy/published.js +54 -0
- package/dist/action/predeploy/secrets.js +35 -0
- package/dist/action/predeploy/tool-git.js +108 -0
- package/dist/action/predeploy/tool.js +16 -0
- package/dist/action/secret/tool.js +91 -0
- package/dist/action/serve/tool.js +249 -0
- package/dist/action/validate/checked.js +28 -0
- package/dist/action/validate/tool.js +56 -0
- package/dist/action/validate/unknown.js +58 -0
- package/dist/action/validate/unsound.js +99 -0
- package/dist/action/whoami/tool.js +7 -0
- package/dist/api.js +160 -0
- package/dist/arc.js +41 -0
- package/dist/cli/argv.js +61 -0
- package/dist/cli/channel.js +29 -0
- package/dist/cli/command.js +163 -0
- package/dist/cli/confirm.js +39 -0
- package/dist/cli/options.js +62 -0
- package/dist/cli/rc.js +103 -0
- package/dist/cli/yargs.js +40 -0
- package/dist/command/build.js +68 -0
- package/dist/command/delete.js +66 -0
- package/dist/command/deploy.js +308 -0
- package/dist/command/function/index.js +17 -0
- package/dist/command/function/pause.js +18 -0
- package/dist/command/function/resume.js +18 -0
- package/dist/command/function/run.js +41 -0
- package/dist/command/function/secret/index.js +15 -0
- package/dist/command/function/secret/list.js +27 -0
- package/dist/command/function/secret/name.js +8 -0
- package/dist/command/function/secret/remove.js +26 -0
- package/dist/command/function/secret/run.js +52 -0
- package/dist/command/function/secret/set.js +48 -0
- package/dist/command/function/status.js +40 -0
- package/dist/command/init.js +128 -0
- package/dist/command/inspect.js +38 -0
- package/dist/command/login.js +108 -0
- package/dist/command/logout.js +24 -0
- package/dist/command/open.js +48 -0
- package/dist/command/pack.js +90 -0
- package/dist/command/play.js +80 -0
- package/dist/command/serve.js +176 -0
- package/dist/command/server/index.js +17 -0
- package/dist/command/server/key/create.js +36 -0
- package/dist/command/server/key/index.js +15 -0
- package/dist/command/server/key/list.js +34 -0
- package/dist/command/server/key/revoke.js +24 -0
- package/dist/command/server/key/run.js +54 -0
- package/dist/command/validate.js +47 -0
- package/dist/command/whoami.js +55 -0
- package/dist/commands.js +93 -0
- package/dist/config/ai.js +2 -0
- package/dist/config/art.js +13 -0
- package/dist/config/audience.js +2 -0
- package/dist/config/code.js +129 -0
- package/dist/config/file.js +13 -0
- package/dist/config/genre.js +19 -0
- package/{src → dist}/config/html.js +2 -7
- package/dist/config/image.js +5 -0
- package/dist/config/input.js +11 -0
- package/dist/config/json.js +23 -0
- package/dist/config/limit.js +14 -0
- package/dist/config/orientation.js +11 -0
- package/dist/config/package.js +8 -0
- package/dist/config/product.js +14 -0
- package/dist/config/template.js +37 -0
- package/dist/config/uri.js +18 -0
- package/dist/config/url.js +11 -0
- package/dist/config/video.js +5 -0
- package/dist/config/visibility.js +2 -0
- package/dist/config/workflow.js +7 -0
- package/dist/parser/env.js +61 -0
- package/dist/parser/given.js +8 -0
- package/dist/parser/manifest.js +45 -0
- package/dist/parser/media.js +57 -0
- package/dist/parser/project.js +129 -0
- package/dist/parser/readme-file.js +44 -0
- package/dist/parser/readme.js +70 -0
- package/dist/parser/sections.js +92 -0
- package/dist/parser/self.js +16 -0
- package/dist/phrase/account.js +35 -0
- package/dist/phrase/common.js +130 -0
- package/dist/phrase/deploy.js +184 -0
- package/dist/phrase/function.js +135 -0
- package/dist/phrase/game.js +27 -0
- package/dist/phrase/index.js +15 -0
- package/dist/phrase/init.js +53 -0
- package/dist/phrase/internal.js +61 -0
- package/dist/phrase/manifest.js +120 -0
- package/dist/phrase/media.js +90 -0
- package/dist/phrase/pack.js +69 -0
- package/dist/phrase/serve.js +84 -0
- package/dist/phrase/server.js +38 -0
- package/dist/runner/bundle.js +95 -0
- package/dist/runner/outbound.js +69 -0
- package/dist/schema/check/game.js +29 -0
- package/dist/schema/check/workflow.js +57 -0
- package/dist/schema/game.js +462 -0
- package/dist/schema/message.js +61 -0
- package/dist/schema/readme.js +27 -0
- package/dist/schema/runner.js +43 -0
- package/dist/schema/server.js +91 -0
- package/dist/schema/workflow.js +99 -0
- package/dist/serve/files.js +39 -0
- package/dist/serve/game.js +172 -0
- package/dist/serve/page.js +490 -0
- package/dist/serve/reload.js +55 -0
- package/dist/serve/remote.js +114 -0
- package/dist/serve/runner.js +296 -0
- package/dist/serve/server.js +163 -0
- package/dist/serve/ticket.js +232 -0
- package/dist/util/bytes.js +16 -0
- package/dist/util/chars.js +19 -0
- package/dist/util/command.js +11 -0
- package/dist/util/delay.js +36 -0
- package/dist/util/doc.js +59 -0
- package/dist/util/error.js +35 -0
- package/dist/util/http.js +13 -0
- package/dist/util/image.js +64 -0
- package/dist/util/links.js +45 -0
- package/dist/util/lockfile.js +17 -0
- package/dist/util/log.js +101 -0
- package/dist/util/md.js +37 -0
- package/dist/util/media.js +27 -0
- package/dist/util/objs.js +29 -0
- package/dist/util/os.js +13 -0
- package/dist/util/output.js +133 -0
- package/dist/util/paths.js +8 -0
- package/dist/util/progress.js +57 -0
- package/dist/util/promise.js +18 -0
- package/dist/util/request.js +91 -0
- package/dist/util/s3.js +67 -0
- package/dist/util/schema.js +151 -0
- package/dist/util/screenshot.js +24 -0
- package/dist/util/shell.js +64 -0
- package/dist/util/size.js +32 -0
- package/dist/util/spinner.js +35 -0
- package/dist/util/strs.js +46 -0
- package/dist/util/table.js +18 -0
- package/dist/util/term.js +21 -0
- package/dist/util/time.js +16 -0
- package/dist/util/toml.js +28 -0
- package/{src → dist}/util/uris.js +8 -14
- package/dist/util/video.js +113 -0
- package/dist/util/zip.js +62 -0
- package/npm-shrinkwrap.json +3256 -0
- package/package.json +41 -39
- package/bin/arc-build.js +0 -139
- package/bin/arc-default.js +0 -65
- package/bin/arc-deploy.js +0 -456
- package/bin/arc-init.js +0 -187
- package/bin/arc-inspect.js +0 -97
- package/bin/arc-login.js +0 -165
- package/bin/arc-logout.js +0 -75
- package/bin/arc-open.js +0 -104
- package/bin/arc-pack.js +0 -146
- package/bin/arc-play.js +0 -140
- package/bin/arc-serve.js +0 -214
- package/bin/arc-validate.js +0 -112
- package/bin/arc-whoami.js +0 -119
- package/src/account.js +0 -249
- package/src/action/build/tool.js +0 -80
- package/src/action/deploy/tool-git.js +0 -90
- package/src/action/deploy/tool.js +0 -88
- package/src/action/deploy/wait.js +0 -151
- package/src/action/init/manifest.js +0 -83
- package/src/action/init/tool-patch.js +0 -32
- package/src/action/init/tool.js +0 -97
- package/src/action/inspect/tool.js +0 -26
- package/src/action/login/flow.js +0 -101
- package/src/action/login/tool.js +0 -16
- package/src/action/logout/tool.js +0 -15
- package/src/action/open/tool.js +0 -38
- package/src/action/pack/limits.js +0 -51
- package/src/action/pack/tool.js +0 -171
- package/src/action/pack/unsound.js +0 -69
- package/src/action/play/tool.js +0 -109
- package/src/action/predeploy/ac.js +0 -112
- package/src/action/predeploy/git.js +0 -223
- package/src/action/predeploy/pm.js +0 -37
- package/src/action/predeploy/published.js +0 -82
- package/src/action/predeploy/tool-git.js +0 -154
- package/src/action/predeploy/tool.js +0 -29
- package/src/action/serve/tool.js +0 -209
- package/src/action/validate/checked.js +0 -37
- package/src/action/validate/tool.js +0 -67
- package/src/action/validate/unknown.js +0 -86
- package/src/action/validate/unsound.js +0 -138
- package/src/action/whoami/tool.js +0 -15
- package/src/api.js +0 -163
- package/src/cli/build.js +0 -15
- package/src/cli/deploy.js +0 -21
- package/src/cli/init.js +0 -17
- package/src/cli/inspect.js +0 -15
- package/src/cli/login.js +0 -15
- package/src/cli/logout.js +0 -15
- package/src/cli/open.js +0 -15
- package/src/cli/pack.js +0 -15
- package/src/cli/play.js +0 -15
- package/src/cli/predeploy.js +0 -21
- package/src/cli/serve.js +0 -15
- package/src/cli/validate.js +0 -15
- package/src/cli/whoami.js +0 -15
- package/src/config/ai.js +0 -5
- package/src/config/art.js +0 -16
- package/src/config/audience.js +0 -5
- package/src/config/code.js +0 -142
- package/src/config/file.js +0 -23
- package/src/config/genre.js +0 -22
- package/src/config/image.js +0 -7
- package/src/config/input.js +0 -14
- package/src/config/limit.js +0 -21
- package/src/config/orientation.js +0 -14
- package/src/config/package.js +0 -5
- package/src/config/product.js +0 -5
- package/src/config/template.js +0 -45
- package/src/config/uri.js +0 -27
- package/src/config/url.js +0 -20
- package/src/config/video.js +0 -7
- package/src/config/visibility.js +0 -5
- package/src/config/workflow.js +0 -18
- package/src/parser/env.js +0 -84
- package/src/parser/given.js +0 -17
- package/src/parser/manifest.js +0 -80
- package/src/parser/media.js +0 -90
- package/src/parser/project.js +0 -166
- package/src/parser/readme-file.js +0 -76
- package/src/parser/readme.js +0 -96
- package/src/parser/sections.js +0 -107
- package/src/parser/self.js +0 -27
- package/src/phrase.js +0 -1294
- package/src/schema/check/game.js +0 -61
- package/src/schema/check/workflow.js +0 -99
- package/src/schema/game.js +0 -649
- package/src/schema/message.js +0 -85
- package/src/schema/readme.js +0 -44
- package/src/schema/workflow.js +0 -150
- package/src/serve/files.js +0 -61
- package/src/serve/game.js +0 -191
- package/src/serve/page.js +0 -345
- package/src/serve/reload.js +0 -68
- package/src/serve/remote.js +0 -121
- package/src/serve/server.js +0 -128
- package/src/util/argv.js +0 -116
- package/src/util/bytes.js +0 -25
- package/src/util/chars.js +0 -30
- package/src/util/command.js +0 -18
- package/src/util/delay.js +0 -52
- package/src/util/doc.js +0 -72
- package/src/util/error.js +0 -50
- package/src/util/http.js +0 -25
- package/src/util/image.js +0 -93
- package/src/util/links.js +0 -78
- package/src/util/lockfile.js +0 -35
- package/src/util/log.js +0 -149
- package/src/util/md.js +0 -61
- package/src/util/media.js +0 -40
- package/src/util/objs.js +0 -45
- package/src/util/os.js +0 -27
- package/src/util/output.js +0 -174
- package/src/util/paths.js +0 -21
- package/src/util/progress.js +0 -85
- package/src/util/promise.js +0 -29
- package/src/util/rc.js +0 -144
- package/src/util/request.js +0 -89
- package/src/util/s3.js +0 -92
- package/src/util/schema.js +0 -189
- package/src/util/screenshot.js +0 -37
- package/src/util/shell.js +0 -84
- package/src/util/size.js +0 -53
- package/src/util/spinner.js +0 -52
- package/src/util/strs.js +0 -73
- package/src/util/term.js +0 -28
- package/src/util/time.js +0 -29
- package/src/util/toml.js +0 -14
- package/src/util/video.js +0 -157
- package/src/util/zip.js +0 -88
- /package/{src/serve → assets}/favicon.ico +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// [import]
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// [import]
|
|
4
|
+
import semver from "semver";
|
|
5
|
+
// [import]
|
|
6
|
+
import { ART as cfgart } from "../../config/art.js";
|
|
7
|
+
import { WARNING } from "../../config/code.js";
|
|
8
|
+
import { MEDIA } from "../../config/file.js";
|
|
9
|
+
import { artVideoUnpaired, didYouMean, fieldUnset, screenshotNameInvalid, } from "../../phrase/index.js";
|
|
10
|
+
import { warning as outputWarning } from "../../util/output.js";
|
|
11
|
+
import { SCREENSHOT } from "../../util/screenshot.js";
|
|
12
|
+
// [use]
|
|
13
|
+
const extname = path.extname;
|
|
14
|
+
const parse = path.parse;
|
|
15
|
+
const posixBasename = path.posix.basename;
|
|
16
|
+
const prerelease = semver.prerelease;
|
|
17
|
+
const validSemver = semver.valid;
|
|
18
|
+
// [declare]
|
|
19
|
+
// the art fields, such as `icon`, each of which may have a `_video`.
|
|
20
|
+
const ART = cfgart
|
|
21
|
+
.map((file) => parse(file).name)
|
|
22
|
+
.filter((name) => !name.endsWith("_video"));
|
|
23
|
+
// a name one case or separator away from a screenshot's: `Screenshot_01`,
|
|
24
|
+
// `screenshot-01`, `screenshot01`, with any qualifier after it.
|
|
25
|
+
const SCREENSHOT_NEAR = /^screenshot[-_ ]?(\d+)(?:[-_ ](.+))?$/iu;
|
|
26
|
+
// [function]
|
|
27
|
+
// a warning about a field, in an issue's shape, with its details.
|
|
28
|
+
function warning(code, field, [message = "", ...details]) {
|
|
29
|
+
return { ...outputWarning(code, message, field), details };
|
|
30
|
+
}
|
|
31
|
+
// [function]
|
|
32
|
+
// the fields a release leaves out whose defaults it may not mean: a release
|
|
33
|
+
// version's `visibility` and `title`, and a public one's `inputs`. A
|
|
34
|
+
// prerelease changes no store page, so it's never warned about.
|
|
35
|
+
function unset(game) {
|
|
36
|
+
const version = game["version"];
|
|
37
|
+
// only a string is a version: semver reads nothing else as one.
|
|
38
|
+
if (typeof version !== "string" ||
|
|
39
|
+
!validSemver(version) ||
|
|
40
|
+
prerelease(version)) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const fields = [
|
|
44
|
+
"visibility",
|
|
45
|
+
"title",
|
|
46
|
+
...(game["visibility"] === "public" ? ["inputs"] : []),
|
|
47
|
+
];
|
|
48
|
+
return fields
|
|
49
|
+
.filter((field) => typeof game[field] === "undefined")
|
|
50
|
+
.map((field) => warning(WARNING.FIELD_UNSET, `game.${field}`, fieldUnset(field) ?? []));
|
|
51
|
+
}
|
|
52
|
+
// [function]
|
|
53
|
+
// each art video without its PNG, such as `icon_video` without `icon`.
|
|
54
|
+
function unpaired(game) {
|
|
55
|
+
return ART.filter((art) => game[`${art}_video`] && !game[art]).map((art) => warning(WARNING.ART_VIDEO_UNPAIRED, `game.${art}_video`, artVideoUnpaired(art, `${MEDIA}/${art}.png`)));
|
|
56
|
+
}
|
|
57
|
+
// [function]
|
|
58
|
+
// the gallery's file names, or none when it isn't a list of paths, which
|
|
59
|
+
// its issues report.
|
|
60
|
+
function galleryNames(game) {
|
|
61
|
+
const gallery = game["gallery"];
|
|
62
|
+
if (!Array.isArray(gallery)) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
return gallery
|
|
66
|
+
.filter((file) => typeof file === "string")
|
|
67
|
+
.map((file) => posixBasename(file));
|
|
68
|
+
}
|
|
69
|
+
// [function]
|
|
70
|
+
// a gallery file named almost as a screenshot, with the name it might mean.
|
|
71
|
+
function misnamed(names) {
|
|
72
|
+
return names.flatMap((name) => {
|
|
73
|
+
if (SCREENSHOT.test(name)) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const ext = extname(name);
|
|
77
|
+
const match = SCREENSHOT_NEAR.exec(parse(name).name);
|
|
78
|
+
if (!match) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
const qualifier = match[2] ? `_${match[2]}` : "";
|
|
82
|
+
const near = `screenshot_${match[1]}${qualifier}${ext}`;
|
|
83
|
+
return [
|
|
84
|
+
warning(WARNING.SCREENSHOT_NAME_INVALID, "game.gallery", [
|
|
85
|
+
screenshotNameInvalid(name),
|
|
86
|
+
didYouMean(near),
|
|
87
|
+
]),
|
|
88
|
+
];
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// [function]
|
|
92
|
+
// what the resolved manifest has that's sound by its rules but almost never
|
|
93
|
+
// meant, as warnings: facts about the project, never a guess at how the
|
|
94
|
+
// store will show it (OUTPUT.md, Codes).
|
|
95
|
+
export function unsound(proj) {
|
|
96
|
+
const game = proj?.game ?? {};
|
|
97
|
+
const names = galleryNames(game);
|
|
98
|
+
return [...unset(game), ...unpaired(game), ...misnamed(names)];
|
|
99
|
+
}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// [import]
|
|
2
|
+
import { del, get, post, put } from "./util/request.js";
|
|
3
|
+
import { HOST_HTTP_API } from "./config/uri.js";
|
|
4
|
+
// [declare]
|
|
5
|
+
const VERSION = "v1";
|
|
6
|
+
// [function]
|
|
7
|
+
// the API's answer, as the shape its endpoint answers with. Nothing checks
|
|
8
|
+
// it: this is the one place the CLI takes the API at its word, as the first
|
|
9
|
+
// CLI did everywhere, so a field a caller can't do without is still its to
|
|
10
|
+
// check. An answer whose shape the CLI doesn't know stays `unknown`.
|
|
11
|
+
function answer(data) {
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
// [function]
|
|
15
|
+
// an API path with each value encoded as one segment, so a handle or version
|
|
16
|
+
// can't add a segment or a query: pathOf`/games/${id}`.
|
|
17
|
+
function pathOf(strings, ...values) {
|
|
18
|
+
return strings.reduce((out, each, i) => out +
|
|
19
|
+
each +
|
|
20
|
+
(i < values.length ? encodeURIComponent(values[i] ?? "") : ""), "");
|
|
21
|
+
}
|
|
22
|
+
// [function]
|
|
23
|
+
// the full URL of an API path, with `params` as its query. Undefined and null
|
|
24
|
+
// params are left out.
|
|
25
|
+
function endpoint(path, params) {
|
|
26
|
+
const url = new URL(`${HOST_HTTP_API}/${VERSION}${path}`);
|
|
27
|
+
for (const [key, value] of Object.entries(params ?? {})) {
|
|
28
|
+
if ((value ?? null) !== null) {
|
|
29
|
+
url.searchParams.set(key, String(value));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return url.href;
|
|
33
|
+
}
|
|
34
|
+
// [function]
|
|
35
|
+
// the headers that authenticate a request with an access token.
|
|
36
|
+
export function auth(token) {
|
|
37
|
+
return token ? { Authorization: `Bearer ${token}` } : {};
|
|
38
|
+
}
|
|
39
|
+
// [function]
|
|
40
|
+
// ends the session the access token belongs to, and only that one.
|
|
41
|
+
export function postAuthLogout(params, headers) {
|
|
42
|
+
return post(endpoint("/auth/logout", params), null, headers);
|
|
43
|
+
}
|
|
44
|
+
// [function]
|
|
45
|
+
export function postAuthRefresh(form, params, headers) {
|
|
46
|
+
return answer(post(endpoint("/auth/refresh", params), form, headers));
|
|
47
|
+
}
|
|
48
|
+
// [function]
|
|
49
|
+
export function postFlow(form, params, headers) {
|
|
50
|
+
return answer(post(endpoint("/flows", params), form, headers));
|
|
51
|
+
}
|
|
52
|
+
// [function]
|
|
53
|
+
export function flow(id, params, headers) {
|
|
54
|
+
return answer(get(endpoint(pathOf `/flows/${id}`, params), headers));
|
|
55
|
+
}
|
|
56
|
+
// [function]
|
|
57
|
+
export function postUpload(form, params, headers) {
|
|
58
|
+
return answer(post(endpoint("/uploads", params), form, headers));
|
|
59
|
+
}
|
|
60
|
+
// [function]
|
|
61
|
+
export function discoverGame(id, params, headers) {
|
|
62
|
+
return answer(get(endpoint(pathOf `/discover/games/${id}`, params), headers));
|
|
63
|
+
}
|
|
64
|
+
// [function]
|
|
65
|
+
export function discoverGameBuilds(id, params, headers) {
|
|
66
|
+
return answer(get(endpoint(pathOf `/discover/games/${id}/builds`, params), headers));
|
|
67
|
+
}
|
|
68
|
+
// [function]
|
|
69
|
+
export function discoverGameBuild(id, version, params, headers) {
|
|
70
|
+
return answer(get(endpoint(pathOf `/discover/games/${id}/builds/${version}`, params), headers));
|
|
71
|
+
}
|
|
72
|
+
// [function]
|
|
73
|
+
// a game's releases, which anyone can read: what each says about itself.
|
|
74
|
+
export function discoverGameReleases(id, params, headers) {
|
|
75
|
+
return answer(get(endpoint(pathOf `/discover/games/${id}/releases`, params), headers));
|
|
76
|
+
}
|
|
77
|
+
// [function]
|
|
78
|
+
// the game's connected repository, if it's `owner/name`; otherwise 404.
|
|
79
|
+
export function discoverGameRepo(id, owner, name, params, headers) {
|
|
80
|
+
return get(endpoint(pathOf `/discover/games/${id}/repos/${owner}/${name}`, params), headers);
|
|
81
|
+
}
|
|
82
|
+
// [function]
|
|
83
|
+
export function gameBuild(id, version, params, headers) {
|
|
84
|
+
return answer(get(endpoint(pathOf `/games/${id}/builds/${version}`, params), headers));
|
|
85
|
+
}
|
|
86
|
+
// [function]
|
|
87
|
+
// whether the caller's game could take a handle on a deploy to `channel`:
|
|
88
|
+
// its status is available, taken, limit, or lapsed.
|
|
89
|
+
export function gameHandle(id, handle, params, headers) {
|
|
90
|
+
return answer(get(endpoint(pathOf `/games/${id}/handles/${handle}`, params), headers));
|
|
91
|
+
}
|
|
92
|
+
// [function]
|
|
93
|
+
export function release(id, params, headers) {
|
|
94
|
+
return answer(get(endpoint(pathOf `/releases/${id}`, params), headers));
|
|
95
|
+
}
|
|
96
|
+
// [function]
|
|
97
|
+
// deletes the caller's own game, by its id: at once, and for good. One that
|
|
98
|
+
// isn't the caller's, isn't on Arcadible, or is deleted already is a 404.
|
|
99
|
+
export function deleteGame(id, params, headers) {
|
|
100
|
+
return del(endpoint(pathOf `/games/${id}`, params), headers);
|
|
101
|
+
}
|
|
102
|
+
// [function]
|
|
103
|
+
// the live keys of the caller's own game: never the keys themselves.
|
|
104
|
+
export function gameKeys(id, params, headers) {
|
|
105
|
+
return answer(get(endpoint(pathOf `/games/${id}/keys`, params), headers));
|
|
106
|
+
}
|
|
107
|
+
// [function]
|
|
108
|
+
// a new key for the caller's own game, answered once, in `key`.
|
|
109
|
+
export function postGameKey(id, form, params, headers) {
|
|
110
|
+
return answer(post(endpoint(pathOf `/games/${id}/keys`, params), form, headers));
|
|
111
|
+
}
|
|
112
|
+
// [function]
|
|
113
|
+
// revokes a key of the caller's own game, by the key's id.
|
|
114
|
+
export function deleteGameKey(id, key, params, headers) {
|
|
115
|
+
return answer(del(endpoint(pathOf `/games/${id}/keys/${key}`, params), headers));
|
|
116
|
+
}
|
|
117
|
+
// [function]
|
|
118
|
+
// the secrets of the caller's own game's runner, by channel and name: never
|
|
119
|
+
// their values.
|
|
120
|
+
export function gameSecrets(id, params, headers) {
|
|
121
|
+
return answer(get(endpoint(pathOf `/games/${id}/secrets`, params), headers));
|
|
122
|
+
}
|
|
123
|
+
// [function]
|
|
124
|
+
// a secret's address: its channel, and its name in lowercase, as the API's
|
|
125
|
+
// addresses are.
|
|
126
|
+
function secretPath(id, channel, name) {
|
|
127
|
+
return pathOf `/games/${id}/secrets/${channel}/${name.toLowerCase()}`;
|
|
128
|
+
}
|
|
129
|
+
// [function]
|
|
130
|
+
// sets a secret of the caller's own game, with its value in the form.
|
|
131
|
+
export function putGameSecret(id, channel, name, form, params, headers) {
|
|
132
|
+
return answer(put(endpoint(secretPath(id, channel, name), params), form, headers));
|
|
133
|
+
}
|
|
134
|
+
// [function]
|
|
135
|
+
// removes a secret of the caller's own game.
|
|
136
|
+
export function deleteGameSecret(id, channel, name, params, headers) {
|
|
137
|
+
return answer(del(endpoint(secretPath(id, channel, name), params), headers));
|
|
138
|
+
}
|
|
139
|
+
// [function]
|
|
140
|
+
// the pauses of the caller's own game's function, by channel and reason.
|
|
141
|
+
export function gamePauses(id, params, headers) {
|
|
142
|
+
return answer(get(endpoint(pathOf `/games/${id}/pauses`, params), headers));
|
|
143
|
+
}
|
|
144
|
+
// [function]
|
|
145
|
+
// the usage of the caller's own game's function this month: a row a channel
|
|
146
|
+
// and a day, each with the game's allowance.
|
|
147
|
+
export function gameUsages(id, params, headers) {
|
|
148
|
+
return answer(get(endpoint(pathOf `/games/${id}/usages`, params), headers));
|
|
149
|
+
}
|
|
150
|
+
// [function]
|
|
151
|
+
// pauses the function of the caller's own game on a channel.
|
|
152
|
+
export function putGamePause(id, channel, params, headers) {
|
|
153
|
+
return answer(put(endpoint(pathOf `/games/${id}/pauses/${channel}`, params), null, headers));
|
|
154
|
+
}
|
|
155
|
+
// [function]
|
|
156
|
+
// resumes the function of the caller's own game on a channel: lifts its
|
|
157
|
+
// owner's pause, and no other.
|
|
158
|
+
export function deleteGamePause(id, channel, params, headers) {
|
|
159
|
+
return del(endpoint(pathOf `/games/${id}/pauses/${channel}`, params), headers);
|
|
160
|
+
}
|
package/dist/arc.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// the entry: runs the command the first argument names, or with none, or
|
|
2
|
+
// one that isn't a command, prints the help, the version, or what's wrong.
|
|
3
|
+
// [import]
|
|
4
|
+
import { normalize } from "./cli/argv.js";
|
|
5
|
+
import { execute } from "./cli/command.js";
|
|
6
|
+
import { COMMANDS } from "./commands.js";
|
|
7
|
+
import { version } from "./config/package.js";
|
|
8
|
+
import { tool } from "./config/product.js";
|
|
9
|
+
import { hideBin, yargs } from "./cli/yargs.js";
|
|
10
|
+
// [declare]
|
|
11
|
+
const TOOL = tool;
|
|
12
|
+
const VERSION = version;
|
|
13
|
+
// [function]
|
|
14
|
+
// `arc` with no command: the help, which lists every command that isn't
|
|
15
|
+
// hidden, the version, or an argument that isn't a command, refused.
|
|
16
|
+
async function help(args) {
|
|
17
|
+
const cli = COMMANDS.filter((each) => !each.hidden)
|
|
18
|
+
.reduce((each, { name, summary }) => each.command(name, summary), yargs(normalize(args)).scriptName(TOOL).usage("$0 <command> [options]"))
|
|
19
|
+
.help("help")
|
|
20
|
+
.alias("help", "h")
|
|
21
|
+
.version(VERSION)
|
|
22
|
+
.alias("version", "v")
|
|
23
|
+
.strict();
|
|
24
|
+
const argv = await cli.parse();
|
|
25
|
+
if (!argv._.length) {
|
|
26
|
+
cli.showHelp();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// [function]
|
|
30
|
+
// a command is one only as the first argument.
|
|
31
|
+
async function main(args) {
|
|
32
|
+
const entry = COMMANDS.find((each) => each.name === args[0]);
|
|
33
|
+
if (!entry) {
|
|
34
|
+
await help(args);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const command = await entry.load();
|
|
38
|
+
await execute(command.default, args.slice(1));
|
|
39
|
+
}
|
|
40
|
+
// [start]
|
|
41
|
+
await main(hideBin(process.argv));
|
package/dist/cli/argv.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// [import]
|
|
2
|
+
// [import]
|
|
3
|
+
import { ARGUMENT_INVALID } from "../config/code.js";
|
|
4
|
+
import { ArcError } from "../util/error.js";
|
|
5
|
+
import { abort } from "../util/output.js";
|
|
6
|
+
import { Parser as parse } from "./yargs.js";
|
|
7
|
+
// [function]
|
|
8
|
+
// the arguments with an attached `-C<dir>` split into `-C <dir>`. yargs reads
|
|
9
|
+
// `-C./dir` as an option named `C./dir`, and `-Cdir` as the flags -C -d -i -r,
|
|
10
|
+
// so neither would reach the command as a directory.
|
|
11
|
+
export function normalize(args) {
|
|
12
|
+
return args.flatMap((arg) => {
|
|
13
|
+
if (/^-C[^=]/u.test(arg)) {
|
|
14
|
+
return ["-C", arg.slice(2)];
|
|
15
|
+
}
|
|
16
|
+
return [arg];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// [function]
|
|
20
|
+
// the working directory `args` ask for, parsed as the command parses them,
|
|
21
|
+
// in every form: -C dir, -C=dir, -Cdir, --cwd dir, and --cwd=dir. Given more
|
|
22
|
+
// than once, yargs' parser lists them all, and the last is the one read.
|
|
23
|
+
export function cwd(args) {
|
|
24
|
+
const parsed = parse(normalize(args), {
|
|
25
|
+
alias: { cwd: ["C"] },
|
|
26
|
+
string: ["cwd"],
|
|
27
|
+
});
|
|
28
|
+
const given = Array.isArray(parsed["cwd"])
|
|
29
|
+
? parsed["cwd"].at(-1)
|
|
30
|
+
: parsed["cwd"];
|
|
31
|
+
return typeof given === "string" && given ? given : ".";
|
|
32
|
+
}
|
|
33
|
+
// [function]
|
|
34
|
+
// whether `args` pass --json, before the command parses its options.
|
|
35
|
+
export function json(args) {
|
|
36
|
+
return Boolean(parse(normalize(args), {
|
|
37
|
+
alias: { json: ["j"] },
|
|
38
|
+
boolean: ["json"],
|
|
39
|
+
})["json"]);
|
|
40
|
+
}
|
|
41
|
+
// [function]
|
|
42
|
+
// yargs' failure handler for a command with --json: an argument error is
|
|
43
|
+
// one JSON document when --json was passed (OUTPUT.md), and yargs' own help
|
|
44
|
+
// and message otherwise.
|
|
45
|
+
export function fail(args) {
|
|
46
|
+
const asJson = json(args);
|
|
47
|
+
return (message, ex, cli) => {
|
|
48
|
+
if (ex) {
|
|
49
|
+
throw ex;
|
|
50
|
+
}
|
|
51
|
+
if (asJson) {
|
|
52
|
+
// it exits, once stdout has written the document: not waited for.
|
|
53
|
+
void abort("", new ArcError(ARGUMENT_INVALID, String(message)), {
|
|
54
|
+
json: asJson,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
cli.showHelp("error");
|
|
58
|
+
console.error(`\n${message}`);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// the channel a command acts on, named by a flag of its own: `--production`
|
|
2
|
+
// or `--staging`. A command that changes something takes exactly one, and
|
|
3
|
+
// says so when it's given neither, since which channel is a choice, never
|
|
4
|
+
// something to guess. One that only shows takes one, or neither for both.
|
|
5
|
+
// `-r` is `arc play`'s, where a version makes sense too. The two flags are
|
|
6
|
+
// declared in ./options.ts (`CHANNEL`, `CHANNEL_SHOWS`).
|
|
7
|
+
// [import]
|
|
8
|
+
import { ARGUMENT_INVALID } from "../config/code.js";
|
|
9
|
+
import { ArcError } from "../util/error.js";
|
|
10
|
+
import { channelBoth, channelRequired } from "../phrase/index.js";
|
|
11
|
+
// [function]
|
|
12
|
+
// the channel the flags name, or null for neither. Both is refused; and so
|
|
13
|
+
// is neither when `usage` is given, the command as it's typed, which is then
|
|
14
|
+
// shown with each flag.
|
|
15
|
+
export function of(argv, usage = null) {
|
|
16
|
+
if (argv.production && argv.staging) {
|
|
17
|
+
throw new ArcError(ARGUMENT_INVALID, channelBoth());
|
|
18
|
+
}
|
|
19
|
+
if (argv.production) {
|
|
20
|
+
return "production";
|
|
21
|
+
}
|
|
22
|
+
if (argv.staging) {
|
|
23
|
+
return "staging";
|
|
24
|
+
}
|
|
25
|
+
if (usage) {
|
|
26
|
+
throw new ArcError(ARGUMENT_INVALID, channelRequired(usage));
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// a command's one shape, and running one: `defineCommand` takes a command's
|
|
2
|
+
// options and its flow, and `execute` does the rest around them: reads the
|
|
3
|
+
// command's defaults from `.arcrc`, builds the yargs parser, runs the flow,
|
|
4
|
+
// and sends a failure down the one error path (`abort`).
|
|
5
|
+
// [import]
|
|
6
|
+
import { fail, normalize } from "./argv.js";
|
|
7
|
+
import { aborted } from "../phrase/index.js";
|
|
8
|
+
import { abort, exit } from "../util/output.js";
|
|
9
|
+
import { version } from "../config/package.js";
|
|
10
|
+
import { tool } from "../config/product.js";
|
|
11
|
+
import { findRc } from "./rc.js";
|
|
12
|
+
import { yargs } from "./yargs.js";
|
|
13
|
+
// [declare]
|
|
14
|
+
const TOOL = tool;
|
|
15
|
+
const VERSION = version;
|
|
16
|
+
// [function]
|
|
17
|
+
function isFamily(command) {
|
|
18
|
+
return "commands" in command;
|
|
19
|
+
}
|
|
20
|
+
// [function]
|
|
21
|
+
// the parsed options and positionals `run` reads, by name, each boolean
|
|
22
|
+
// read for truth (see `Value`).
|
|
23
|
+
function values(options, positionals, parsed) {
|
|
24
|
+
return Object.fromEntries(Object.entries({ ...options, ...positionals }).map(([name, spec]) => {
|
|
25
|
+
const value = parsed[name];
|
|
26
|
+
return [
|
|
27
|
+
name,
|
|
28
|
+
spec.type === "boolean" && value !== undefined ? Boolean(value) : value,
|
|
29
|
+
];
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
export function defineCommand(spec) {
|
|
33
|
+
if ("commands" in spec) {
|
|
34
|
+
return spec;
|
|
35
|
+
}
|
|
36
|
+
const { options = {}, positionals = {}, run, ...named } = spec;
|
|
37
|
+
return {
|
|
38
|
+
...named,
|
|
39
|
+
options,
|
|
40
|
+
positionals,
|
|
41
|
+
// the one place a parsed value is taken for its declared type: `Value`
|
|
42
|
+
// says what yargs gives for each, and `values` makes each boolean one.
|
|
43
|
+
run: (parsed, aborting) => run(values(options, positionals, parsed), aborting),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// [function]
|
|
47
|
+
// an option as yargs takes it, its default the section's when `.arcrc` sets
|
|
48
|
+
// it.
|
|
49
|
+
function given(name, spec, conf) {
|
|
50
|
+
const { rc, required: _required, ...rest } = spec;
|
|
51
|
+
return rc
|
|
52
|
+
? {
|
|
53
|
+
...rest,
|
|
54
|
+
default: Object.hasOwn(conf, name) ? conf[name] : rest.default,
|
|
55
|
+
}
|
|
56
|
+
: rest;
|
|
57
|
+
}
|
|
58
|
+
// [function]
|
|
59
|
+
function withOptions(cli, options, conf) {
|
|
60
|
+
return Object.entries(options).reduce((each, [name, spec]) => each.option(name, given(name, spec, conf)), cli);
|
|
61
|
+
}
|
|
62
|
+
// [function]
|
|
63
|
+
function withPositionals(cli, positionals, conf) {
|
|
64
|
+
return Object.entries(positionals).reduce((each, [name, spec]) => each.positional(name, given(name, spec, conf)), cli);
|
|
65
|
+
}
|
|
66
|
+
// [function]
|
|
67
|
+
// the positionals as they're typed: `<id>`, `[method]`.
|
|
68
|
+
function syntax(positionals) {
|
|
69
|
+
return Object.entries(positionals)
|
|
70
|
+
.map(([name, spec]) => (spec.required ? `<${name}>` : `[${name}]`))
|
|
71
|
+
.join(" ");
|
|
72
|
+
}
|
|
73
|
+
// [function]
|
|
74
|
+
// whether the command, or one of a family's, takes --json: its argument
|
|
75
|
+
// errors are then JSON too (`fail`).
|
|
76
|
+
function takesJson(command) {
|
|
77
|
+
return isFamily(command)
|
|
78
|
+
? command.commands.some(takesJson)
|
|
79
|
+
: Object.hasOwn(command.options, "json");
|
|
80
|
+
}
|
|
81
|
+
// [function]
|
|
82
|
+
function usage(command) {
|
|
83
|
+
if (isFamily(command)) {
|
|
84
|
+
return "$0 <command> [options]";
|
|
85
|
+
}
|
|
86
|
+
return ["$0", syntax(command.positionals), "[options]"]
|
|
87
|
+
.filter(Boolean)
|
|
88
|
+
.join(" ");
|
|
89
|
+
}
|
|
90
|
+
// [function]
|
|
91
|
+
// a family's commands on `cli`, to any depth, with the options the project's
|
|
92
|
+
// rc gave (`conf`). The one the arguments name is given to `matched`.
|
|
93
|
+
function withCommands(cli, family, conf, matched) {
|
|
94
|
+
const added = family.commands.reduce((each, child) => {
|
|
95
|
+
const summary = child.hidden ? false : child.summary;
|
|
96
|
+
if (isFamily(child)) {
|
|
97
|
+
return each.command(child.name, summary, (sub) => withCommands(sub, child, conf, matched));
|
|
98
|
+
}
|
|
99
|
+
return each.command([child.name, syntax(child.positionals)].filter(Boolean).join(" "), summary, (sub) => withPositionals(withOptions(sub, child.options, conf), child.positionals, conf), (parsed) => {
|
|
100
|
+
matched({ command: child, heading: family.name, parsed });
|
|
101
|
+
});
|
|
102
|
+
}, cli);
|
|
103
|
+
const demanded = added.demandCommand(1);
|
|
104
|
+
return family.epilogue ? demanded.epilogue(family.epilogue) : demanded;
|
|
105
|
+
}
|
|
106
|
+
// [function]
|
|
107
|
+
// a top-level command's own options and positionals on `cli`.
|
|
108
|
+
function withCommand(cli, command, conf) {
|
|
109
|
+
const positionals = syntax(command.positionals);
|
|
110
|
+
return withOptions(positionals
|
|
111
|
+
? cli.command(`$0 ${positionals}`, false, (sub) => withPositionals(sub, command.positionals, conf))
|
|
112
|
+
: cli, command.options, conf);
|
|
113
|
+
}
|
|
114
|
+
// [function]
|
|
115
|
+
// the parser `arc <name>` reads its arguments with.
|
|
116
|
+
function parser(command, args, conf, matched) {
|
|
117
|
+
const cli = yargs(normalize(args))
|
|
118
|
+
.scriptName(`${TOOL} ${command.name}`)
|
|
119
|
+
.usage(command.usage ?? usage(command));
|
|
120
|
+
const built = (isFamily(command)
|
|
121
|
+
? withCommands(cli, command, conf, matched)
|
|
122
|
+
: withCommand(cli, command, conf))
|
|
123
|
+
.help("help")
|
|
124
|
+
.alias("help", "h")
|
|
125
|
+
.version(VERSION)
|
|
126
|
+
.alias("version", "v");
|
|
127
|
+
return (takesJson(command) ? built.fail(fail(args)) : built).strict();
|
|
128
|
+
}
|
|
129
|
+
// [function]
|
|
130
|
+
// runs the command's flow, and ends as it says: with its exit code, or by
|
|
131
|
+
// the one error path.
|
|
132
|
+
async function run({ command, heading, parsed }) {
|
|
133
|
+
const aborting = {};
|
|
134
|
+
try {
|
|
135
|
+
const code = await command.run(parsed, aborting);
|
|
136
|
+
if (typeof code === "number") {
|
|
137
|
+
await exit(code);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch (ex) {
|
|
141
|
+
await abort(aborted(heading), ex instanceof Error ? ex : new Error(String(ex)), {
|
|
142
|
+
...aborting,
|
|
143
|
+
json: Object.hasOwn(command.options, "json") && Boolean(parsed["json"]),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// [function]
|
|
148
|
+
// runs a top-level command with `args`, the arguments after its name.
|
|
149
|
+
// `--help`, `--version`, and an argument error end inside the parser.
|
|
150
|
+
export async function execute(command, args) {
|
|
151
|
+
// the section is the top-level command's, for a family's commands too.
|
|
152
|
+
const conf = await findRc(TOOL, command.name, args);
|
|
153
|
+
const matches = [];
|
|
154
|
+
const parsed = await parser(command, args, conf, (match) => {
|
|
155
|
+
matches.push(match);
|
|
156
|
+
}).parse();
|
|
157
|
+
const match = isFamily(command)
|
|
158
|
+
? matches[0]
|
|
159
|
+
: { command, heading: command.name, parsed };
|
|
160
|
+
if (match) {
|
|
161
|
+
await run(match);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// asking before what can't be undone: revoking a key, removing a secret,
|
|
2
|
+
// deleting a game. At
|
|
3
|
+
// a terminal the command asks, and anything but yes leaves things as they
|
|
4
|
+
// are. Where there's no one to ask (a script, an agent, `--json`), it's
|
|
5
|
+
// refused unless `--yes` says it's meant, so nothing irreversible happens by
|
|
6
|
+
// a command that was only half typed. What one command undoes (a pause, a
|
|
7
|
+
// secret set again) isn't asked about. `--yes` is declared in ./options.ts
|
|
8
|
+
// (`YES`).
|
|
9
|
+
// [import]
|
|
10
|
+
import { confirm } from "@inquirer/prompts";
|
|
11
|
+
// [import]
|
|
12
|
+
import { ARGUMENT_INVALID } from "../config/code.js";
|
|
13
|
+
import { ArcError } from "../util/error.js";
|
|
14
|
+
import { confirmRequired } from "../phrase/index.js";
|
|
15
|
+
// [function]
|
|
16
|
+
// refuses a command that would have to ask and has no one to: no `--yes`,
|
|
17
|
+
// and no terminal, or `--json`. It shows `usage`, the command as it's typed,
|
|
18
|
+
// with the flag. A command whose question needs something read first (the
|
|
19
|
+
// game's name) calls this before it reads, so what's missing from its
|
|
20
|
+
// arguments is said before anything else, as `sure` says it.
|
|
21
|
+
export function askable(argv, usage) {
|
|
22
|
+
if (argv.yes) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (argv.json || !process.stdin.isTTY || !process.stdout.isTTY) {
|
|
26
|
+
throw new ArcError(ARGUMENT_INVALID, confirmRequired(usage));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// [function]
|
|
30
|
+
// resolves with whether to go ahead: `--yes`, or a yes to `question` at a
|
|
31
|
+
// terminal. With no terminal and no `--yes`, it's refused, showing `usage`,
|
|
32
|
+
// the command as it's typed, with the flag.
|
|
33
|
+
export async function sure(argv, { question, usage }) {
|
|
34
|
+
askable(argv, usage);
|
|
35
|
+
if (argv.yes) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return confirm({ default: false, message: question });
|
|
39
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// the options several commands take, declared once: a command lists the
|
|
2
|
+
// ones it takes, under the option's name (`options: { json: JSON_OUTPUT }`).
|
|
3
|
+
// One marked `rc` takes its default from the command's section of `.arcrc`,
|
|
4
|
+
// when the section has it.
|
|
5
|
+
// [declare]
|
|
6
|
+
// the --browser option of arc open and arc play.
|
|
7
|
+
export const BROWSER = {
|
|
8
|
+
default: false,
|
|
9
|
+
describe: "Open in a web browser",
|
|
10
|
+
rc: true,
|
|
11
|
+
type: "boolean",
|
|
12
|
+
};
|
|
13
|
+
// [declare]
|
|
14
|
+
// the -C, --cwd option of every project command.
|
|
15
|
+
export const CWD = {
|
|
16
|
+
alias: "C",
|
|
17
|
+
default: ".",
|
|
18
|
+
describe: "Set the working directory",
|
|
19
|
+
type: "string",
|
|
20
|
+
};
|
|
21
|
+
// [declare]
|
|
22
|
+
// the -j, --json option, which prints one JSON document (OUTPUT.md).
|
|
23
|
+
export const JSON_OUTPUT = {
|
|
24
|
+
alias: "j",
|
|
25
|
+
default: false,
|
|
26
|
+
describe: "Format output as JSON",
|
|
27
|
+
rc: true,
|
|
28
|
+
type: "boolean",
|
|
29
|
+
};
|
|
30
|
+
// [declare]
|
|
31
|
+
// the -q, --quiet option, which prints only errors.
|
|
32
|
+
export const QUIET = {
|
|
33
|
+
alias: "q",
|
|
34
|
+
default: false,
|
|
35
|
+
describe: "Output only errors",
|
|
36
|
+
rc: true,
|
|
37
|
+
type: "boolean",
|
|
38
|
+
};
|
|
39
|
+
// [declare]
|
|
40
|
+
// `--yes`, for a command that asks before what can't be undone: revoking a
|
|
41
|
+
// key, removing a secret, deleting a game.
|
|
42
|
+
export const YES = {
|
|
43
|
+
describe: "Don't ask first",
|
|
44
|
+
type: "boolean",
|
|
45
|
+
};
|
|
46
|
+
// [declare]
|
|
47
|
+
// the channel a command acts on, named by a flag of its own: `--production`
|
|
48
|
+
// or `--staging`, spread into a command's options (`...CHANNEL`). A command
|
|
49
|
+
// that changes something takes exactly one, and says so when it's given
|
|
50
|
+
// neither, since which channel is a choice, never something to guess. `-r`
|
|
51
|
+
// is `arc play`'s, where a version makes sense too.
|
|
52
|
+
export const CHANNEL = {
|
|
53
|
+
production: { describe: "On production", type: "boolean" },
|
|
54
|
+
staging: { describe: "On staging", type: "boolean" },
|
|
55
|
+
};
|
|
56
|
+
// [declare]
|
|
57
|
+
// the pair for a command that only shows, which takes one, or neither for
|
|
58
|
+
// both.
|
|
59
|
+
export const CHANNEL_SHOWS = {
|
|
60
|
+
production: { describe: "Only production's", type: "boolean" },
|
|
61
|
+
staging: { describe: "Only staging's", type: "boolean" },
|
|
62
|
+
};
|