arcadible 0.1.19 → 0.1.21
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 +8 -6
- package/bin/arc-default.js +16 -11
- package/bin/arc-deploy.js +29 -25
- package/bin/arc-init.js +13 -9
- package/bin/arc-inspect.js +31 -16
- package/bin/arc-login.js +18 -10
- package/bin/arc-logout.js +29 -7
- package/bin/arc-open.js +114 -0
- package/bin/arc-pack.js +8 -6
- package/bin/arc-play.js +68 -18
- package/bin/arc-validate.js +10 -9
- package/bin/arc-whoami.js +14 -12
- package/bin/arc.js +7 -5
- package/package.json +3 -4
- package/product.json +9 -0
- package/src/account.js +14 -12
- package/src/action/deploy/tool-git.js +3 -3
- package/src/action/deploy/tool.js +6 -6
- package/src/action/init/manifest.js +3 -1
- package/src/action/inspect/media.js +6 -1
- package/src/action/inspect/tool.js +25 -9
- package/src/action/open/tool.js +24 -0
- package/src/action/pack/tool.js +10 -4
- package/src/action/play/tool.js +23 -26
- package/src/action/predeploy/ac.js +47 -12
- package/src/action/predeploy/git.js +3 -1
- package/src/action/predeploy/pm.js +41 -0
- package/src/action/predeploy/tool-git.js +25 -5
- package/src/action/predeploy/tool.js +14 -7
- package/src/api.js +16 -3
- package/src/cli/deploy.js +2 -2
- package/src/cli/index.js +2 -2
- package/src/cli/inspect.js +2 -2
- package/src/cli/{count.js → open.js} +2 -2
- package/src/cli/play.js +2 -2
- package/src/cli/predeploy.js +2 -2
- package/src/config/package.js +5 -0
- package/src/config/product.js +5 -0
- package/src/config/uri.js +13 -5
- package/src/config/url.js +3 -2
- package/src/config/workflow.js +9 -1
- package/src/parser/manifest.js +3 -1
- package/src/parser/media.js +3 -1
- package/src/parser/readme.js +6 -4
- package/src/phrase.js +73 -9
- package/src/prompt/template.js +14 -9
- package/src/schema/game.js +5 -2
- package/src/schema/workflow.js +5 -2
- package/src/util/http.js +3 -2
- package/src/util/output.js +2 -2
- package/src/util/rc.js +1 -1
- package/src/util/request.js +8 -6
- package/src/util/shell.js +52 -0
- package/src/util/video.js +6 -6
- package/bin/arc-count.js +0 -115
- package/bin/arc-predeploy.js +0 -2
- package/src/action/count/tool.js +0 -45
package/bin/arc-open.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// [import]
|
|
5
|
+
|
|
6
|
+
const path = require("node:path");
|
|
7
|
+
|
|
8
|
+
// [import]
|
|
9
|
+
|
|
10
|
+
const hideBin = require("yargs/helpers").hideBin;
|
|
11
|
+
const yargs = require("yargs/yargs");
|
|
12
|
+
|
|
13
|
+
// [import]
|
|
14
|
+
|
|
15
|
+
const cfgpackage = require("../src/config/package");
|
|
16
|
+
const cfgproduct = require("../src/config/product");
|
|
17
|
+
const cfguri = require("../src/config/uri");
|
|
18
|
+
const log = require("../src/util/log");
|
|
19
|
+
const open = require("../src/cli/open");
|
|
20
|
+
const phrase = require("../src/phrase");
|
|
21
|
+
const rc = require("../src/util/rc");
|
|
22
|
+
const shell = require("../src/util/shell");
|
|
23
|
+
|
|
24
|
+
// [use]
|
|
25
|
+
|
|
26
|
+
const findRc = rc.findRc;
|
|
27
|
+
const launch = shell.launch;
|
|
28
|
+
const resolve = path.resolve;
|
|
29
|
+
|
|
30
|
+
// [declare]
|
|
31
|
+
|
|
32
|
+
const COMMAND = "open";
|
|
33
|
+
const TOOL = cfgproduct.tool;
|
|
34
|
+
const VERSION = cfgpackage.version;
|
|
35
|
+
|
|
36
|
+
// [define]
|
|
37
|
+
|
|
38
|
+
const conf = {
|
|
39
|
+
browser: false,
|
|
40
|
+
game: "self",
|
|
41
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// [function]
|
|
45
|
+
|
|
46
|
+
const start = function (argv) {
|
|
47
|
+
return open({
|
|
48
|
+
game: argv.game,
|
|
49
|
+
root: resolve(process.cwd(), argv.cwd),
|
|
50
|
+
})
|
|
51
|
+
.then((data) => {
|
|
52
|
+
const page = data?.page;
|
|
53
|
+
if (!page) {
|
|
54
|
+
throw new Error(phrase.noGameId());
|
|
55
|
+
}
|
|
56
|
+
if (argv.browser) {
|
|
57
|
+
launch(`${cfguri.HOST_HTTP_WWW}${page}`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
launch(
|
|
61
|
+
`${cfguri.HOST_APP_STORE}${page}`,
|
|
62
|
+
`${cfguri.HOST_HTTP_WWW}${page}`,
|
|
63
|
+
);
|
|
64
|
+
})
|
|
65
|
+
.catch((ex) => {
|
|
66
|
+
log.hd("Open aborted.");
|
|
67
|
+
log.p(ex.message);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// [function]
|
|
73
|
+
|
|
74
|
+
const main = function (argv) {
|
|
75
|
+
return start(
|
|
76
|
+
yargs(hideBin(argv))
|
|
77
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
78
|
+
.usage("$0 [game] [options]")
|
|
79
|
+
.command("$0 [game]", false, (cli) =>
|
|
80
|
+
cli.positional("game", {
|
|
81
|
+
default: conf.game,
|
|
82
|
+
describe: "Game handle or ID",
|
|
83
|
+
type: "string",
|
|
84
|
+
}),
|
|
85
|
+
)
|
|
86
|
+
.option("browser", {
|
|
87
|
+
default: conf.browser,
|
|
88
|
+
describe: "Open in a web browser",
|
|
89
|
+
type: "boolean",
|
|
90
|
+
})
|
|
91
|
+
.option("cwd", {
|
|
92
|
+
alias: "C",
|
|
93
|
+
default: ".",
|
|
94
|
+
describe: "Set the working directory",
|
|
95
|
+
type: "string",
|
|
96
|
+
})
|
|
97
|
+
.help("help")
|
|
98
|
+
.alias("help", "h")
|
|
99
|
+
.version(VERSION)
|
|
100
|
+
.alias("version", "v")
|
|
101
|
+
.strict()
|
|
102
|
+
.parse(),
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// [main]
|
|
107
|
+
|
|
108
|
+
if (require.main === module) {
|
|
109
|
+
main(process.argv);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// [export]
|
|
113
|
+
|
|
114
|
+
module.exports = { main };
|
package/bin/arc-pack.js
CHANGED
|
@@ -12,11 +12,12 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const cfgpackage = require("../src/config/package");
|
|
16
|
+
const cfgproduct = require("../src/config/product");
|
|
15
17
|
const log = require("../src/util/log");
|
|
16
18
|
const output = require("../src/util/output");
|
|
17
19
|
const pack = require("../src/cli/pack");
|
|
18
20
|
const phrase = require("../src/phrase");
|
|
19
|
-
const pkg = require("../package.json");
|
|
20
21
|
const rc = require("../src/util/rc");
|
|
21
22
|
const spinner = require("../src/util/spinner");
|
|
22
23
|
const validate = require("../src/cli/validate");
|
|
@@ -30,8 +31,9 @@ const SpinnerWheel = spinner.SpinnerWheel;
|
|
|
30
31
|
|
|
31
32
|
// [declare]
|
|
32
33
|
|
|
33
|
-
const
|
|
34
|
-
const
|
|
34
|
+
const COMMAND = "pack";
|
|
35
|
+
const TOOL = cfgproduct.tool;
|
|
36
|
+
const VERSION = cfgpackage.version;
|
|
35
37
|
|
|
36
38
|
// [define]
|
|
37
39
|
|
|
@@ -40,7 +42,7 @@ const conf = {
|
|
|
40
42
|
json: false,
|
|
41
43
|
output: null,
|
|
42
44
|
quiet: false,
|
|
43
|
-
...findRc(
|
|
45
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
// [function]
|
|
@@ -94,7 +96,7 @@ const start = function (argv) {
|
|
|
94
96
|
const main = function (argv) {
|
|
95
97
|
return start(
|
|
96
98
|
yargs(hideBin(argv))
|
|
97
|
-
.scriptName(`${
|
|
99
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
98
100
|
.usage("$0 [options]")
|
|
99
101
|
.option("input", {
|
|
100
102
|
alias: "i",
|
|
@@ -128,7 +130,7 @@ const main = function (argv) {
|
|
|
128
130
|
})
|
|
129
131
|
.help("help")
|
|
130
132
|
.alias("help", "h")
|
|
131
|
-
.version(
|
|
133
|
+
.version(VERSION)
|
|
132
134
|
.alias("version", "v")
|
|
133
135
|
.strict()
|
|
134
136
|
.parse(),
|
package/bin/arc-play.js
CHANGED
|
@@ -12,41 +12,78 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const cfgpackage = require("../src/config/package");
|
|
16
|
+
const cfgproduct = require("../src/config/product");
|
|
17
|
+
const cfguri = require("../src/config/uri");
|
|
15
18
|
const log = require("../src/util/log");
|
|
16
|
-
const
|
|
19
|
+
const phrase = require("../src/phrase");
|
|
17
20
|
const play = require("../src/cli/play");
|
|
18
21
|
const rc = require("../src/util/rc");
|
|
22
|
+
const shell = require("../src/util/shell");
|
|
23
|
+
const spinner = require("../src/util/spinner");
|
|
19
24
|
|
|
20
25
|
// [use]
|
|
21
26
|
|
|
22
27
|
const findRc = rc.findRc;
|
|
28
|
+
const launch = shell.launch;
|
|
23
29
|
const resolve = path.resolve;
|
|
30
|
+
const SpinnerWheel = spinner.SpinnerWheel;
|
|
24
31
|
|
|
25
32
|
// [declare]
|
|
26
33
|
|
|
27
|
-
const
|
|
28
|
-
const
|
|
34
|
+
const COMMAND = "play";
|
|
35
|
+
const TOOL = cfgproduct.tool;
|
|
36
|
+
const VERSION = cfgpackage.version;
|
|
29
37
|
|
|
30
38
|
// [define]
|
|
31
39
|
|
|
32
40
|
const conf = {
|
|
33
|
-
browser:
|
|
41
|
+
browser: false,
|
|
34
42
|
game: "self",
|
|
35
|
-
|
|
43
|
+
quiet: false,
|
|
44
|
+
release: "production",
|
|
45
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// [function]
|
|
49
|
+
|
|
50
|
+
const handler = function ({ quiet, sw }) {
|
|
51
|
+
return {
|
|
52
|
+
onPlayFetch() {
|
|
53
|
+
sw.start(quiet);
|
|
54
|
+
},
|
|
55
|
+
};
|
|
36
56
|
};
|
|
37
57
|
|
|
38
58
|
// [function]
|
|
39
59
|
|
|
40
60
|
const start = function (argv) {
|
|
61
|
+
const sw = new SpinnerWheel("Opening... %s");
|
|
41
62
|
return play({
|
|
42
|
-
browser: argv.browser,
|
|
43
63
|
game: argv.game,
|
|
64
|
+
handler: handler({ quiet: argv.quiet, sw }),
|
|
65
|
+
release: argv.release,
|
|
44
66
|
root: resolve(process.cwd(), argv.cwd),
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
67
|
+
})
|
|
68
|
+
.then((data) => {
|
|
69
|
+
const orientation = data?.orientation;
|
|
70
|
+
const url = data?.url;
|
|
71
|
+
if (!orientation || !url) {
|
|
72
|
+
throw new Error(phrase.noGameId());
|
|
73
|
+
}
|
|
74
|
+
sw.stop(true);
|
|
75
|
+
if (argv.browser) {
|
|
76
|
+
launch(url);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
launch(`${cfguri.HOST_APP_PLAY}/${orientation}/${url}`, url);
|
|
80
|
+
})
|
|
81
|
+
.catch((ex) => {
|
|
82
|
+
sw.stop(true);
|
|
83
|
+
log.hd("Play aborted.");
|
|
84
|
+
log.p(ex.message);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
});
|
|
50
87
|
};
|
|
51
88
|
|
|
52
89
|
// [function]
|
|
@@ -54,12 +91,19 @@ const start = function (argv) {
|
|
|
54
91
|
const main = function (argv) {
|
|
55
92
|
return start(
|
|
56
93
|
yargs(hideBin(argv))
|
|
57
|
-
.scriptName(`${
|
|
58
|
-
.usage("$0 [options]")
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
94
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
95
|
+
.usage("$0 [game] [options]")
|
|
96
|
+
.command("$0 [game]", false, (cli) =>
|
|
97
|
+
cli.positional("game", {
|
|
98
|
+
default: conf.game,
|
|
99
|
+
describe: "Game handle or ID",
|
|
100
|
+
type: "string",
|
|
101
|
+
}),
|
|
102
|
+
)
|
|
103
|
+
.option("release", {
|
|
104
|
+
alias: "r",
|
|
105
|
+
default: conf.release,
|
|
106
|
+
describe: "Release channel or version",
|
|
63
107
|
type: "string",
|
|
64
108
|
})
|
|
65
109
|
.option("browser", {
|
|
@@ -67,6 +111,12 @@ const main = function (argv) {
|
|
|
67
111
|
describe: "Open in a web browser",
|
|
68
112
|
type: "boolean",
|
|
69
113
|
})
|
|
114
|
+
.option("quiet", {
|
|
115
|
+
alias: "q",
|
|
116
|
+
default: conf.quiet,
|
|
117
|
+
describe: "Output only errors",
|
|
118
|
+
type: "boolean",
|
|
119
|
+
})
|
|
70
120
|
.option("cwd", {
|
|
71
121
|
alias: "C",
|
|
72
122
|
default: ".",
|
|
@@ -75,7 +125,7 @@ const main = function (argv) {
|
|
|
75
125
|
})
|
|
76
126
|
.help("help")
|
|
77
127
|
.alias("help", "h")
|
|
78
|
-
.version(
|
|
128
|
+
.version(VERSION)
|
|
79
129
|
.alias("version", "v")
|
|
80
130
|
.strict()
|
|
81
131
|
.parse(),
|
package/bin/arc-validate.js
CHANGED
|
@@ -12,9 +12,10 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const cfgpackage = require("../src/config/package");
|
|
16
|
+
const cfgproduct = require("../src/config/product");
|
|
15
17
|
const log = require("../src/util/log");
|
|
16
18
|
const output = require("../src/util/output");
|
|
17
|
-
const pkg = require("../package.json");
|
|
18
19
|
const rc = require("../src/util/rc");
|
|
19
20
|
const validate = require("../src/cli/validate");
|
|
20
21
|
|
|
@@ -26,22 +27,22 @@ const resolve = path.resolve;
|
|
|
26
27
|
|
|
27
28
|
// [declare]
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
-
const
|
|
30
|
+
const COMMAND = "validate";
|
|
31
|
+
const TOOL = cfgproduct.tool;
|
|
32
|
+
const VERSION = cfgpackage.version;
|
|
31
33
|
|
|
32
34
|
// [define]
|
|
33
35
|
|
|
34
36
|
const conf = {
|
|
35
37
|
json: false,
|
|
36
38
|
quiet: false,
|
|
37
|
-
...findRc(
|
|
39
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
// [function]
|
|
41
43
|
|
|
42
44
|
const start = function (argv) {
|
|
43
45
|
const json = argv.json;
|
|
44
|
-
const quiet = argv.quiet;
|
|
45
46
|
return validate({ root: resolve(process.cwd(), argv.cwd) })
|
|
46
47
|
.then((issues) => {
|
|
47
48
|
const count = issues.length;
|
|
@@ -49,8 +50,8 @@ const start = function (argv) {
|
|
|
49
50
|
print({ issues });
|
|
50
51
|
} else if (count) {
|
|
51
52
|
log.hd(`${count} ${count === 1 ? "issue" : "issues"} found.`);
|
|
52
|
-
log.p(issues.map((
|
|
53
|
-
} else if (!quiet) {
|
|
53
|
+
log.p(issues.map((issue) => `✗ ${issue}`));
|
|
54
|
+
} else if (!argv.quiet) {
|
|
54
55
|
log.hs("No issues found.");
|
|
55
56
|
}
|
|
56
57
|
process.exit(count ? 1 : 0);
|
|
@@ -72,7 +73,7 @@ const start = function (argv) {
|
|
|
72
73
|
const main = function (argv) {
|
|
73
74
|
return start(
|
|
74
75
|
yargs(hideBin(argv))
|
|
75
|
-
.scriptName(`${
|
|
76
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
76
77
|
.usage("$0 [options]")
|
|
77
78
|
.option("json", {
|
|
78
79
|
alias: "j",
|
|
@@ -94,7 +95,7 @@ const main = function (argv) {
|
|
|
94
95
|
})
|
|
95
96
|
.help("help")
|
|
96
97
|
.alias("help", "h")
|
|
97
|
-
.version(
|
|
98
|
+
.version(VERSION)
|
|
98
99
|
.alias("version", "v")
|
|
99
100
|
.strict()
|
|
100
101
|
.parse(),
|
package/bin/arc-whoami.js
CHANGED
|
@@ -8,9 +8,10 @@ const yargs = require("yargs/yargs");
|
|
|
8
8
|
|
|
9
9
|
// [import]
|
|
10
10
|
|
|
11
|
+
const cfgpackage = require("../src/config/package");
|
|
12
|
+
const cfgproduct = require("../src/config/product");
|
|
11
13
|
const log = require("../src/util/log");
|
|
12
14
|
const output = require("../src/util/output");
|
|
13
|
-
const pkg = require("../package.json");
|
|
14
15
|
const rc = require("../src/util/rc");
|
|
15
16
|
const spinner = require("../src/util/spinner");
|
|
16
17
|
const whoami = require("../src/cli/whoami");
|
|
@@ -23,14 +24,15 @@ const SpinnerWheel = spinner.SpinnerWheel;
|
|
|
23
24
|
|
|
24
25
|
// [declare]
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
-
const
|
|
27
|
+
const COMMAND = "whoami";
|
|
28
|
+
const TOOL = cfgproduct.tool;
|
|
29
|
+
const VERSION = cfgpackage.version;
|
|
28
30
|
|
|
29
31
|
// [define]
|
|
30
32
|
|
|
31
33
|
const conf = {
|
|
32
34
|
json: false,
|
|
33
|
-
...findRc(
|
|
35
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
// [function]
|
|
@@ -48,13 +50,13 @@ const handler = function ({ json, sw }) {
|
|
|
48
50
|
|
|
49
51
|
const start = function (argv) {
|
|
50
52
|
const json = argv.json;
|
|
51
|
-
const sw = new SpinnerWheel("Checking
|
|
53
|
+
const sw = new SpinnerWheel("Checking... %s");
|
|
52
54
|
return whoami({ handler: handler({ json, sw }) })
|
|
53
55
|
.then((current) => {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
+
const user = current?.user;
|
|
57
|
+
if (!user) {
|
|
56
58
|
if (json) {
|
|
57
|
-
print({
|
|
59
|
+
print({ user: null });
|
|
58
60
|
} else {
|
|
59
61
|
sw.stop(true);
|
|
60
62
|
log.p("Not logged in.");
|
|
@@ -62,10 +64,10 @@ const start = function (argv) {
|
|
|
62
64
|
return;
|
|
63
65
|
}
|
|
64
66
|
if (json) {
|
|
65
|
-
print({
|
|
67
|
+
print({ user });
|
|
66
68
|
} else {
|
|
67
69
|
sw.stop(true);
|
|
68
|
-
log.p(
|
|
70
|
+
log.p(user.display_name);
|
|
69
71
|
}
|
|
70
72
|
})
|
|
71
73
|
.catch((ex) => {
|
|
@@ -86,7 +88,7 @@ const start = function (argv) {
|
|
|
86
88
|
const main = function (argv) {
|
|
87
89
|
return start(
|
|
88
90
|
yargs(hideBin(argv))
|
|
89
|
-
.scriptName(`${
|
|
91
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
90
92
|
.usage("$0 [options]")
|
|
91
93
|
.option("json", {
|
|
92
94
|
alias: "j",
|
|
@@ -96,7 +98,7 @@ const main = function (argv) {
|
|
|
96
98
|
})
|
|
97
99
|
.help("help")
|
|
98
100
|
.alias("help", "h")
|
|
99
|
-
.version(
|
|
101
|
+
.version(VERSION)
|
|
100
102
|
.alias("version", "v")
|
|
101
103
|
.strict()
|
|
102
104
|
.parse(),
|
package/bin/arc.js
CHANGED
|
@@ -7,8 +7,9 @@ const fs = require("fs-extra");
|
|
|
7
7
|
|
|
8
8
|
// [import]
|
|
9
9
|
|
|
10
|
+
const cfgpackage = require("../src/config/package");
|
|
11
|
+
const cfgproduct = require("../src/config/product");
|
|
10
12
|
const log = require("../src/util/log");
|
|
11
|
-
const pkg = require("../package.json");
|
|
12
13
|
|
|
13
14
|
// [use]
|
|
14
15
|
|
|
@@ -16,15 +17,16 @@ const pathExists = fs.pathExists;
|
|
|
16
17
|
|
|
17
18
|
// [declare]
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
+
const BIN = cfgpackage.bin;
|
|
21
|
+
const TOOL = cfgproduct.tool;
|
|
20
22
|
|
|
21
23
|
// [function]
|
|
22
24
|
|
|
23
25
|
const dispatch = function (argv) {
|
|
24
26
|
const args = [...argv];
|
|
25
|
-
const subcmds = Object.keys(
|
|
26
|
-
.filter((key) => key !==
|
|
27
|
-
.map((key) => key.slice(
|
|
27
|
+
const subcmds = Object.keys(BIN)
|
|
28
|
+
.filter((key) => key !== TOOL)
|
|
29
|
+
.map((key) => key.slice(TOOL.length + 1));
|
|
28
30
|
if (!subcmds.includes(args[2])) {
|
|
29
31
|
args.splice(2, 0, "default");
|
|
30
32
|
}
|
package/package.json
CHANGED
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
"bin": {
|
|
3
3
|
"arc": "bin/arc.js",
|
|
4
4
|
"arc-build": "bin/arc-build.js",
|
|
5
|
-
"arc-count": "bin/arc-count.js",
|
|
6
5
|
"arc-deploy": "bin/arc-deploy.js",
|
|
7
6
|
"arc-init": "bin/arc-init.js",
|
|
8
7
|
"arc-inspect": "bin/arc-inspect.js",
|
|
9
8
|
"arc-login": "bin/arc-login.js",
|
|
10
9
|
"arc-logout": "bin/arc-logout.js",
|
|
10
|
+
"arc-open": "bin/arc-open.js",
|
|
11
11
|
"arc-pack": "bin/arc-pack.js",
|
|
12
12
|
"arc-play": "bin/arc-play.js",
|
|
13
|
-
"arc-predeploy": "bin/arc-predeploy.js",
|
|
14
13
|
"arc-validate": "bin/arc-validate.js",
|
|
15
14
|
"arc-whoami": "bin/arc-whoami.js"
|
|
16
15
|
},
|
|
@@ -43,12 +42,12 @@
|
|
|
43
42
|
},
|
|
44
43
|
"exports": {
|
|
45
44
|
"./build": "./src/cli/build.js",
|
|
46
|
-
"./count": "./src/cli/count.js",
|
|
47
45
|
"./deploy": "./src/cli/deploy.js",
|
|
48
46
|
"./init": "./src/cli/init.js",
|
|
49
47
|
"./inspect": "./src/cli/inspect.js",
|
|
50
48
|
"./login": "./src/cli/login.js",
|
|
51
49
|
"./logout": "./src/cli/logout.js",
|
|
50
|
+
"./open": "./src/cli/open.js",
|
|
52
51
|
"./pack": "./src/cli/pack.js",
|
|
53
52
|
"./play": "./src/cli/play.js",
|
|
54
53
|
"./predeploy": "./src/cli/predeploy.js",
|
|
@@ -62,5 +61,5 @@
|
|
|
62
61
|
"license": "Apache-2.0",
|
|
63
62
|
"main": "./src/cli/index.js",
|
|
64
63
|
"name": "arcadible",
|
|
65
|
-
"version": "0.1.
|
|
64
|
+
"version": "0.1.21"
|
|
66
65
|
}
|
package/product.json
ADDED
package/src/account.js
CHANGED
|
@@ -11,6 +11,7 @@ const fs = require("fs-extra");
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
13
|
const api = require("./api");
|
|
14
|
+
const cfgproduct = require("./config/product");
|
|
14
15
|
const objs = require("./util/objs");
|
|
15
16
|
const os = require("./util/os");
|
|
16
17
|
|
|
@@ -26,12 +27,12 @@ const writeFile = fs.promises.writeFile;
|
|
|
26
27
|
|
|
27
28
|
// [declare]
|
|
28
29
|
|
|
29
|
-
const CMD = "arc";
|
|
30
30
|
const FILE = "account.json";
|
|
31
|
+
const TOOL = cfgproduct.tool;
|
|
31
32
|
|
|
32
33
|
// [define]
|
|
33
34
|
|
|
34
|
-
const dir = join(configDir(),
|
|
35
|
+
const dir = join(configDir(), TOOL);
|
|
35
36
|
const file = join(dir, FILE);
|
|
36
37
|
|
|
37
38
|
// [function]
|
|
@@ -42,22 +43,22 @@ const expired = function (session) {
|
|
|
42
43
|
|
|
43
44
|
// [function]
|
|
44
45
|
|
|
45
|
-
const save = function (
|
|
46
|
+
const save = function (current) {
|
|
46
47
|
return mkdir(dir, { recursive: true })
|
|
47
48
|
.then(() =>
|
|
48
|
-
writeFile(file, JSON.stringify(deepSort(
|
|
49
|
+
writeFile(file, JSON.stringify(deepSort(current), null, 2), "utf8"),
|
|
49
50
|
)
|
|
50
|
-
.then(() =>
|
|
51
|
+
.then(() => current);
|
|
51
52
|
};
|
|
52
53
|
|
|
53
54
|
// [function]
|
|
54
55
|
|
|
55
|
-
const refresh = function ({ session, ...
|
|
56
|
+
const refresh = function ({ session, ...current }) {
|
|
56
57
|
const form = new FormData();
|
|
57
58
|
form.append("refresh_token", session.refresh_token);
|
|
58
59
|
return api
|
|
59
60
|
.postAuthRefresh(form)
|
|
60
|
-
.then((data) => save({ ...
|
|
61
|
+
.then((data) => save({ ...current, session: data }));
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
// [function]
|
|
@@ -71,15 +72,16 @@ const get = function (onRefresh) {
|
|
|
71
72
|
}
|
|
72
73
|
throw ex;
|
|
73
74
|
})
|
|
74
|
-
.then((
|
|
75
|
-
|
|
75
|
+
.then((current) => {
|
|
76
|
+
const session = current?.session;
|
|
77
|
+
if (!session) {
|
|
76
78
|
return null;
|
|
77
79
|
}
|
|
78
|
-
return expired(
|
|
80
|
+
return expired(session)
|
|
79
81
|
? (onRefresh &&
|
|
80
|
-
onRefresh((renew) => (renew ? refresh(
|
|
82
|
+
onRefresh((renew) => (renew ? refresh(current) : null))) ||
|
|
81
83
|
null
|
|
82
|
-
:
|
|
84
|
+
: current;
|
|
83
85
|
});
|
|
84
86
|
};
|
|
85
87
|
|
|
@@ -23,15 +23,15 @@ const deployRelease = function (version, { root }, handler, cb) {
|
|
|
23
23
|
|
|
24
24
|
// [function]
|
|
25
25
|
|
|
26
|
-
const deploy = function ({ version },
|
|
27
|
-
deployRelease(version,
|
|
26
|
+
const deploy = function ({ version }, conf, handler, cb) {
|
|
27
|
+
deployRelease(version, conf, handler, cb);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// [function]
|
|
31
31
|
|
|
32
32
|
const main = function ({ root }, { onDeployBegin, ...handler }) {
|
|
33
33
|
if (onDeployBegin) {
|
|
34
|
-
onDeployBegin(
|
|
34
|
+
onDeployBegin();
|
|
35
35
|
}
|
|
36
36
|
return project(root).then(
|
|
37
37
|
({ game }) =>
|
|
@@ -12,13 +12,13 @@ const release = ac.release;
|
|
|
12
12
|
// [function]
|
|
13
13
|
|
|
14
14
|
const deployRelease = function (
|
|
15
|
-
|
|
15
|
+
current,
|
|
16
16
|
artifact,
|
|
17
17
|
game,
|
|
18
18
|
{ onUploadProgress },
|
|
19
19
|
cb,
|
|
20
20
|
) {
|
|
21
|
-
release(
|
|
21
|
+
release(current, artifact, game, onUploadProgress, (err) => {
|
|
22
22
|
if (err) {
|
|
23
23
|
cb(err);
|
|
24
24
|
return;
|
|
@@ -29,14 +29,14 @@ const deployRelease = function (
|
|
|
29
29
|
|
|
30
30
|
// [function]
|
|
31
31
|
|
|
32
|
-
const deploy = function (
|
|
33
|
-
deployRelease(
|
|
32
|
+
const deploy = function (current, artifact, game, handler, cb) {
|
|
33
|
+
deployRelease(current, artifact, game, handler, cb);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// [function]
|
|
37
37
|
|
|
38
38
|
const main = function (
|
|
39
|
-
|
|
39
|
+
current,
|
|
40
40
|
artifact,
|
|
41
41
|
{ root },
|
|
42
42
|
{ onDeployBegin, ...handler },
|
|
@@ -47,7 +47,7 @@ const main = function (
|
|
|
47
47
|
return project(root).then(
|
|
48
48
|
({ game }) =>
|
|
49
49
|
new Promise((resolve, reject) => {
|
|
50
|
-
deploy(
|
|
50
|
+
deploy(current, artifact, game, handler, (err, data) => {
|
|
51
51
|
if (err) {
|
|
52
52
|
reject(err);
|
|
53
53
|
return;
|
|
@@ -11,6 +11,7 @@ const fs = require("fs-extra");
|
|
|
11
11
|
|
|
12
12
|
// [import]
|
|
13
13
|
|
|
14
|
+
const cfgproduct = require("../../config/product");
|
|
14
15
|
const phrase = require("../../phrase");
|
|
15
16
|
const TOML = require("../../util/toml");
|
|
16
17
|
|
|
@@ -24,7 +25,8 @@ const writeFile = fs.promises.writeFile;
|
|
|
24
25
|
|
|
25
26
|
// [declare]
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
+
const HANDLE = cfgproduct.handle;
|
|
29
|
+
const MANIFEST = `${HANDLE}.toml`;
|
|
28
30
|
|
|
29
31
|
// [function]
|
|
30
32
|
|