arcadible 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/arc-build.js +9 -17
- package/bin/arc-deploy.js +20 -36
- package/bin/arc-init.js +6 -16
- package/bin/arc-inspect.js +3 -7
- package/bin/arc-login.js +5 -5
- package/bin/arc-logout.js +4 -8
- package/bin/arc-open.js +7 -20
- package/bin/arc-pack.js +4 -14
- package/bin/arc-play.js +6 -20
- package/bin/arc-validate.js +8 -17
- package/bin/arc-whoami.js +5 -9
- package/bin/arc.js +7 -2
- package/package.json +1 -1
- package/src/account.js +5 -5
- package/src/action/build/tool.js +8 -15
- package/src/action/deploy/tool-git.js +1 -6
- package/src/action/deploy/wait.js +5 -11
- package/src/action/init/manifest.js +9 -37
- package/src/action/login/flow.js +3 -10
- package/src/action/open/tool.js +4 -3
- package/src/action/pack/limits.js +4 -6
- package/src/action/pack/tool.js +9 -5
- package/src/action/play/tool.js +6 -6
- package/src/action/predeploy/ac.js +34 -31
- package/src/action/predeploy/git.js +4 -4
- package/src/action/predeploy/pm.js +1 -1
- package/src/action/predeploy/published.js +4 -4
- package/src/action/predeploy/tool-git.js +10 -10
- package/src/action/validate/unknown.js +11 -10
- package/src/config/code.js +1 -1
- package/src/config/file.js +23 -0
- package/src/config/limit.js +21 -0
- package/src/parser/env.js +0 -2
- package/src/parser/manifest.js +15 -13
- package/src/parser/media.js +9 -11
- package/src/parser/project.js +31 -9
- package/src/parser/self.js +27 -0
- package/src/phrase.js +175 -43
- package/src/schema/game.js +65 -42
- package/src/schema/workflow.js +7 -8
- package/src/util/argv.js +27 -1
- package/src/util/command.js +18 -0
- package/src/util/delay.js +5 -21
- package/src/util/doc.js +4 -13
- package/src/util/links.js +17 -2
- package/src/util/media.js +2 -2
- package/src/util/objs.js +8 -1
- package/src/util/output.js +24 -2
- package/src/util/rc.js +2 -2
- package/src/util/request.js +1 -1
- package/src/util/s3.js +1 -1
- package/src/util/schema.js +9 -3
- package/src/util/uris.js +1 -1
- package/src/util/zip.js +2 -2
- package/src/config/doc.js +0 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// [import]
|
|
4
|
+
|
|
5
|
+
const cfgproduct = require("./product");
|
|
6
|
+
|
|
7
|
+
// [declare]
|
|
8
|
+
|
|
9
|
+
const HANDLE = cfgproduct.handle;
|
|
10
|
+
const MEDIA = `.${HANDLE}`;
|
|
11
|
+
|
|
12
|
+
// [export]
|
|
13
|
+
|
|
14
|
+
// the project's files Arcadible reads, relative to its root, and the
|
|
15
|
+
// manifest arc pack writes into the zip.
|
|
16
|
+
module.exports = {
|
|
17
|
+
GALLERY: `${MEDIA}/gallery`,
|
|
18
|
+
MANIFEST: `${HANDLE}.toml`,
|
|
19
|
+
MEDIA,
|
|
20
|
+
PACKAGED: `${HANDLE}.json`,
|
|
21
|
+
// the release workflow, which builds a `git` release on GitHub Actions.
|
|
22
|
+
WORKFLOW: `.github/workflows/${HANDLE}-release.yml`,
|
|
23
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// [declare]
|
|
4
|
+
|
|
5
|
+
const MB = 1024 * 1024;
|
|
6
|
+
|
|
7
|
+
// [export]
|
|
8
|
+
|
|
9
|
+
// the limits on a packed game, as Arcadible enforces them when it publishes
|
|
10
|
+
// a release (docs: limits.md). arc pack checks them so a build that would
|
|
11
|
+
// fail there fails before it's uploaded.
|
|
12
|
+
module.exports = {
|
|
13
|
+
// the most files in the zip.
|
|
14
|
+
FILES: 10000,
|
|
15
|
+
// the largest file, uncompressed.
|
|
16
|
+
FILE_SIZE: 64 * MB,
|
|
17
|
+
// everything packed, uncompressed.
|
|
18
|
+
TOTAL_SIZE: 256 * MB,
|
|
19
|
+
// the zip of deploy_dir alone, compressed.
|
|
20
|
+
ZIP_SIZE: 64 * MB,
|
|
21
|
+
};
|
package/src/parser/env.js
CHANGED
|
@@ -58,10 +58,8 @@ const parseJson = function (buf) {
|
|
|
58
58
|
// (node_modules/.bin), and its prebuild and postbuild run, as they do
|
|
59
59
|
// locally. npm runs the scripts of a pnpm or Yarn project too.
|
|
60
60
|
const extract = function (conf) {
|
|
61
|
-
/* eslint-disable camelcase */
|
|
62
61
|
const game = { version: conf.version };
|
|
63
62
|
const workflow = conf.scripts?.build ? { build: NPM_RUN_BUILD } : {};
|
|
64
|
-
/* eslint-enable camelcase */
|
|
65
63
|
return deepCompact({ game, workflow }) ?? {};
|
|
66
64
|
};
|
|
67
65
|
|
package/src/parser/manifest.js
CHANGED
|
@@ -11,22 +11,23 @@ const fs = require("fs-extra");
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
13
|
const cfgcode = require("../config/code");
|
|
14
|
-
const
|
|
14
|
+
const cfgfile = require("../config/file");
|
|
15
15
|
const error = require("../util/error");
|
|
16
|
+
const objs = require("../util/objs");
|
|
16
17
|
const phrase = require("../phrase");
|
|
17
18
|
const TOML = require("../util/toml");
|
|
18
19
|
|
|
19
20
|
// [use]
|
|
20
21
|
|
|
21
22
|
const ArcError = error.ArcError;
|
|
23
|
+
const isTable = objs.isTable;
|
|
22
24
|
const join = path.join;
|
|
23
25
|
const pathExists = fs.pathExists;
|
|
24
26
|
const readFile = fs.readFile;
|
|
25
27
|
|
|
26
28
|
// [declare]
|
|
27
29
|
|
|
28
|
-
const
|
|
29
|
-
const MANIFEST = `${HANDLE}.toml`;
|
|
30
|
+
const MANIFEST = cfgfile.MANIFEST;
|
|
30
31
|
|
|
31
32
|
// [function]
|
|
32
33
|
|
|
@@ -45,12 +46,7 @@ const parseToml = function (buf) {
|
|
|
45
46
|
// [function]
|
|
46
47
|
|
|
47
48
|
const isEmptyTable = function (value) {
|
|
48
|
-
return (
|
|
49
|
-
value !== null &&
|
|
50
|
-
typeof value === "object" &&
|
|
51
|
-
!Array.isArray(value) &&
|
|
52
|
-
!Object.keys(value).length
|
|
53
|
-
);
|
|
49
|
+
return isTable(value) && !Object.keys(value).length;
|
|
54
50
|
};
|
|
55
51
|
|
|
56
52
|
// [function]
|
|
@@ -65,14 +61,20 @@ const extract = function (conf) {
|
|
|
65
61
|
|
|
66
62
|
// [function]
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
// arcadible.toml as written, or {} without it.
|
|
65
|
+
const read = function (root) {
|
|
69
66
|
const file = join(root, MANIFEST);
|
|
70
67
|
return pathExists(file)
|
|
71
68
|
.then((exists) => (exists ? readFile(file, "utf8") : null))
|
|
72
|
-
.then((buf) => (buf === null ? {} : parseToml(buf)))
|
|
73
|
-
|
|
69
|
+
.then((buf) => (buf === null ? {} : parseToml(buf)));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// [function]
|
|
73
|
+
|
|
74
|
+
const main = function (root) {
|
|
75
|
+
return read(root).then(extract);
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
// [export]
|
|
77
79
|
|
|
78
|
-
module.exports = main;
|
|
80
|
+
module.exports = Object.assign(main, { read });
|
package/src/parser/media.js
CHANGED
|
@@ -11,8 +11,8 @@ const fs = require("fs-extra");
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
13
|
const cfgart = require("../config/art");
|
|
14
|
+
const cfgfile = require("../config/file");
|
|
14
15
|
const cfgimage = require("../config/image");
|
|
15
|
-
const cfgproduct = require("../config/product");
|
|
16
16
|
const cfgvideo = require("../config/video");
|
|
17
17
|
const objs = require("../util/objs");
|
|
18
18
|
|
|
@@ -22,17 +22,15 @@ const deepCompact = objs.deepCompact;
|
|
|
22
22
|
const extname = path.extname;
|
|
23
23
|
const join = path.join;
|
|
24
24
|
const parse = path.parse;
|
|
25
|
+
// the manifest's paths use `/` on every platform, as Arcadible's do.
|
|
26
|
+
const posixJoin = path.posix.join;
|
|
25
27
|
const pathExists = fs.pathExists;
|
|
26
28
|
const readdir = fs.promises.readdir;
|
|
27
29
|
|
|
28
30
|
// [declare]
|
|
29
31
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
// [declare]
|
|
33
|
-
|
|
34
|
-
const HANDLE = cfgproduct.handle;
|
|
35
|
-
const MEDIA = `.${HANDLE}`;
|
|
32
|
+
const GALLERY = cfgfile.GALLERY;
|
|
33
|
+
const MEDIA = cfgfile.MEDIA;
|
|
36
34
|
|
|
37
35
|
// [function]
|
|
38
36
|
|
|
@@ -50,9 +48,9 @@ const art = function (root) {
|
|
|
50
48
|
list(join(root, MEDIA)).then((names) => ({
|
|
51
49
|
...game,
|
|
52
50
|
...Object.fromEntries(
|
|
53
|
-
|
|
51
|
+
cfgart.map((f) => [
|
|
54
52
|
parse(f).name,
|
|
55
|
-
names.includes(f) ?
|
|
53
|
+
names.includes(f) ? posixJoin(MEDIA, f) : null,
|
|
56
54
|
]),
|
|
57
55
|
),
|
|
58
56
|
}));
|
|
@@ -64,7 +62,7 @@ const handleGallery = function (entries) {
|
|
|
64
62
|
const exts = [...Object.keys(cfgimage), ...Object.keys(cfgvideo)];
|
|
65
63
|
return entries
|
|
66
64
|
.filter((f) => exts.includes(extname(f)))
|
|
67
|
-
.map((f) =>
|
|
65
|
+
.map((f) => posixJoin(GALLERY, f))
|
|
68
66
|
.sort();
|
|
69
67
|
};
|
|
70
68
|
|
|
@@ -72,7 +70,7 @@ const handleGallery = function (entries) {
|
|
|
72
70
|
|
|
73
71
|
const gallery = function (root) {
|
|
74
72
|
return (game) =>
|
|
75
|
-
list(join(root,
|
|
73
|
+
list(join(root, GALLERY))
|
|
76
74
|
.then(handleGallery)
|
|
77
75
|
.then((data) => ({ ...game, gallery: data }));
|
|
78
76
|
};
|
package/src/parser/project.js
CHANGED
|
@@ -11,15 +11,17 @@ const fs = require("fs-extra");
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
13
|
const cfgcode = require("../config/code");
|
|
14
|
-
const
|
|
14
|
+
const cfgfile = require("../config/file");
|
|
15
15
|
const cfgworkflow = require("../config/workflow");
|
|
16
16
|
const env = require("./env");
|
|
17
17
|
const error = require("../util/error");
|
|
18
|
+
const gameSchema = require("../schema/game");
|
|
18
19
|
const manifest = require("./manifest");
|
|
19
20
|
const media = require("./media");
|
|
20
21
|
const phrase = require("../phrase");
|
|
21
22
|
const promise = require("../util/promise");
|
|
22
23
|
const readme = require("./readme");
|
|
24
|
+
const workflowSchema = require("../schema/workflow");
|
|
23
25
|
|
|
24
26
|
// [use]
|
|
25
27
|
|
|
@@ -33,7 +35,7 @@ const sep = path.sep;
|
|
|
33
35
|
|
|
34
36
|
// [declare]
|
|
35
37
|
|
|
36
|
-
const MANIFEST =
|
|
38
|
+
const MANIFEST = cfgfile.MANIFEST;
|
|
37
39
|
|
|
38
40
|
// [function]
|
|
39
41
|
|
|
@@ -48,6 +50,18 @@ const configGame = function (readmeGame, mediaGame, envGame, manifestGame) {
|
|
|
48
50
|
|
|
49
51
|
// [function]
|
|
50
52
|
|
|
53
|
+
// the fields of `values` that `schema` knows. Arcadible ignores the rest, so
|
|
54
|
+
// they're left out of what's packed and inspected; arc validate warns about
|
|
55
|
+
// each (action/validate/unknown.js).
|
|
56
|
+
const known = function (values, schema, root) {
|
|
57
|
+
const fields = Object.keys(schema({}, { root }).shape);
|
|
58
|
+
return Object.fromEntries(
|
|
59
|
+
Object.entries(values).filter(([field]) => fields.includes(field)),
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// [function]
|
|
64
|
+
|
|
51
65
|
const configWorkflow = function (envWorkflow, manifestWorkflow) {
|
|
52
66
|
return {
|
|
53
67
|
...cfgworkflow,
|
|
@@ -95,7 +109,7 @@ const ensureManifest = function (root) {
|
|
|
95
109
|
if (found !== false) {
|
|
96
110
|
throw new ArcError(
|
|
97
111
|
cfgcode.MANIFEST_MISSING,
|
|
98
|
-
phrase.
|
|
112
|
+
phrase.manifestMissing(MANIFEST, shown(root), found && shown(found)),
|
|
99
113
|
);
|
|
100
114
|
}
|
|
101
115
|
});
|
|
@@ -113,13 +127,21 @@ const parseSources = function (root, manifestData) {
|
|
|
113
127
|
() => env(root),
|
|
114
128
|
];
|
|
115
129
|
return promise.serial(parsers).then(([readmeData, mediaData, envData]) => ({
|
|
116
|
-
game:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
130
|
+
game: known(
|
|
131
|
+
configGame(
|
|
132
|
+
readmeData.game,
|
|
133
|
+
mediaData.game,
|
|
134
|
+
envData.game,
|
|
135
|
+
manifestData.game,
|
|
136
|
+
),
|
|
137
|
+
gameSchema,
|
|
138
|
+
root,
|
|
139
|
+
),
|
|
140
|
+
workflow: known(
|
|
141
|
+
configWorkflow(envData.workflow, manifestData.workflow),
|
|
142
|
+
workflowSchema,
|
|
143
|
+
root,
|
|
121
144
|
),
|
|
122
|
-
workflow: configWorkflow(envData.workflow, manifestData.workflow),
|
|
123
145
|
}));
|
|
124
146
|
};
|
|
125
147
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// [import]
|
|
4
|
+
|
|
5
|
+
const cfgcode = require("../config/code");
|
|
6
|
+
const project = require("./project");
|
|
7
|
+
|
|
8
|
+
// [function]
|
|
9
|
+
|
|
10
|
+
// the game of the project at `root`, for `arc play` and `arc open` with no
|
|
11
|
+
// game named; null outside a project, so they ask for a game
|
|
12
|
+
// (game_id_missing) rather than for a project.
|
|
13
|
+
const main = function (root) {
|
|
14
|
+
return project(root).then(
|
|
15
|
+
({ game }) => game,
|
|
16
|
+
(ex) => {
|
|
17
|
+
if (ex.code === cfgcode.MANIFEST_MISSING) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
throw ex;
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// [export]
|
|
26
|
+
|
|
27
|
+
module.exports = main;
|