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-build.js
CHANGED
|
@@ -13,10 +13,11 @@ const yargs = require("yargs/yargs");
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
15
|
const build = require("../src/cli/build");
|
|
16
|
+
const cfgpackage = require("../src/config/package");
|
|
17
|
+
const cfgproduct = require("../src/config/product");
|
|
16
18
|
const log = require("../src/util/log");
|
|
17
19
|
const output = require("../src/util/output");
|
|
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,15 +31,16 @@ const SpinnerWheel = spinner.SpinnerWheel;
|
|
|
30
31
|
|
|
31
32
|
// [declare]
|
|
32
33
|
|
|
33
|
-
const
|
|
34
|
-
const
|
|
34
|
+
const COMMAND = "build";
|
|
35
|
+
const TOOL = cfgproduct.tool;
|
|
36
|
+
const VERSION = cfgpackage.version;
|
|
35
37
|
|
|
36
38
|
// [define]
|
|
37
39
|
|
|
38
40
|
const conf = {
|
|
39
41
|
json: false,
|
|
40
42
|
quiet: false,
|
|
41
|
-
...findRc(
|
|
43
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
// [function]
|
|
@@ -92,7 +94,7 @@ const start = function (argv) {
|
|
|
92
94
|
const main = function (argv) {
|
|
93
95
|
return start(
|
|
94
96
|
yargs(hideBin(argv))
|
|
95
|
-
.scriptName(`${
|
|
97
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
96
98
|
.usage("$0 [options]")
|
|
97
99
|
.option("json", {
|
|
98
100
|
alias: "j",
|
|
@@ -114,7 +116,7 @@ const main = function (argv) {
|
|
|
114
116
|
})
|
|
115
117
|
.help("help")
|
|
116
118
|
.alias("help", "h")
|
|
117
|
-
.version(
|
|
119
|
+
.version(VERSION)
|
|
118
120
|
.alias("version", "v")
|
|
119
121
|
.strict()
|
|
120
122
|
.parse(),
|
package/bin/arc-default.js
CHANGED
|
@@ -8,11 +8,14 @@ const yargs = require("yargs/yargs");
|
|
|
8
8
|
|
|
9
9
|
// [import]
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const cfgpackage = require("../src/config/package");
|
|
12
|
+
const cfgproduct = require("../src/config/product");
|
|
12
13
|
|
|
13
14
|
// [declare]
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
const TITLE = cfgproduct.title;
|
|
17
|
+
const TOOL = cfgproduct.tool;
|
|
18
|
+
const VERSION = cfgpackage.version;
|
|
16
19
|
|
|
17
20
|
// [function]
|
|
18
21
|
|
|
@@ -28,20 +31,22 @@ const parse = function (cli) {
|
|
|
28
31
|
const main = function (argv) {
|
|
29
32
|
return parse(
|
|
30
33
|
yargs(hideBin(argv))
|
|
31
|
-
.scriptName(
|
|
34
|
+
.scriptName(TOOL)
|
|
32
35
|
.usage("$0 <command> [options]")
|
|
33
|
-
.command("init", "Initialize
|
|
34
|
-
.command("validate", "Validate project workspace")
|
|
35
|
-
.command("deploy", "Deploy to Arcadible")
|
|
36
|
+
.command("init", "Initialize project")
|
|
36
37
|
.command("inspect", "Inspect project")
|
|
37
|
-
.command("
|
|
38
|
+
.command("validate", "Validate project")
|
|
39
|
+
.command("build", "Build project")
|
|
40
|
+
.command("pack", "Package project")
|
|
41
|
+
.command("deploy", "Deploy project")
|
|
42
|
+
.command("open", "Open a game's store page")
|
|
38
43
|
.command("play", "Play a game")
|
|
39
|
-
.command("login",
|
|
40
|
-
.command("
|
|
41
|
-
.command("
|
|
44
|
+
.command("login", `Log in to ${TITLE}`)
|
|
45
|
+
.command("whoami", `Show ${TITLE} account`)
|
|
46
|
+
.command("logout", `Log out of ${TITLE}`)
|
|
42
47
|
.help("help")
|
|
43
48
|
.alias("help", "h")
|
|
44
|
-
.version(
|
|
49
|
+
.version(VERSION)
|
|
45
50
|
.alias("version", "v")
|
|
46
51
|
.strict(),
|
|
47
52
|
);
|
package/bin/arc-deploy.js
CHANGED
|
@@ -13,12 +13,13 @@ const yargs = require("yargs/yargs");
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
15
|
const build = require("../src/cli/build");
|
|
16
|
+
const cfgpackage = require("../src/config/package");
|
|
17
|
+
const cfgproduct = require("../src/config/product");
|
|
16
18
|
const deploy = require("../src/cli/deploy");
|
|
17
19
|
const log = require("../src/util/log");
|
|
18
20
|
const output = require("../src/util/output");
|
|
19
21
|
const pack = require("../src/cli/pack");
|
|
20
22
|
const phrase = require("../src/phrase");
|
|
21
|
-
const pkg = require("../package.json");
|
|
22
23
|
const predeploy = require("../src/cli/predeploy");
|
|
23
24
|
const progress = require("../src/util/progress");
|
|
24
25
|
const rc = require("../src/util/rc");
|
|
@@ -36,16 +37,17 @@ const SpinnerWheel = spinner.SpinnerWheel;
|
|
|
36
37
|
|
|
37
38
|
// [declare]
|
|
38
39
|
|
|
39
|
-
const
|
|
40
|
-
const
|
|
40
|
+
const COMMAND = "deploy";
|
|
41
|
+
const TOOL = cfgproduct.tool;
|
|
42
|
+
const VERSION = cfgpackage.version;
|
|
41
43
|
|
|
42
44
|
// [define]
|
|
43
45
|
|
|
44
46
|
const conf = {
|
|
45
|
-
git: false,
|
|
46
47
|
json: false,
|
|
48
|
+
method: "direct",
|
|
47
49
|
quiet: false,
|
|
48
|
-
...findRc(
|
|
50
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
// [function]
|
|
@@ -97,7 +99,7 @@ const handler = function ({ json, pb, quiet, sw }) {
|
|
|
97
99
|
// [function]
|
|
98
100
|
|
|
99
101
|
const start = function (argv) {
|
|
100
|
-
const git = argv.git;
|
|
102
|
+
const git = argv.method === "git";
|
|
101
103
|
const json = argv.json;
|
|
102
104
|
const quiet = argv.quiet;
|
|
103
105
|
const root = resolve(process.cwd(), argv.cwd);
|
|
@@ -110,61 +112,60 @@ const start = function (argv) {
|
|
|
110
112
|
throw new Error(phrase.issuesFound(count));
|
|
111
113
|
}
|
|
112
114
|
sw.stop();
|
|
113
|
-
sw = new SpinnerWheel("Checking
|
|
115
|
+
sw = new SpinnerWheel("Checking... %s");
|
|
114
116
|
return whoami({ handler: handler({ json, pb, quiet, sw }) });
|
|
115
117
|
})
|
|
116
118
|
.then((current) => {
|
|
117
|
-
|
|
118
|
-
if (!session) {
|
|
119
|
+
if (!current) {
|
|
119
120
|
throw new Error(phrase.notLoggedIn());
|
|
120
121
|
}
|
|
121
122
|
sw.stop();
|
|
122
123
|
sw = new SpinnerWheel("Preparing... %s");
|
|
123
124
|
return Promise.all([
|
|
124
125
|
// whoami
|
|
125
|
-
|
|
126
|
+
current,
|
|
126
127
|
// predeploy
|
|
127
128
|
predeploy({
|
|
129
|
+
current,
|
|
128
130
|
git,
|
|
129
131
|
handler: handler({ json, pb, quiet, sw }),
|
|
130
132
|
root,
|
|
131
|
-
session,
|
|
132
133
|
}),
|
|
133
134
|
]);
|
|
134
135
|
})
|
|
135
|
-
.then(([
|
|
136
|
+
.then(([current]) => {
|
|
136
137
|
sw.stop();
|
|
137
138
|
sw = new SpinnerWheel("Building... %s");
|
|
138
139
|
sw.start(git || json || quiet);
|
|
139
140
|
return Promise.all([
|
|
140
141
|
// whoami
|
|
141
|
-
|
|
142
|
+
current,
|
|
142
143
|
// build
|
|
143
144
|
git ? null : build({ root }),
|
|
144
145
|
]);
|
|
145
146
|
})
|
|
146
|
-
.then(([
|
|
147
|
+
.then(([current, artifact]) => {
|
|
147
148
|
sw.stop();
|
|
148
149
|
sw = new SpinnerWheel("Packing... %s");
|
|
149
150
|
sw.start(git || json || quiet);
|
|
150
151
|
return Promise.all([
|
|
151
152
|
// whoami
|
|
152
|
-
|
|
153
|
+
current,
|
|
153
154
|
// pack
|
|
154
155
|
git ? null : pack({ input: artifact?.path, root }),
|
|
155
156
|
]);
|
|
156
157
|
})
|
|
157
|
-
.then(([
|
|
158
|
+
.then(([current, artifact]) => {
|
|
158
159
|
sw.stop(true);
|
|
159
160
|
if (!json && !quiet && !git) {
|
|
160
161
|
pb = new ProgressBar(artifact.size);
|
|
161
162
|
}
|
|
162
163
|
return deploy({
|
|
163
164
|
artifact,
|
|
165
|
+
current,
|
|
164
166
|
git,
|
|
165
167
|
handler: handler({ json, pb, quiet, sw }),
|
|
166
168
|
root,
|
|
167
|
-
session,
|
|
168
169
|
});
|
|
169
170
|
})
|
|
170
171
|
.then((version) => {
|
|
@@ -210,13 +211,16 @@ const start = function (argv) {
|
|
|
210
211
|
const main = function (argv) {
|
|
211
212
|
return start(
|
|
212
213
|
yargs(hideBin(argv))
|
|
213
|
-
.scriptName(`${
|
|
214
|
-
.usage("$0 [options]")
|
|
215
|
-
.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
214
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
215
|
+
.usage("$0 [method] [options]")
|
|
216
|
+
.command("$0 [method]", false, (cli) =>
|
|
217
|
+
cli.positional("method", {
|
|
218
|
+
choices: ["direct", "git"],
|
|
219
|
+
default: conf.method,
|
|
220
|
+
describe: "Deploy method",
|
|
221
|
+
type: "string",
|
|
222
|
+
}),
|
|
223
|
+
)
|
|
220
224
|
.option("json", {
|
|
221
225
|
alias: "j",
|
|
222
226
|
default: conf.json,
|
|
@@ -237,7 +241,7 @@ const main = function (argv) {
|
|
|
237
241
|
})
|
|
238
242
|
.help("help")
|
|
239
243
|
.alias("help", "h")
|
|
240
|
-
.version(
|
|
244
|
+
.version(VERSION)
|
|
241
245
|
.alias("version", "v")
|
|
242
246
|
.strict()
|
|
243
247
|
.parse(),
|
package/bin/arc-init.js
CHANGED
|
@@ -14,10 +14,11 @@ const yargs = require("yargs/yargs");
|
|
|
14
14
|
|
|
15
15
|
// [import]
|
|
16
16
|
|
|
17
|
+
const cfgpackage = require("../src/config/package");
|
|
18
|
+
const cfgproduct = require("../src/config/product");
|
|
17
19
|
const init = require("../src/cli/init");
|
|
18
20
|
const log = require("../src/util/log");
|
|
19
21
|
const output = require("../src/util/output");
|
|
20
|
-
const pkg = require("../package.json");
|
|
21
22
|
const rc = require("../src/util/rc");
|
|
22
23
|
const spinner = require("../src/util/spinner");
|
|
23
24
|
const template = require("../src/prompt/template");
|
|
@@ -34,8 +35,9 @@ const SpinnerWheel = spinner.SpinnerWheel;
|
|
|
34
35
|
|
|
35
36
|
// [declare]
|
|
36
37
|
|
|
37
|
-
const
|
|
38
|
-
const
|
|
38
|
+
const COMMAND = "init";
|
|
39
|
+
const TOOL = cfgproduct.tool;
|
|
40
|
+
const VERSION = cfgpackage.version;
|
|
39
41
|
|
|
40
42
|
// [define]
|
|
41
43
|
|
|
@@ -44,7 +46,7 @@ const conf = {
|
|
|
44
46
|
project: ".",
|
|
45
47
|
quiet: false,
|
|
46
48
|
yes: false,
|
|
47
|
-
...findRc(
|
|
49
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
// [function]
|
|
@@ -73,14 +75,13 @@ const handler = function ({ json, quiet, sw }) {
|
|
|
73
75
|
const start = function (argv) {
|
|
74
76
|
const json = argv.json;
|
|
75
77
|
const quiet = argv.quiet;
|
|
76
|
-
const root = resolve(process.cwd(), argv.cwd);
|
|
77
78
|
const sw = new SpinnerWheel("Initializing... %s");
|
|
78
79
|
return init({
|
|
79
80
|
force: true,
|
|
80
81
|
handler: handler({ json, quiet, sw }),
|
|
81
82
|
patch: argv.patch,
|
|
82
83
|
project: argv.project,
|
|
83
|
-
root,
|
|
84
|
+
root: resolve(process.cwd(), argv.cwd),
|
|
84
85
|
template: argv.template,
|
|
85
86
|
})
|
|
86
87
|
.then((project) => {
|
|
@@ -139,7 +140,7 @@ const prompt = async function ({ yes, ...argv }) {
|
|
|
139
140
|
const main = function (argv) {
|
|
140
141
|
return prompt(
|
|
141
142
|
yargs(hideBin(argv))
|
|
142
|
-
.scriptName(`${
|
|
143
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
143
144
|
.usage("$0 [project] [options]")
|
|
144
145
|
.command("$0 [project]", false, (cli) =>
|
|
145
146
|
cli.positional("project", {
|
|
@@ -150,7 +151,10 @@ const main = function (argv) {
|
|
|
150
151
|
)
|
|
151
152
|
.option("template", {
|
|
152
153
|
alias: "t",
|
|
153
|
-
describe:
|
|
154
|
+
describe: [
|
|
155
|
+
"Project template",
|
|
156
|
+
"Public GitHub repository (format: user/repo).",
|
|
157
|
+
].join("\n"),
|
|
154
158
|
type: "string",
|
|
155
159
|
})
|
|
156
160
|
.option("yes", {
|
|
@@ -179,7 +183,7 @@ const main = function (argv) {
|
|
|
179
183
|
})
|
|
180
184
|
.help("help")
|
|
181
185
|
.alias("help", "h")
|
|
182
|
-
.version(
|
|
186
|
+
.version(VERSION)
|
|
183
187
|
.alias("version", "v")
|
|
184
188
|
.strict()
|
|
185
189
|
.parse(),
|
package/bin/arc-inspect.js
CHANGED
|
@@ -12,30 +12,43 @@ 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 inspect = require("../src/cli/inspect");
|
|
16
18
|
const log = require("../src/util/log");
|
|
17
19
|
const output = require("../src/util/output");
|
|
18
|
-
const pkg = require("../package.json");
|
|
19
20
|
const rc = require("../src/util/rc");
|
|
21
|
+
const spinner = require("../src/util/spinner");
|
|
20
22
|
|
|
21
23
|
// [use]
|
|
22
24
|
|
|
23
25
|
const findRc = rc.findRc;
|
|
24
26
|
const print = output.print;
|
|
25
27
|
const resolve = path.resolve;
|
|
28
|
+
const SpinnerWheel = spinner.SpinnerWheel;
|
|
26
29
|
|
|
27
30
|
// [declare]
|
|
28
31
|
|
|
29
|
-
const
|
|
30
|
-
const
|
|
32
|
+
const COMMAND = "inspect";
|
|
33
|
+
const TOOL = cfgproduct.tool;
|
|
34
|
+
const VERSION = cfgpackage.version;
|
|
31
35
|
|
|
32
36
|
// [define]
|
|
33
37
|
|
|
34
38
|
const conf = {
|
|
35
|
-
game: "self",
|
|
36
39
|
json: false,
|
|
37
|
-
selector:
|
|
38
|
-
...findRc(
|
|
40
|
+
selector: null,
|
|
41
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// [function]
|
|
45
|
+
|
|
46
|
+
const handler = function ({ json, sw }) {
|
|
47
|
+
return {
|
|
48
|
+
onInspectFetch() {
|
|
49
|
+
sw.start(json);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
39
52
|
};
|
|
40
53
|
|
|
41
54
|
// [function]
|
|
@@ -43,19 +56,27 @@ const conf = {
|
|
|
43
56
|
const start = function (argv) {
|
|
44
57
|
const json = argv.json;
|
|
45
58
|
const selector = argv.selector;
|
|
59
|
+
const sw = new SpinnerWheel("Loading... %s");
|
|
46
60
|
return inspect({
|
|
47
|
-
game:
|
|
61
|
+
game: null,
|
|
62
|
+
handler: handler({ json, sw }),
|
|
48
63
|
root: resolve(process.cwd(), argv.cwd),
|
|
49
64
|
selector,
|
|
50
65
|
})
|
|
51
66
|
.then((data) => {
|
|
52
|
-
|
|
67
|
+
if (json) {
|
|
68
|
+
print(data);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
sw.stop(true);
|
|
72
|
+
print(data, { key: selector, toml: true });
|
|
53
73
|
})
|
|
54
74
|
.catch((ex) => {
|
|
55
75
|
const message = ex.message;
|
|
56
76
|
if (json) {
|
|
57
77
|
print({ error: { message } });
|
|
58
78
|
} else {
|
|
79
|
+
sw.stop(true);
|
|
59
80
|
log.hd("Inspect aborted.");
|
|
60
81
|
log.p(message);
|
|
61
82
|
}
|
|
@@ -68,7 +89,7 @@ const start = function (argv) {
|
|
|
68
89
|
const main = function (argv) {
|
|
69
90
|
return start(
|
|
70
91
|
yargs(hideBin(argv))
|
|
71
|
-
.scriptName(`${
|
|
92
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
72
93
|
.usage("$0 [selector] [options]")
|
|
73
94
|
.command("$0 [selector]", false, (cli) =>
|
|
74
95
|
cli.positional("selector", {
|
|
@@ -77,12 +98,6 @@ const main = function (argv) {
|
|
|
77
98
|
type: "string",
|
|
78
99
|
}),
|
|
79
100
|
)
|
|
80
|
-
.option("game", {
|
|
81
|
-
alias: "g",
|
|
82
|
-
default: conf.game,
|
|
83
|
-
describe: "Game handle or ID",
|
|
84
|
-
type: "string",
|
|
85
|
-
})
|
|
86
101
|
.option("json", {
|
|
87
102
|
alias: "j",
|
|
88
103
|
default: conf.json,
|
|
@@ -97,7 +112,7 @@ const main = function (argv) {
|
|
|
97
112
|
})
|
|
98
113
|
.help("help")
|
|
99
114
|
.alias("help", "h")
|
|
100
|
-
.version(
|
|
115
|
+
.version(VERSION)
|
|
101
116
|
.alias("version", "v")
|
|
102
117
|
.strict()
|
|
103
118
|
.parse(),
|
package/bin/arc-login.js
CHANGED
|
@@ -4,34 +4,38 @@
|
|
|
4
4
|
// [import]
|
|
5
5
|
|
|
6
6
|
const hideBin = require("yargs/helpers").hideBin;
|
|
7
|
-
const open = require("open");
|
|
8
7
|
const qrcode = require("qrcode-terminal");
|
|
9
8
|
const yargs = require("yargs/yargs");
|
|
10
9
|
|
|
11
10
|
// [import]
|
|
12
11
|
|
|
12
|
+
const cfgpackage = require("../src/config/package");
|
|
13
|
+
const cfgproduct = require("../src/config/product");
|
|
13
14
|
const log = require("../src/util/log");
|
|
14
15
|
const login = require("../src/cli/login");
|
|
15
|
-
const
|
|
16
|
+
const phrase = require("../src/phrase");
|
|
16
17
|
const rc = require("../src/util/rc");
|
|
18
|
+
const shell = require("../src/util/shell");
|
|
17
19
|
const spinner = require("../src/util/spinner");
|
|
18
20
|
|
|
19
21
|
// [use]
|
|
20
22
|
|
|
21
23
|
const findRc = rc.findRc;
|
|
24
|
+
const launch = shell.launch;
|
|
22
25
|
const SpinnerWheel = spinner.SpinnerWheel;
|
|
23
26
|
|
|
24
27
|
// [declare]
|
|
25
28
|
|
|
26
|
-
const
|
|
27
|
-
const
|
|
29
|
+
const COMMAND = "login";
|
|
30
|
+
const TOOL = cfgproduct.tool;
|
|
31
|
+
const VERSION = cfgpackage.version;
|
|
28
32
|
|
|
29
33
|
// [define]
|
|
30
34
|
|
|
31
35
|
const conf = {
|
|
32
36
|
browser: true,
|
|
33
37
|
qrcode: true,
|
|
34
|
-
...findRc(
|
|
38
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
// [function]
|
|
@@ -77,7 +81,7 @@ const handler = function ({ browser, qrcode: qr, sw }) {
|
|
|
77
81
|
if (browser) {
|
|
78
82
|
log.nlp("Press Enter to open the URL.");
|
|
79
83
|
onLoginEnter(() => {
|
|
80
|
-
|
|
84
|
+
launch(link);
|
|
81
85
|
});
|
|
82
86
|
}
|
|
83
87
|
});
|
|
@@ -94,11 +98,15 @@ const start = function (argv) {
|
|
|
94
98
|
return login({
|
|
95
99
|
handler: handler({ browser: argv.browser, qrcode: argv.qrcode, sw }),
|
|
96
100
|
})
|
|
97
|
-
.then((
|
|
101
|
+
.then((current) => {
|
|
102
|
+
const user = current?.user;
|
|
103
|
+
if (!user) {
|
|
104
|
+
throw new Error(phrase.notLoggedIn());
|
|
105
|
+
}
|
|
98
106
|
sw.stop(true);
|
|
99
107
|
process.stdin.pause();
|
|
100
108
|
log.nlhs("Logged in.");
|
|
101
|
-
log.p(
|
|
109
|
+
log.p(user.display_name);
|
|
102
110
|
})
|
|
103
111
|
.catch((ex) => {
|
|
104
112
|
sw.stop(true);
|
|
@@ -114,7 +122,7 @@ const start = function (argv) {
|
|
|
114
122
|
const main = function (argv) {
|
|
115
123
|
return start(
|
|
116
124
|
yargs(hideBin(argv))
|
|
117
|
-
.scriptName(`${
|
|
125
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
118
126
|
.usage("$0 [options]")
|
|
119
127
|
.option("browser", {
|
|
120
128
|
default: conf.browser,
|
|
@@ -128,7 +136,7 @@ const main = function (argv) {
|
|
|
128
136
|
})
|
|
129
137
|
.help("help")
|
|
130
138
|
.alias("help", "h")
|
|
131
|
-
.version(
|
|
139
|
+
.version(VERSION)
|
|
132
140
|
.alias("version", "v")
|
|
133
141
|
.strict()
|
|
134
142
|
.parse(),
|
package/bin/arc-logout.js
CHANGED
|
@@ -8,21 +8,37 @@ 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 logout = require("../src/cli/logout");
|
|
13
|
-
const
|
|
15
|
+
const rc = require("../src/util/rc");
|
|
16
|
+
|
|
17
|
+
// [use]
|
|
18
|
+
|
|
19
|
+
const findRc = rc.findRc;
|
|
14
20
|
|
|
15
21
|
// [declare]
|
|
16
22
|
|
|
17
|
-
const
|
|
18
|
-
const
|
|
23
|
+
const COMMAND = "logout";
|
|
24
|
+
const TOOL = cfgproduct.tool;
|
|
25
|
+
const VERSION = cfgpackage.version;
|
|
26
|
+
|
|
27
|
+
// [define]
|
|
28
|
+
|
|
29
|
+
const conf = {
|
|
30
|
+
quiet: false,
|
|
31
|
+
...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
|
|
32
|
+
};
|
|
19
33
|
|
|
20
34
|
// [function]
|
|
21
35
|
|
|
22
|
-
const start = function () {
|
|
36
|
+
const start = function (argv) {
|
|
23
37
|
return logout()
|
|
24
38
|
.then(() => {
|
|
25
|
-
|
|
39
|
+
if (!argv.quiet) {
|
|
40
|
+
log.hs("Logged out.");
|
|
41
|
+
}
|
|
26
42
|
})
|
|
27
43
|
.catch((ex) => {
|
|
28
44
|
log.hd("Logout aborted.");
|
|
@@ -36,11 +52,17 @@ const start = function () {
|
|
|
36
52
|
const main = function (argv) {
|
|
37
53
|
return start(
|
|
38
54
|
yargs(hideBin(argv))
|
|
39
|
-
.scriptName(`${
|
|
55
|
+
.scriptName(`${TOOL} ${COMMAND}`)
|
|
40
56
|
.usage("$0 [options]")
|
|
57
|
+
.option("quiet", {
|
|
58
|
+
alias: "q",
|
|
59
|
+
default: conf.quiet,
|
|
60
|
+
describe: "Output only errors",
|
|
61
|
+
type: "boolean",
|
|
62
|
+
})
|
|
41
63
|
.help("help")
|
|
42
64
|
.alias("help", "h")
|
|
43
|
-
.version(
|
|
65
|
+
.version(VERSION)
|
|
44
66
|
.alias("version", "v")
|
|
45
67
|
.strict()
|
|
46
68
|
.parse(),
|