arcadible 0.1.32 → 0.1.34
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 +37 -22
- 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 +69 -58
- package/src/action/predeploy/pm.js +24 -17
- package/src/action/predeploy/published.js +15 -2
- package/src/action/predeploy/tool-git.js +74 -86
- package/src/action/predeploy/tool.js +7 -33
- package/src/action/validate/tool.js +5 -4
- package/src/api.js +14 -1
- package/src/cli/predeploy.js +1 -1
- package/src/config/code.js +112 -0
- package/src/config/url.js +2 -1
- package/src/parser/env.js +19 -3
- 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 +75 -7
- 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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// [import]
|
|
4
4
|
|
|
5
5
|
const ac = require("./ac");
|
|
6
|
-
const
|
|
6
|
+
const given = require("../../parser/given");
|
|
7
7
|
|
|
8
8
|
// [use]
|
|
9
9
|
|
|
@@ -12,40 +12,14 @@ const ensureUnpublished = ac.ensureUnpublished;
|
|
|
12
12
|
|
|
13
13
|
// [function]
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
ensureId(current, game, (err) => {
|
|
17
|
-
if (err) {
|
|
18
|
-
cb(err);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
ensureUnpublished(current, game, (err) => {
|
|
22
|
-
if (err) {
|
|
23
|
-
cb(err);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
cb(null, { to: game.version });
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// [function]
|
|
32
|
-
|
|
33
|
-
const main = function (current, { root }, { onPredeployBegin }) {
|
|
15
|
+
const main = function (current, conf, { onPredeployBegin }) {
|
|
34
16
|
if (onPredeployBegin) {
|
|
35
|
-
onPredeployBegin({ root });
|
|
17
|
+
onPredeployBegin({ root: conf.root });
|
|
36
18
|
}
|
|
37
|
-
return
|
|
38
|
-
({ game }) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (err) {
|
|
42
|
-
reject(err);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
resolve(data);
|
|
46
|
-
});
|
|
47
|
-
}),
|
|
48
|
-
);
|
|
19
|
+
return given(conf)
|
|
20
|
+
.then(({ game }) => ensureId(current, game))
|
|
21
|
+
.then((game) => ensureUnpublished(current, game))
|
|
22
|
+
.then((game) => ({ to: game.version }));
|
|
49
23
|
};
|
|
50
24
|
|
|
51
25
|
// [export]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// [import]
|
|
4
4
|
|
|
5
5
|
const game = require("../../schema/game");
|
|
6
|
-
const
|
|
6
|
+
const given = require("../../parser/given");
|
|
7
7
|
const readme = require("../../schema/readme");
|
|
8
8
|
const readmeFile = require("../../parser/readme-file");
|
|
9
9
|
const schema = require("../../util/schema");
|
|
@@ -44,13 +44,14 @@ const validate = function (proj, readmeStructure, { root }) {
|
|
|
44
44
|
const { file, ...value } = readmeStructure;
|
|
45
45
|
results.push(readmeValidator(value, { file }));
|
|
46
46
|
}
|
|
47
|
-
return results.flatMap((result) => result.issues).sort();
|
|
47
|
+
return results.flatMap((result) => result.issues).sort(schema.compare);
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// [function]
|
|
51
51
|
|
|
52
|
-
const main = function (
|
|
53
|
-
|
|
52
|
+
const main = function (conf) {
|
|
53
|
+
const root = conf.root;
|
|
54
|
+
return Promise.all([given(conf), structure(root)]).then(
|
|
54
55
|
([proj, readmeStructure]) => validate(proj, readmeStructure, { root }),
|
|
55
56
|
);
|
|
56
57
|
};
|
package/src/api.js
CHANGED
|
@@ -92,6 +92,18 @@ const release = function (id, params, headers) {
|
|
|
92
92
|
|
|
93
93
|
// [function]
|
|
94
94
|
|
|
95
|
+
const accountReleases = function (id, params, headers) {
|
|
96
|
+
return request.get(endpoint(`/accounts/${id}/releases`, params), headers);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// [function]
|
|
100
|
+
|
|
101
|
+
const gameRepos = function (id, params, headers) {
|
|
102
|
+
return request.get(endpoint(`/games/${id}/repos`, params), headers);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// [function]
|
|
106
|
+
|
|
95
107
|
const gameReleases = function (id, params, headers) {
|
|
96
108
|
return request.get(endpoint(`/games/${id}/releases`, params), headers);
|
|
97
109
|
};
|
|
@@ -99,14 +111,15 @@ const gameReleases = function (id, params, headers) {
|
|
|
99
111
|
// [export]
|
|
100
112
|
|
|
101
113
|
module.exports = {
|
|
114
|
+
accountReleases,
|
|
102
115
|
auth,
|
|
103
116
|
discoverGame,
|
|
104
117
|
discoverGameBuild,
|
|
105
118
|
discoverGameBuilds,
|
|
106
|
-
endpoint,
|
|
107
119
|
flow,
|
|
108
120
|
gameBuild,
|
|
109
121
|
gameReleases,
|
|
122
|
+
gameRepos,
|
|
110
123
|
postAuthRefresh,
|
|
111
124
|
postFlow,
|
|
112
125
|
postUpload,
|
package/src/cli/predeploy.js
CHANGED
|
@@ -9,7 +9,7 @@ const predeployToolGit = require("../action/predeploy/tool-git");
|
|
|
9
9
|
|
|
10
10
|
const main = function ({ current, git, handler, ...conf }) {
|
|
11
11
|
return git
|
|
12
|
-
? predeployToolGit(conf, handler)
|
|
12
|
+
? predeployToolGit(current, conf, handler)
|
|
13
13
|
: predeployTool(current, conf, handler);
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// every code a failure can have (OUTPUT.md, Codes), each with an entry on
|
|
3
|
+
// the Errors page. A code names one condition with one fix, as its subject
|
|
4
|
+
// then its state. It's never renamed, reused, or removed, and a new one can
|
|
5
|
+
// be added in any release.
|
|
6
|
+
|
|
7
|
+
// [declare]
|
|
8
|
+
|
|
9
|
+
// the CLI's own codes.
|
|
10
|
+
const CLI = {
|
|
11
|
+
API_ERROR: "api_error",
|
|
12
|
+
ARGUMENT_INVALID: "argument_invalid",
|
|
13
|
+
BUILD_FAILED: "build_failed",
|
|
14
|
+
GAME_EXISTS: "game_exists",
|
|
15
|
+
GAME_ID_MISSING: "game_id_missing",
|
|
16
|
+
GAME_NOT_DEPLOYED: "game_not_deployed",
|
|
17
|
+
GAME_NOT_FOUND: "game_not_found",
|
|
18
|
+
GIT_REMOTE_UNAVAILABLE: "git_remote_unavailable",
|
|
19
|
+
GIT_REPO_MISSING: "git_repo_missing",
|
|
20
|
+
GIT_TAG_CREATE_FAILED: "git_tag_create_failed",
|
|
21
|
+
GIT_TAG_EXISTS: "git_tag_exists",
|
|
22
|
+
GIT_TAG_PUSH_FAILED: "git_tag_push_failed",
|
|
23
|
+
GIT_UNCOMMITTED: "git_uncommitted",
|
|
24
|
+
LOCKFILE_MISSING: "lockfile_missing",
|
|
25
|
+
LOGIN_EXPIRED: "login_expired",
|
|
26
|
+
LOGIN_FAILED: "login_failed",
|
|
27
|
+
NETWORK_ERROR: "network_error",
|
|
28
|
+
NOT_LOGGED_IN: "not_logged_in",
|
|
29
|
+
PACKAGE_FILE_TOO_LARGE: "package_file_too_large",
|
|
30
|
+
PACKAGE_INDEX_MISSING: "package_index_missing",
|
|
31
|
+
PACKAGE_TOO_LARGE: "package_too_large",
|
|
32
|
+
PACKAGE_TOO_MANY_FILES: "package_too_many_files",
|
|
33
|
+
PACKAGE_UNCOMPRESSED_TOO_LARGE: "package_uncompressed_too_large",
|
|
34
|
+
PARSE_FAILED: "parse_failed",
|
|
35
|
+
PATH_NOT_FOUND: "path_not_found",
|
|
36
|
+
SESSION_EXPIRED: "session_expired",
|
|
37
|
+
TEMPLATE_MISSING: "template_missing",
|
|
38
|
+
TEMPLATE_UNAVAILABLE: "template_unavailable",
|
|
39
|
+
UPLOAD_FAILED: "upload_failed",
|
|
40
|
+
UPLOAD_RATE_LIMITED: "upload_rate_limited",
|
|
41
|
+
VALIDATION_FAILED: "validation_failed",
|
|
42
|
+
WAIT_TIMED_OUT: "wait_timed_out",
|
|
43
|
+
};
|
|
44
|
+
// a release's reasons, from the pipeline (the API's
|
|
45
|
+
// db/type/release_reason.sql). The CLI shares them, so a name means the same
|
|
46
|
+
// thing wherever it appears: GAME_UNAVAILABLE, INTERNAL, and VERSION_EXISTS
|
|
47
|
+
// are the CLI's too.
|
|
48
|
+
const RELEASE = {
|
|
49
|
+
APP_NOT_INSTALLED: "app_not_installed",
|
|
50
|
+
EXPIRED: "expired",
|
|
51
|
+
GAME_MISMATCH: "game_mismatch",
|
|
52
|
+
GAME_UNAVAILABLE: "game_unavailable",
|
|
53
|
+
INTERNAL: "internal",
|
|
54
|
+
MANIFEST_INVALID: "manifest_invalid",
|
|
55
|
+
RATE_LIMITED: "rate_limited",
|
|
56
|
+
REPO_NOT_CONNECTED: "repo_not_connected",
|
|
57
|
+
VERSION_EXISTS: "version_exists",
|
|
58
|
+
ZIP_INVALID: "zip_invalid",
|
|
59
|
+
ZIP_TOO_LARGE: "zip_too_large",
|
|
60
|
+
};
|
|
61
|
+
// the Arcadible check's own codes on GitHub, for a `git` release that fails
|
|
62
|
+
// before there's a release (the queue publisher Lambda). `arc deploy git`
|
|
63
|
+
// checks for workflow_missing before it pushes.
|
|
64
|
+
const GITHUB = {
|
|
65
|
+
TAG_INVALID: "tag_invalid",
|
|
66
|
+
WORKFLOW_MISSING: "workflow_missing",
|
|
67
|
+
};
|
|
68
|
+
// an `arc validate` issue's codes, named for the rule it breaks; the field
|
|
69
|
+
// is the issue's path. They follow the same rules, and share the Errors
|
|
70
|
+
// page, so no issue code is also an error code.
|
|
71
|
+
const ISSUE = {
|
|
72
|
+
CHARACTERS_INVALID: "characters_invalid",
|
|
73
|
+
DESCRIPTION_RULES_MISSING: "description_rules_missing",
|
|
74
|
+
DUPLICATE: "duplicate",
|
|
75
|
+
EMPTY: "empty",
|
|
76
|
+
INDEX_MISSING: "index_missing",
|
|
77
|
+
INVALID: "invalid",
|
|
78
|
+
MARKDOWN_INVALID: "markdown_invalid",
|
|
79
|
+
MEDIA_INVALID: "media_invalid",
|
|
80
|
+
OPTION_INVALID: "option_invalid",
|
|
81
|
+
OUT_OF_RANGE: "out_of_range",
|
|
82
|
+
PATH_INVALID: "path_invalid",
|
|
83
|
+
REQUIRED: "required",
|
|
84
|
+
TOO_LONG: "too_long",
|
|
85
|
+
TOO_MANY: "too_many",
|
|
86
|
+
TOO_SHORT: "too_short",
|
|
87
|
+
TYPE_INVALID: "type_invalid",
|
|
88
|
+
URL_INVALID: "url_invalid",
|
|
89
|
+
UUID_INVALID: "uuid_invalid",
|
|
90
|
+
VERSION_INVALID: "version_invalid",
|
|
91
|
+
};
|
|
92
|
+
// every error code, for checking one exists.
|
|
93
|
+
const ALL = new Set([
|
|
94
|
+
...Object.values(CLI),
|
|
95
|
+
...Object.values(GITHUB),
|
|
96
|
+
...Object.values(RELEASE),
|
|
97
|
+
]);
|
|
98
|
+
// every issue code.
|
|
99
|
+
const ISSUES = new Set(Object.values(ISSUE));
|
|
100
|
+
|
|
101
|
+
// [export]
|
|
102
|
+
|
|
103
|
+
module.exports = {
|
|
104
|
+
ALL,
|
|
105
|
+
...RELEASE,
|
|
106
|
+
...CLI,
|
|
107
|
+
...GITHUB,
|
|
108
|
+
GITHUB,
|
|
109
|
+
ISSUE,
|
|
110
|
+
ISSUES,
|
|
111
|
+
RELEASE,
|
|
112
|
+
};
|
package/src/config/url.js
CHANGED
|
@@ -12,7 +12,8 @@ const HANDLE = cfgproduct.handle;
|
|
|
12
12
|
// [export]
|
|
13
13
|
|
|
14
14
|
module.exports = {
|
|
15
|
-
|
|
15
|
+
ERRORS: `${cfguri.HOST_HTTP_DEVELOPER}/references/errors`,
|
|
16
|
+
GETTING_STARTED: `${cfguri.HOST_HTTP_DEVELOPER}/getting-started`,
|
|
16
17
|
LINK: `${cfguri.HOST_HTTP_ACCOUNT}/link`,
|
|
17
18
|
MANIFEST: `${cfguri.HOST_HTTP_DEVELOPER}/references/${HANDLE}-manifest`,
|
|
18
19
|
};
|
package/src/parser/env.js
CHANGED
|
@@ -10,11 +10,14 @@ const fs = require("fs-extra");
|
|
|
10
10
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
|
+
const cfgcode = require("../config/code");
|
|
14
|
+
const error = require("../util/error");
|
|
13
15
|
const objs = require("../util/objs");
|
|
14
16
|
const phrase = require("../phrase");
|
|
15
17
|
|
|
16
18
|
// [use]
|
|
17
19
|
|
|
20
|
+
const ArcError = error.ArcError;
|
|
18
21
|
const deepCompact = objs.deepCompact;
|
|
19
22
|
const join = path.join;
|
|
20
23
|
const pathExists = fs.pathExists;
|
|
@@ -22,6 +25,8 @@ const readFile = fs.readFile;
|
|
|
22
25
|
|
|
23
26
|
// [declare]
|
|
24
27
|
|
|
28
|
+
// the build a package.json build script stands for.
|
|
29
|
+
const NPM_RUN_BUILD = "npm run build";
|
|
25
30
|
const PACKAGE = "package.json";
|
|
26
31
|
|
|
27
32
|
// [function]
|
|
@@ -31,20 +36,31 @@ const parseJson = function (buf) {
|
|
|
31
36
|
try {
|
|
32
37
|
conf = JSON.parse(buf);
|
|
33
38
|
} catch (ex) {
|
|
34
|
-
throw new
|
|
39
|
+
throw new ArcError(
|
|
40
|
+
cfgcode.PARSE_FAILED,
|
|
41
|
+
phrase.unableToParse(PACKAGE, ex.message),
|
|
42
|
+
{ cause: ex },
|
|
43
|
+
);
|
|
35
44
|
}
|
|
36
45
|
if (!conf || typeof conf !== "object" || Array.isArray(conf)) {
|
|
37
|
-
throw new
|
|
46
|
+
throw new ArcError(
|
|
47
|
+
cfgcode.PARSE_FAILED,
|
|
48
|
+
phrase.unableToParse(PACKAGE, "Must be a JSON object."),
|
|
49
|
+
);
|
|
38
50
|
}
|
|
39
51
|
return conf;
|
|
40
52
|
};
|
|
41
53
|
|
|
42
54
|
// [function]
|
|
43
55
|
|
|
56
|
+
// package.json's version, and its build script as `npm run build`: run
|
|
57
|
+
// through npm, the script finds the project's own tools on the PATH
|
|
58
|
+
// (node_modules/.bin), and its prebuild and postbuild run, as they do
|
|
59
|
+
// locally. npm runs the scripts of a pnpm or Yarn project too.
|
|
44
60
|
const extract = function (conf) {
|
|
45
61
|
/* eslint-disable camelcase */
|
|
46
62
|
const game = { version: conf.version };
|
|
47
|
-
const workflow =
|
|
63
|
+
const workflow = conf.scripts?.build ? { build: NPM_RUN_BUILD } : {};
|
|
48
64
|
/* eslint-enable camelcase */
|
|
49
65
|
return deepCompact({ game, workflow }) ?? {};
|
|
50
66
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// [import]
|
|
4
|
+
|
|
5
|
+
const project = require("./project");
|
|
6
|
+
|
|
7
|
+
// [function]
|
|
8
|
+
|
|
9
|
+
// the project a step was given, or else the one at `root`. `arc deploy`
|
|
10
|
+
// parses the project once and gives it to each step.
|
|
11
|
+
const main = function ({ project: given, root }) {
|
|
12
|
+
return given ? Promise.resolve(given) : project(root);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// [export]
|
|
16
|
+
|
|
17
|
+
module.exports = main;
|
package/src/parser/manifest.js
CHANGED
|
@@ -10,12 +10,15 @@ const fs = require("fs-extra");
|
|
|
10
10
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
|
+
const cfgcode = require("../config/code");
|
|
13
14
|
const cfgproduct = require("../config/product");
|
|
15
|
+
const error = require("../util/error");
|
|
14
16
|
const phrase = require("../phrase");
|
|
15
17
|
const TOML = require("../util/toml");
|
|
16
18
|
|
|
17
19
|
// [use]
|
|
18
20
|
|
|
21
|
+
const ArcError = error.ArcError;
|
|
19
22
|
const join = path.join;
|
|
20
23
|
const pathExists = fs.pathExists;
|
|
21
24
|
const readFile = fs.readFile;
|
|
@@ -31,7 +34,11 @@ const parseToml = function (buf) {
|
|
|
31
34
|
try {
|
|
32
35
|
return TOML.parse(buf);
|
|
33
36
|
} catch (ex) {
|
|
34
|
-
throw new
|
|
37
|
+
throw new ArcError(
|
|
38
|
+
cfgcode.PARSE_FAILED,
|
|
39
|
+
phrase.unableToParse(MANIFEST, ex.message),
|
|
40
|
+
{ cause: ex },
|
|
41
|
+
);
|
|
35
42
|
}
|
|
36
43
|
};
|
|
37
44
|
|
package/src/parser/media.js
CHANGED
|
@@ -80,15 +80,11 @@ const gallery = function (root) {
|
|
|
80
80
|
// [function]
|
|
81
81
|
|
|
82
82
|
const main = function (root) {
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
.then((game) => ({ game }))
|
|
89
|
-
.then(resolve)
|
|
90
|
-
.catch(reject);
|
|
91
|
-
});
|
|
83
|
+
return Promise.resolve({})
|
|
84
|
+
.then(art(root))
|
|
85
|
+
.then(gallery(root))
|
|
86
|
+
.then(deepCompact)
|
|
87
|
+
.then((game) => ({ game }));
|
|
92
88
|
};
|
|
93
89
|
|
|
94
90
|
// [export]
|
package/src/parser/project.js
CHANGED
|
@@ -6,8 +6,10 @@ const fs = require("fs-extra");
|
|
|
6
6
|
|
|
7
7
|
// [import]
|
|
8
8
|
|
|
9
|
+
const cfgcode = require("../config/code");
|
|
9
10
|
const cfgworkflow = require("../config/workflow");
|
|
10
11
|
const env = require("./env");
|
|
12
|
+
const error = require("../util/error");
|
|
11
13
|
const manifest = require("./manifest");
|
|
12
14
|
const media = require("./media");
|
|
13
15
|
const phrase = require("../phrase");
|
|
@@ -16,6 +18,7 @@ const readme = require("./readme");
|
|
|
16
18
|
|
|
17
19
|
// [use]
|
|
18
20
|
|
|
21
|
+
const ArcError = error.ArcError;
|
|
19
22
|
const pathExists = fs.pathExists;
|
|
20
23
|
|
|
21
24
|
// [function]
|
|
@@ -69,7 +72,7 @@ const main = function (root) {
|
|
|
69
72
|
return pathExists(root)
|
|
70
73
|
.then((exists) => {
|
|
71
74
|
if (!exists) {
|
|
72
|
-
throw new
|
|
75
|
+
throw new ArcError(cfgcode.PATH_NOT_FOUND, phrase.unableToFind(root));
|
|
73
76
|
}
|
|
74
77
|
return manifest(root);
|
|
75
78
|
})
|
|
@@ -11,12 +11,15 @@ const jsdom = require("jsdom");
|
|
|
11
11
|
|
|
12
12
|
// [import]
|
|
13
13
|
|
|
14
|
+
const cfgcode = require("../config/code");
|
|
14
15
|
const cfgproduct = require("../config/product");
|
|
16
|
+
const error = require("../util/error");
|
|
15
17
|
const MD = require("../util/md");
|
|
16
18
|
const phrase = require("../phrase");
|
|
17
19
|
|
|
18
20
|
// [use]
|
|
19
21
|
|
|
22
|
+
const ArcError = error.ArcError;
|
|
20
23
|
const join = path.join;
|
|
21
24
|
const JSDOM = jsdom.JSDOM;
|
|
22
25
|
const pathExists = fs.pathExists;
|
|
@@ -43,7 +46,11 @@ const render = function (buf, file) {
|
|
|
43
46
|
try {
|
|
44
47
|
return new JSDOM(MD.parse(buf)).window.document;
|
|
45
48
|
} catch (ex) {
|
|
46
|
-
throw new
|
|
49
|
+
throw new ArcError(
|
|
50
|
+
cfgcode.PARSE_FAILED,
|
|
51
|
+
phrase.unableToParse(file, ex.message),
|
|
52
|
+
{ cause: ex },
|
|
53
|
+
);
|
|
47
54
|
}
|
|
48
55
|
};
|
|
49
56
|
|
package/src/phrase.js
CHANGED
|
@@ -149,6 +149,13 @@ const docUnsupported = function () {
|
|
|
149
149
|
|
|
150
150
|
// [function]
|
|
151
151
|
|
|
152
|
+
// the code a failure reports, above the link to its entry on the Errors page.
|
|
153
|
+
const errorCode = function (code) {
|
|
154
|
+
return `Code: ${code}`;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
// [function]
|
|
158
|
+
|
|
152
159
|
const gameExists = function (idOrHandle) {
|
|
153
160
|
return `Game exists: ${idOrHandle}`;
|
|
154
161
|
};
|
|
@@ -164,6 +171,15 @@ const gameNotDeployed = function (game) {
|
|
|
164
171
|
|
|
165
172
|
// [function]
|
|
166
173
|
|
|
174
|
+
const gameRepoMissing = function (game, url) {
|
|
175
|
+
return blocks(`${game} isn't connected to a GitHub repository.`, [
|
|
176
|
+
`Connect this repository in ${TITLE} Studio, on the game's Repository tab:`,
|
|
177
|
+
url,
|
|
178
|
+
]);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// [function]
|
|
182
|
+
|
|
167
183
|
const gameNotFound = function (idOrHandle) {
|
|
168
184
|
return `Game not found: ${idOrHandle}`;
|
|
169
185
|
};
|
|
@@ -294,6 +310,12 @@ const imageWidthMin = function (width) {
|
|
|
294
310
|
|
|
295
311
|
// [function]
|
|
296
312
|
|
|
313
|
+
const timeoutInvalid = function () {
|
|
314
|
+
return "The timeout must be a number of seconds above 0.";
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// [function]
|
|
318
|
+
|
|
297
319
|
const issuesFound = function (count) {
|
|
298
320
|
return blocks(
|
|
299
321
|
`${count} ${count === 1 ? "issue" : "issues"} found.`,
|
|
@@ -431,6 +453,12 @@ const releaseNotWaited = function () {
|
|
|
431
453
|
|
|
432
454
|
// [function]
|
|
433
455
|
|
|
456
|
+
const releaseNotWaitedOwner = function () {
|
|
457
|
+
return "Only the game's owner can wait for its release.";
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
// [function]
|
|
461
|
+
|
|
434
462
|
// `built` when workflow.build ran first.
|
|
435
463
|
const releasePublished = function (version, channel, built) {
|
|
436
464
|
return `${built ? "Built and published" : "Published"} v${version} to ${channel}.`;
|
|
@@ -446,14 +474,20 @@ const releaseTimedOut = function (
|
|
|
446
474
|
seconds,
|
|
447
475
|
{ actions, found, git, studio },
|
|
448
476
|
) {
|
|
477
|
+
const head = `Waited ${waited(seconds)} for v${version}.`;
|
|
478
|
+
if (found || !git) {
|
|
479
|
+
return blocks(head, [
|
|
480
|
+
`It may still finish. See it in ${TITLE} Studio:`,
|
|
481
|
+
studio,
|
|
482
|
+
]);
|
|
483
|
+
}
|
|
449
484
|
return blocks(
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
],
|
|
485
|
+
head,
|
|
486
|
+
[
|
|
487
|
+
"GitHub Actions hasn't released it yet, or its workflow failed:",
|
|
488
|
+
actions ?? "See the repository's Actions tab.",
|
|
489
|
+
],
|
|
490
|
+
`If the workflow passed, the ${TITLE} check on the tagged commit says why.`,
|
|
457
491
|
);
|
|
458
492
|
};
|
|
459
493
|
|
|
@@ -566,12 +600,39 @@ const unableToParse = function (file, message) {
|
|
|
566
600
|
|
|
567
601
|
// [function]
|
|
568
602
|
|
|
603
|
+
const unableToReach = function () {
|
|
604
|
+
return blocks(
|
|
605
|
+
`Unable to reach ${TITLE}.`,
|
|
606
|
+
"Check your internet connection, and try again.",
|
|
607
|
+
);
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
// [function]
|
|
611
|
+
|
|
569
612
|
const uploadFailed = function (status) {
|
|
570
613
|
return `Upload failed with status ${status}.`;
|
|
571
614
|
};
|
|
572
615
|
|
|
573
616
|
// [function]
|
|
574
617
|
|
|
618
|
+
const uploadRateLimited = function (version) {
|
|
619
|
+
return blocks(
|
|
620
|
+
`v${version} was uploaded in the last 5 minutes.`,
|
|
621
|
+
"Wait, then deploy again.",
|
|
622
|
+
);
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
// [function]
|
|
626
|
+
|
|
627
|
+
const workflowMissing = function (file) {
|
|
628
|
+
return blocks(
|
|
629
|
+
`No release workflow found: ${file}`,
|
|
630
|
+
"Add it from your starter, and commit it.",
|
|
631
|
+
);
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
// [function]
|
|
635
|
+
|
|
575
636
|
const versionPrerelease = function (version) {
|
|
576
637
|
return `Prerelease v${version}`;
|
|
577
638
|
};
|
|
@@ -688,9 +749,11 @@ module.exports = {
|
|
|
688
749
|
docMediaType,
|
|
689
750
|
docTagUnallowed,
|
|
690
751
|
docUnsupported,
|
|
752
|
+
errorCode,
|
|
691
753
|
gameExists,
|
|
692
754
|
gameNotDeployed,
|
|
693
755
|
gameNotFound,
|
|
756
|
+
gameRepoMissing,
|
|
694
757
|
gameUnavailable,
|
|
695
758
|
gitChangesPresent,
|
|
696
759
|
gitRemoteMissing,
|
|
@@ -727,6 +790,7 @@ module.exports = {
|
|
|
727
790
|
packageUncompressedTooLarge,
|
|
728
791
|
releaseFailed,
|
|
729
792
|
releaseNotWaited,
|
|
793
|
+
releaseNotWaitedOwner,
|
|
730
794
|
releasePublished,
|
|
731
795
|
releaseTimedOut,
|
|
732
796
|
releaseWaiting,
|
|
@@ -743,10 +807,13 @@ module.exports = {
|
|
|
743
807
|
tagPushed,
|
|
744
808
|
templateUnavailable,
|
|
745
809
|
timedOut,
|
|
810
|
+
timeoutInvalid,
|
|
746
811
|
unableToFind,
|
|
747
812
|
unableToOpen,
|
|
748
813
|
unableToParse,
|
|
814
|
+
unableToReach,
|
|
749
815
|
uploadFailed,
|
|
816
|
+
uploadRateLimited,
|
|
750
817
|
versionPrerelease,
|
|
751
818
|
versionPublished,
|
|
752
819
|
versionRelease,
|
|
@@ -762,4 +829,5 @@ module.exports = {
|
|
|
762
829
|
videoUnsupported,
|
|
763
830
|
videoWidthMax,
|
|
764
831
|
videoWidthMin,
|
|
832
|
+
workflowMissing,
|
|
765
833
|
};
|
package/src/schema/check/game.js
CHANGED
|
@@ -6,19 +6,18 @@ const path = require("node:path");
|
|
|
6
6
|
|
|
7
7
|
// [import]
|
|
8
8
|
|
|
9
|
-
const fs = require("fs-extra");
|
|
10
|
-
|
|
11
|
-
// [import]
|
|
12
|
-
|
|
13
9
|
const docCheck = require("../../util/doc").check;
|
|
14
10
|
const imageCheck = require("../../util/image").check;
|
|
15
11
|
const videoCheck = require("../../util/video").check;
|
|
12
|
+
const workflow = require("./workflow");
|
|
16
13
|
|
|
17
14
|
// [use]
|
|
18
15
|
|
|
16
|
+
const exists = workflow.exists;
|
|
19
17
|
const isAbsolute = path.isAbsolute;
|
|
18
|
+
const isInside = workflow.isInside;
|
|
19
|
+
const isRelative = workflow.isRelative;
|
|
20
20
|
const join = path.join;
|
|
21
|
-
const pathExistsSync = fs.pathExistsSync; // eslint-disable-line no-sync
|
|
22
21
|
const relative = path.relative;
|
|
23
22
|
const resolve = path.resolve;
|
|
24
23
|
|
|
@@ -30,12 +29,6 @@ const doc = function (root, str, opts) {
|
|
|
30
29
|
|
|
31
30
|
// [function]
|
|
32
31
|
|
|
33
|
-
const exists = function (root, target) {
|
|
34
|
-
return pathExistsSync(join(root, target));
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// [function]
|
|
38
|
-
|
|
39
32
|
const image = function (root, target, opts) {
|
|
40
33
|
return imageCheck(join(root, target), opts);
|
|
41
34
|
};
|
|
@@ -51,20 +44,6 @@ const isIn = function (root, target, parent) {
|
|
|
51
44
|
|
|
52
45
|
// [function]
|
|
53
46
|
|
|
54
|
-
const isOut = function (root, target) {
|
|
55
|
-
const rootPath = resolve(root);
|
|
56
|
-
const targetPath = resolve(root, target);
|
|
57
|
-
return targetPath === rootPath || targetPath.startsWith(rootPath + path.sep);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// [function]
|
|
61
|
-
|
|
62
|
-
const isRelative = function (root, target) {
|
|
63
|
-
return !isAbsolute(target);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// [function]
|
|
67
|
-
|
|
68
47
|
const video = function (root, target, opts) {
|
|
69
48
|
return videoCheck(join(root, target), opts);
|
|
70
49
|
};
|
|
@@ -76,7 +55,7 @@ module.exports = {
|
|
|
76
55
|
exists,
|
|
77
56
|
image,
|
|
78
57
|
isIn,
|
|
79
|
-
|
|
58
|
+
isInside,
|
|
80
59
|
isRelative,
|
|
81
60
|
video,
|
|
82
61
|
};
|