arcadible 0.1.11 → 0.1.12
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-deploy.js +8 -6
- package/bin/arc-init.js +1 -1
- package/bin/arc-login.js +1 -1
- package/bin/arc-pack.js +5 -3
- package/package.json +2 -2
- package/src/action/init/tool.js +1 -1
- package/src/action/login/flow.js +13 -9
- package/src/schema/game.js +9 -4
- package/src/schema/workflow.js +3 -3
- package/src/util/delay.js +13 -8
- package/src/util/toml.js +1 -1
package/bin/arc-deploy.js
CHANGED
|
@@ -46,7 +46,7 @@ const handler = function ({ json, quiet }) {
|
|
|
46
46
|
return {
|
|
47
47
|
onBegin() {
|
|
48
48
|
if (!json && !quiet) {
|
|
49
|
-
log.p("Deploying
|
|
49
|
+
log.p("Deploying...");
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
onInfo({ level, message }) {
|
|
@@ -58,12 +58,12 @@ const handler = function ({ json, quiet }) {
|
|
|
58
58
|
log.pw(`⚠ ${message}`);
|
|
59
59
|
return;
|
|
60
60
|
default:
|
|
61
|
-
log.p(
|
|
61
|
+
log.p(`· ${message}`);
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
onRefresh(refresh) {
|
|
65
65
|
if (!json) {
|
|
66
|
-
log.p("
|
|
66
|
+
log.p("Authenticating...");
|
|
67
67
|
}
|
|
68
68
|
return refresh(true);
|
|
69
69
|
},
|
|
@@ -84,9 +84,11 @@ const start = function (argv) {
|
|
|
84
84
|
return validate({ root });
|
|
85
85
|
})
|
|
86
86
|
.then((issues) => {
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
throw new Error(
|
|
87
|
+
const count = issues.length;
|
|
88
|
+
if (count) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`${count} ${count === 1 ? "issue" : "issues"} found. Run \`arc validate\` for details.`,
|
|
91
|
+
);
|
|
90
92
|
}
|
|
91
93
|
return deploy({
|
|
92
94
|
git: argv.git,
|
package/bin/arc-init.js
CHANGED
package/bin/arc-login.js
CHANGED
|
@@ -105,7 +105,7 @@ const main = function (argv) {
|
|
|
105
105
|
.option("browser", {
|
|
106
106
|
default: conf.browser,
|
|
107
107
|
describe:
|
|
108
|
-
"Open a web browser automatically (
|
|
108
|
+
"Open a web browser automatically (disable with --no-browser)",
|
|
109
109
|
type: "boolean",
|
|
110
110
|
})
|
|
111
111
|
.help("help")
|
package/bin/arc-pack.js
CHANGED
|
@@ -47,9 +47,11 @@ const start = function (argv) {
|
|
|
47
47
|
const root = resolve(process.cwd(), argv.cwd);
|
|
48
48
|
return validate({ root })
|
|
49
49
|
.then((issues) => {
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
throw new Error(
|
|
50
|
+
const count = issues.length;
|
|
51
|
+
if (count) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`${count} ${count === 1 ? "issue" : "issues"} found. Run \`arc validate\` for details.`,
|
|
54
|
+
);
|
|
53
55
|
}
|
|
54
56
|
return pack({ output: argv.output, root });
|
|
55
57
|
})
|
package/package.json
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"arc-whoami": "bin/arc-whoami.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@iarna/toml": "^2.2.5",
|
|
15
14
|
"@inquirer/prompts": "^8.5.2",
|
|
16
15
|
"adm-zip": "^0.5.16",
|
|
17
16
|
"chalk": "^4.1.2",
|
|
@@ -25,6 +24,7 @@
|
|
|
25
24
|
"marked": "^17.0.1",
|
|
26
25
|
"mp4box": "^2.3.0",
|
|
27
26
|
"open": "^8.4.2",
|
|
27
|
+
"pretty-toml": "^1.0.0",
|
|
28
28
|
"rc": "^1.2.8",
|
|
29
29
|
"semver": "^7.7.3",
|
|
30
30
|
"yargs": "^17.7.2",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"license": "Apache-2.0",
|
|
52
52
|
"main": "./src/cli/index.js",
|
|
53
53
|
"name": "arcadible",
|
|
54
|
-
"version": "0.1.
|
|
54
|
+
"version": "0.1.12"
|
|
55
55
|
}
|
package/src/action/init/tool.js
CHANGED
|
@@ -52,7 +52,7 @@ const scaffold = function (src, dest, { onBegin, onInfo }) {
|
|
|
52
52
|
const init = function (dest, { force, template }, handler) {
|
|
53
53
|
return pathExists(dest).then((exists) => {
|
|
54
54
|
if (exists && !force) {
|
|
55
|
-
throw new Error("Directory already exists
|
|
55
|
+
throw new Error("Directory already exists (overwrite with `--force`).");
|
|
56
56
|
}
|
|
57
57
|
return scaffold(template, dest, handler);
|
|
58
58
|
});
|
package/src/action/login/flow.js
CHANGED
|
@@ -16,6 +16,16 @@ const time = require("../../util/time");
|
|
|
16
16
|
const poll = delay.poll;
|
|
17
17
|
const randomUUID = crypto.randomUUID;
|
|
18
18
|
|
|
19
|
+
// [declare]
|
|
20
|
+
|
|
21
|
+
const POLL = {
|
|
22
|
+
delay: time.s(3),
|
|
23
|
+
factor: 2,
|
|
24
|
+
interval: time.s(30),
|
|
25
|
+
maxDelay: time.s(15),
|
|
26
|
+
timeoutError: "Login request expired.",
|
|
27
|
+
};
|
|
28
|
+
|
|
19
29
|
// [function]
|
|
20
30
|
|
|
21
31
|
const postFlow = function ({ expiresAt, token, type }) {
|
|
@@ -56,9 +66,9 @@ const pollFlow = function ({ id, token }, onPoll) {
|
|
|
56
66
|
case "completed":
|
|
57
67
|
return data;
|
|
58
68
|
case "failed":
|
|
59
|
-
throw new Error("Login
|
|
69
|
+
throw new Error("Login request failed.");
|
|
60
70
|
default:
|
|
61
|
-
throw new Error("Login
|
|
71
|
+
throw new Error("Login request expired.");
|
|
62
72
|
}
|
|
63
73
|
});
|
|
64
74
|
};
|
|
@@ -80,13 +90,7 @@ const main = function ({ onCreated, onPoll }) {
|
|
|
80
90
|
return poll(
|
|
81
91
|
(flow) => pollFlow(flow, onPoll),
|
|
82
92
|
{ id, token },
|
|
83
|
-
{
|
|
84
|
-
delay: time.s(3),
|
|
85
|
-
factor: 2,
|
|
86
|
-
interval: time.s(30),
|
|
87
|
-
maxDelay: time.s(15),
|
|
88
|
-
timeout,
|
|
89
|
-
},
|
|
93
|
+
{ ...POLL, timeout },
|
|
90
94
|
);
|
|
91
95
|
});
|
|
92
96
|
};
|
package/src/schema/game.js
CHANGED
|
@@ -22,6 +22,7 @@ const strs = require("../util/strs");
|
|
|
22
22
|
|
|
23
23
|
// [use]
|
|
24
24
|
|
|
25
|
+
const cleanSemver = semver.clean;
|
|
25
26
|
const existsCheck = check.exists;
|
|
26
27
|
const imageCheck = check.image;
|
|
27
28
|
const indentLines = strs.indentLines;
|
|
@@ -303,14 +304,14 @@ const zId = function () {
|
|
|
303
304
|
return z
|
|
304
305
|
.string(
|
|
305
306
|
message(field, [
|
|
306
|
-
"Must be
|
|
307
|
-
"Run `arc init` to generate a new
|
|
307
|
+
"Must be defined.",
|
|
308
|
+
"Run `arc init` to generate a new ID.",
|
|
308
309
|
]),
|
|
309
310
|
)
|
|
310
311
|
.uuid(message(field, ["Must be a valid UUID."]))
|
|
311
312
|
.refine(
|
|
312
313
|
(value) => value === value.toLowerCase(),
|
|
313
|
-
message(field, ["Must
|
|
314
|
+
message(field, ["Must be lowercase."]),
|
|
314
315
|
);
|
|
315
316
|
};
|
|
316
317
|
|
|
@@ -406,13 +407,17 @@ const zVersion = function () {
|
|
|
406
407
|
return z
|
|
407
408
|
.string(
|
|
408
409
|
message(field, [
|
|
409
|
-
"Must be
|
|
410
|
+
"Must be defined.",
|
|
410
411
|
"A version is required unless one can be derived.",
|
|
411
412
|
]),
|
|
412
413
|
)
|
|
413
414
|
.refine(
|
|
414
415
|
(value) => validSemver(value) !== null,
|
|
415
416
|
message(field, ["Must be valid semver."]),
|
|
417
|
+
)
|
|
418
|
+
.refine(
|
|
419
|
+
(value) => cleanSemver(value) === value,
|
|
420
|
+
message(field, ["Must be normalized semver."]),
|
|
416
421
|
);
|
|
417
422
|
};
|
|
418
423
|
|
package/src/schema/workflow.js
CHANGED
|
@@ -54,7 +54,7 @@ const zDeployDir = function (root, { build }) {
|
|
|
54
54
|
const field = "deploy_dir";
|
|
55
55
|
return z
|
|
56
56
|
.string()
|
|
57
|
-
.min(1)
|
|
57
|
+
.min(1, message(field, ["Must be defined."]))
|
|
58
58
|
.refine(
|
|
59
59
|
(file) => isRelativeCheck(root, file),
|
|
60
60
|
message(field, ["Must be a relative path."]),
|
|
@@ -70,8 +70,8 @@ const zDeployDir = function (root, { build }) {
|
|
|
70
70
|
.refine(
|
|
71
71
|
(file) => build || existsCheck(root, file),
|
|
72
72
|
message(field, [
|
|
73
|
-
"Must exist when
|
|
74
|
-
"Run `arc inspect workflow
|
|
73
|
+
"Must exist when no build step is defined.",
|
|
74
|
+
"Run `arc inspect workflow` for details.",
|
|
75
75
|
]),
|
|
76
76
|
);
|
|
77
77
|
};
|
package/src/util/delay.js
CHANGED
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
const time = require("./time");
|
|
6
6
|
|
|
7
|
+
// [declare]
|
|
8
|
+
|
|
9
|
+
const POLL = {
|
|
10
|
+
delay: time.s(1),
|
|
11
|
+
factor: 1,
|
|
12
|
+
interval: time.m(1),
|
|
13
|
+
maxDelay: time.s(1),
|
|
14
|
+
timeout: Infinity,
|
|
15
|
+
timeoutError: "Polling timed out.",
|
|
16
|
+
};
|
|
17
|
+
|
|
7
18
|
// [function]
|
|
8
19
|
|
|
9
20
|
const backoff = function (elapsed, delay, factor, interval, maxDelay) {
|
|
@@ -30,13 +41,7 @@ const wait = function (delay, next) {
|
|
|
30
41
|
const poll = function (
|
|
31
42
|
fn,
|
|
32
43
|
value,
|
|
33
|
-
{
|
|
34
|
-
delay = time.s(1),
|
|
35
|
-
factor = 1,
|
|
36
|
-
interval = time.m(1),
|
|
37
|
-
maxDelay = delay,
|
|
38
|
-
timeout = Infinity,
|
|
39
|
-
} = {},
|
|
44
|
+
{ delay, factor, interval, maxDelay, timeout, timeoutError } = POLL,
|
|
40
45
|
) {
|
|
41
46
|
const started = Date.now();
|
|
42
47
|
const next = function () {
|
|
@@ -46,7 +51,7 @@ const poll = function (
|
|
|
46
51
|
}
|
|
47
52
|
const elapsed = Date.now() - started;
|
|
48
53
|
if (elapsed >= timeout) {
|
|
49
|
-
throw new Error(
|
|
54
|
+
throw new Error(timeoutError);
|
|
50
55
|
}
|
|
51
56
|
return wait(backoff(elapsed, delay, factor, interval, maxDelay), next);
|
|
52
57
|
});
|