arcadible 0.1.20 → 0.1.22

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.
Files changed (44) hide show
  1. package/bin/arc-build.js +8 -6
  2. package/bin/arc-default.js +10 -7
  3. package/bin/arc-deploy.js +17 -16
  4. package/bin/arc-init.js +12 -7
  5. package/bin/arc-inspect.js +8 -6
  6. package/bin/arc-login.js +15 -8
  7. package/bin/arc-logout.js +8 -6
  8. package/bin/arc-open.js +14 -9
  9. package/bin/arc-pack.js +10 -9
  10. package/bin/arc-play.js +13 -9
  11. package/bin/arc-validate.js +9 -7
  12. package/bin/arc-whoami.js +13 -11
  13. package/bin/arc.js +7 -5
  14. package/package.json +1 -1
  15. package/product.json +9 -0
  16. package/src/account.js +8 -7
  17. package/src/action/deploy/tool-git.js +3 -3
  18. package/src/action/deploy/tool.js +6 -6
  19. package/src/action/init/manifest.js +3 -1
  20. package/src/action/inspect/media.js +6 -1
  21. package/src/action/pack/tool.js +12 -5
  22. package/src/action/predeploy/ac.js +47 -12
  23. package/src/action/predeploy/git.js +3 -1
  24. package/src/action/predeploy/pm.js +41 -0
  25. package/src/action/predeploy/tool-git.js +25 -5
  26. package/src/action/predeploy/tool.js +14 -7
  27. package/src/api.js +9 -3
  28. package/src/cli/deploy.js +2 -2
  29. package/src/cli/predeploy.js +2 -2
  30. package/src/config/package.js +5 -0
  31. package/src/config/product.js +5 -0
  32. package/src/config/uri.js +11 -7
  33. package/src/config/url.js +6 -1
  34. package/src/config/workflow.js +9 -1
  35. package/src/parser/manifest.js +3 -1
  36. package/src/parser/media.js +3 -1
  37. package/src/parser/readme.js +3 -1
  38. package/src/phrase.js +66 -9
  39. package/src/prompt/template.js +12 -13
  40. package/src/schema/game.js +5 -2
  41. package/src/schema/workflow.js +5 -2
  42. package/src/util/request.js +7 -5
  43. package/src/util/shell.js +39 -2
  44. package/src/util/video.js +5 -5
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 CMD = "arc";
34
- const SUBCMD = "build";
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(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
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(`${CMD} ${SUBCMD}`)
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(pkg.version)
119
+ .version(VERSION)
118
120
  .alias("version", "v")
119
121
  .strict()
120
122
  .parse(),
@@ -8,11 +8,14 @@ const yargs = require("yargs/yargs");
8
8
 
9
9
  // [import]
10
10
 
11
- const pkg = require("../package.json");
11
+ const cfgpackage = require("../src/config/package");
12
+ const cfgproduct = require("../src/config/product");
12
13
 
13
14
  // [declare]
14
15
 
15
- const CMD = "arc";
16
+ const TITLE = cfgproduct.title;
17
+ const TOOL = cfgproduct.tool;
18
+ const VERSION = cfgpackage.version;
16
19
 
17
20
  // [function]
18
21
 
@@ -28,7 +31,7 @@ const parse = function (cli) {
28
31
  const main = function (argv) {
29
32
  return parse(
30
33
  yargs(hideBin(argv))
31
- .scriptName(CMD)
34
+ .scriptName(TOOL)
32
35
  .usage("$0 <command> [options]")
33
36
  .command("init", "Initialize project")
34
37
  .command("inspect", "Inspect project")
@@ -38,12 +41,12 @@ const main = function (argv) {
38
41
  .command("deploy", "Deploy project")
39
42
  .command("open", "Open a game's store page")
40
43
  .command("play", "Play a game")
41
- .command("login", "Log in to Arcadible")
42
- .command("whoami", "Show Arcadible account")
43
- .command("logout", "Log out of Arcadible")
44
+ .command("login", `Log in to ${TITLE}`)
45
+ .command("whoami", `Show ${TITLE} account`)
46
+ .command("logout", `Log out of ${TITLE}`)
44
47
  .help("help")
45
48
  .alias("help", "h")
46
- .version(pkg.version)
49
+ .version(VERSION)
47
50
  .alias("version", "v")
48
51
  .strict(),
49
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,8 +37,9 @@ const SpinnerWheel = spinner.SpinnerWheel;
36
37
 
37
38
  // [declare]
38
39
 
39
- const CMD = "arc";
40
- const SUBCMD = "deploy";
40
+ const COMMAND = "deploy";
41
+ const TOOL = cfgproduct.tool;
42
+ const VERSION = cfgpackage.version;
41
43
 
42
44
  // [define]
43
45
 
@@ -45,7 +47,7 @@ const conf = {
45
47
  json: false,
46
48
  method: "direct",
47
49
  quiet: false,
48
- ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
50
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
49
51
  };
50
52
 
51
53
  // [function]
@@ -114,57 +116,56 @@ const start = function (argv) {
114
116
  return whoami({ handler: handler({ json, pb, quiet, sw }) });
115
117
  })
116
118
  .then((current) => {
117
- const session = current?.session;
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
- session,
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(([session]) => {
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
- session,
142
+ current,
142
143
  // build
143
144
  git ? null : build({ root }),
144
145
  ]);
145
146
  })
146
- .then(([session, artifact]) => {
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
- session,
153
+ current,
153
154
  // pack
154
155
  git ? null : pack({ input: artifact?.path, root }),
155
156
  ]);
156
157
  })
157
- .then(([session, artifact]) => {
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,7 +211,7 @@ const start = function (argv) {
210
211
  const main = function (argv) {
211
212
  return start(
212
213
  yargs(hideBin(argv))
213
- .scriptName(`${CMD} ${SUBCMD}`)
214
+ .scriptName(`${TOOL} ${COMMAND}`)
214
215
  .usage("$0 [method] [options]")
215
216
  .command("$0 [method]", false, (cli) =>
216
217
  cli.positional("method", {
@@ -240,7 +241,7 @@ const main = function (argv) {
240
241
  })
241
242
  .help("help")
242
243
  .alias("help", "h")
243
- .version(pkg.version)
244
+ .version(VERSION)
244
245
  .alias("version", "v")
245
246
  .strict()
246
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 CMD = "arc";
38
- const SUBCMD = "init";
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(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
49
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
48
50
  };
49
51
 
50
52
  // [function]
@@ -138,7 +140,7 @@ const prompt = async function ({ yes, ...argv }) {
138
140
  const main = function (argv) {
139
141
  return prompt(
140
142
  yargs(hideBin(argv))
141
- .scriptName(`${CMD} ${SUBCMD}`)
143
+ .scriptName(`${TOOL} ${COMMAND}`)
142
144
  .usage("$0 [project] [options]")
143
145
  .command("$0 [project]", false, (cli) =>
144
146
  cli.positional("project", {
@@ -149,7 +151,10 @@ const main = function (argv) {
149
151
  )
150
152
  .option("template", {
151
153
  alias: "t",
152
- describe: "Project template",
154
+ describe: [
155
+ "Project template",
156
+ "Public GitHub repository (format: user/repo).",
157
+ ].join("\n"),
153
158
  type: "string",
154
159
  })
155
160
  .option("yes", {
@@ -178,7 +183,7 @@ const main = function (argv) {
178
183
  })
179
184
  .help("help")
180
185
  .alias("help", "h")
181
- .version(pkg.version)
186
+ .version(VERSION)
182
187
  .alias("version", "v")
183
188
  .strict()
184
189
  .parse(),
@@ -12,10 +12,11 @@ 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");
20
21
  const spinner = require("../src/util/spinner");
21
22
 
@@ -28,15 +29,16 @@ const SpinnerWheel = spinner.SpinnerWheel;
28
29
 
29
30
  // [declare]
30
31
 
31
- const CMD = "arc";
32
- const SUBCMD = "inspect";
32
+ const COMMAND = "inspect";
33
+ const TOOL = cfgproduct.tool;
34
+ const VERSION = cfgpackage.version;
33
35
 
34
36
  // [define]
35
37
 
36
38
  const conf = {
37
39
  json: false,
38
40
  selector: null,
39
- ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
41
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
40
42
  };
41
43
 
42
44
  // [function]
@@ -87,7 +89,7 @@ const start = function (argv) {
87
89
  const main = function (argv) {
88
90
  return start(
89
91
  yargs(hideBin(argv))
90
- .scriptName(`${CMD} ${SUBCMD}`)
92
+ .scriptName(`${TOOL} ${COMMAND}`)
91
93
  .usage("$0 [selector] [options]")
92
94
  .command("$0 [selector]", false, (cli) =>
93
95
  cli.positional("selector", {
@@ -110,7 +112,7 @@ const main = function (argv) {
110
112
  })
111
113
  .help("help")
112
114
  .alias("help", "h")
113
- .version(pkg.version)
115
+ .version(VERSION)
114
116
  .alias("version", "v")
115
117
  .strict()
116
118
  .parse(),
package/bin/arc-login.js CHANGED
@@ -9,9 +9,11 @@ const yargs = require("yargs/yargs");
9
9
 
10
10
  // [import]
11
11
 
12
+ const cfgpackage = require("../src/config/package");
13
+ const cfgproduct = require("../src/config/product");
12
14
  const log = require("../src/util/log");
13
15
  const login = require("../src/cli/login");
14
- const pkg = require("../package.json");
16
+ const phrase = require("../src/phrase");
15
17
  const rc = require("../src/util/rc");
16
18
  const shell = require("../src/util/shell");
17
19
  const spinner = require("../src/util/spinner");
@@ -24,15 +26,16 @@ const SpinnerWheel = spinner.SpinnerWheel;
24
26
 
25
27
  // [declare]
26
28
 
27
- const CMD = "arc";
28
- const SUBCMD = "login";
29
+ const COMMAND = "login";
30
+ const TOOL = cfgproduct.tool;
31
+ const VERSION = cfgpackage.version;
29
32
 
30
33
  // [define]
31
34
 
32
35
  const conf = {
33
36
  browser: true,
34
37
  qrcode: true,
35
- ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
38
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
36
39
  };
37
40
 
38
41
  // [function]
@@ -95,11 +98,15 @@ const start = function (argv) {
95
98
  return login({
96
99
  handler: handler({ browser: argv.browser, qrcode: argv.qrcode, sw }),
97
100
  })
98
- .then(({ profile }) => {
101
+ .then((current) => {
102
+ const user = current?.user;
103
+ if (!user) {
104
+ throw new Error(phrase.notLoggedIn());
105
+ }
99
106
  sw.stop(true);
100
107
  process.stdin.pause();
101
108
  log.nlhs("Logged in.");
102
- log.p(profile.display_name);
109
+ log.p(user.display_name);
103
110
  })
104
111
  .catch((ex) => {
105
112
  sw.stop(true);
@@ -115,7 +122,7 @@ const start = function (argv) {
115
122
  const main = function (argv) {
116
123
  return start(
117
124
  yargs(hideBin(argv))
118
- .scriptName(`${CMD} ${SUBCMD}`)
125
+ .scriptName(`${TOOL} ${COMMAND}`)
119
126
  .usage("$0 [options]")
120
127
  .option("browser", {
121
128
  default: conf.browser,
@@ -129,7 +136,7 @@ const main = function (argv) {
129
136
  })
130
137
  .help("help")
131
138
  .alias("help", "h")
132
- .version(pkg.version)
139
+ .version(VERSION)
133
140
  .alias("version", "v")
134
141
  .strict()
135
142
  .parse(),
package/bin/arc-logout.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 logout = require("../src/cli/logout");
13
- const pkg = require("../package.json");
14
15
  const rc = require("../src/util/rc");
15
16
 
16
17
  // [use]
@@ -19,14 +20,15 @@ const findRc = rc.findRc;
19
20
 
20
21
  // [declare]
21
22
 
22
- const CMD = "arc";
23
- const SUBCMD = "logout";
23
+ const COMMAND = "logout";
24
+ const TOOL = cfgproduct.tool;
25
+ const VERSION = cfgpackage.version;
24
26
 
25
27
  // [define]
26
28
 
27
29
  const conf = {
28
30
  quiet: false,
29
- ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
31
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
30
32
  };
31
33
 
32
34
  // [function]
@@ -50,7 +52,7 @@ const start = function (argv) {
50
52
  const main = function (argv) {
51
53
  return start(
52
54
  yargs(hideBin(argv))
53
- .scriptName(`${CMD} ${SUBCMD}`)
55
+ .scriptName(`${TOOL} ${COMMAND}`)
54
56
  .usage("$0 [options]")
55
57
  .option("quiet", {
56
58
  alias: "q",
@@ -60,7 +62,7 @@ const main = function (argv) {
60
62
  })
61
63
  .help("help")
62
64
  .alias("help", "h")
63
- .version(pkg.version)
65
+ .version(VERSION)
64
66
  .alias("version", "v")
65
67
  .strict()
66
68
  .parse(),
package/bin/arc-open.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 cfguri = require("../src/config/uri");
16
18
  const log = require("../src/util/log");
17
19
  const open = require("../src/cli/open");
18
20
  const phrase = require("../src/phrase");
19
- const pkg = require("../package.json");
20
21
  const rc = require("../src/util/rc");
21
22
  const shell = require("../src/util/shell");
22
23
 
@@ -28,15 +29,16 @@ const resolve = path.resolve;
28
29
 
29
30
  // [declare]
30
31
 
31
- const CMD = "arc";
32
- const SUBCMD = "open";
32
+ const COMMAND = "open";
33
+ const TOOL = cfgproduct.tool;
34
+ const VERSION = cfgpackage.version;
33
35
 
34
36
  // [define]
35
37
 
36
38
  const conf = {
37
39
  browser: false,
38
40
  game: "self",
39
- ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
41
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
40
42
  };
41
43
 
42
44
  // [function]
@@ -51,10 +53,13 @@ const start = function (argv) {
51
53
  if (!page) {
52
54
  throw new Error(phrase.noGameId());
53
55
  }
56
+ if (argv.browser) {
57
+ launch(`${cfguri.HOST_HTTP_WWW}${page}`);
58
+ return;
59
+ }
54
60
  launch(
55
- argv.browser
56
- ? `${cfguri.HOST_HTTP_WWW}${page}`
57
- : `${cfguri.HOST_APP_STORE}${page}`,
61
+ `${cfguri.HOST_APP_STORE}${page}`,
62
+ `${cfguri.HOST_HTTP_WWW}${page}`,
58
63
  );
59
64
  })
60
65
  .catch((ex) => {
@@ -69,7 +74,7 @@ const start = function (argv) {
69
74
  const main = function (argv) {
70
75
  return start(
71
76
  yargs(hideBin(argv))
72
- .scriptName(`${CMD} ${SUBCMD}`)
77
+ .scriptName(`${TOOL} ${COMMAND}`)
73
78
  .usage("$0 [game] [options]")
74
79
  .command("$0 [game]", false, (cli) =>
75
80
  cli.positional("game", {
@@ -91,7 +96,7 @@ const main = function (argv) {
91
96
  })
92
97
  .help("help")
93
98
  .alias("help", "h")
94
- .version(pkg.version)
99
+ .version(VERSION)
95
100
  .alias("version", "v")
96
101
  .strict()
97
102
  .parse(),
package/bin/arc-pack.js CHANGED
@@ -12,12 +12,12 @@ const yargs = require("yargs/yargs");
12
12
 
13
13
  // [import]
14
14
 
15
- const cfgworkflow = require("../src/config/workflow");
15
+ const cfgpackage = require("../src/config/package");
16
+ const cfgproduct = require("../src/config/product");
16
17
  const log = require("../src/util/log");
17
18
  const output = require("../src/util/output");
18
19
  const pack = require("../src/cli/pack");
19
20
  const phrase = require("../src/phrase");
20
- const pkg = require("../package.json");
21
21
  const rc = require("../src/util/rc");
22
22
  const spinner = require("../src/util/spinner");
23
23
  const validate = require("../src/cli/validate");
@@ -31,17 +31,18 @@ const SpinnerWheel = spinner.SpinnerWheel;
31
31
 
32
32
  // [declare]
33
33
 
34
- const CMD = "arc";
35
- const SUBCMD = "pack";
34
+ const COMMAND = "pack";
35
+ const TOOL = cfgproduct.tool;
36
+ const VERSION = cfgpackage.version;
36
37
 
37
38
  // [define]
38
39
 
39
40
  const conf = {
40
- input: cfgworkflow.deploy_dir,
41
+ input: null,
41
42
  json: false,
42
- output: ".arc/package/game.zip",
43
+ output: null,
43
44
  quiet: false,
44
- ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
45
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
45
46
  };
46
47
 
47
48
  // [function]
@@ -95,7 +96,7 @@ const start = function (argv) {
95
96
  const main = function (argv) {
96
97
  return start(
97
98
  yargs(hideBin(argv))
98
- .scriptName(`${CMD} ${SUBCMD}`)
99
+ .scriptName(`${TOOL} ${COMMAND}`)
99
100
  .usage("$0 [options]")
100
101
  .option("input", {
101
102
  alias: "i",
@@ -129,7 +130,7 @@ const main = function (argv) {
129
130
  })
130
131
  .help("help")
131
132
  .alias("help", "h")
132
- .version(pkg.version)
133
+ .version(VERSION)
133
134
  .alias("version", "v")
134
135
  .strict()
135
136
  .parse(),
package/bin/arc-play.js CHANGED
@@ -12,10 +12,11 @@ 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 cfguri = require("../src/config/uri");
16
18
  const log = require("../src/util/log");
17
19
  const phrase = require("../src/phrase");
18
- const pkg = require("../package.json");
19
20
  const play = require("../src/cli/play");
20
21
  const rc = require("../src/util/rc");
21
22
  const shell = require("../src/util/shell");
@@ -30,8 +31,9 @@ const SpinnerWheel = spinner.SpinnerWheel;
30
31
 
31
32
  // [declare]
32
33
 
33
- const CMD = "arc";
34
- const SUBCMD = "play";
34
+ const COMMAND = "play";
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
  game: "self",
41
43
  quiet: false,
42
44
  release: "production",
43
- ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
45
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
44
46
  };
45
47
 
46
48
  // [function]
@@ -70,9 +72,11 @@ const start = function (argv) {
70
72
  throw new Error(phrase.noGameId());
71
73
  }
72
74
  sw.stop(true);
73
- launch(
74
- argv.browser ? url : `${cfguri.HOST_APP_PLAY}/${orientation}/${url}`,
75
- );
75
+ if (argv.browser) {
76
+ launch(url);
77
+ return;
78
+ }
79
+ launch(`${cfguri.HOST_APP_PLAY}/${orientation}/${url}`, url);
76
80
  })
77
81
  .catch((ex) => {
78
82
  sw.stop(true);
@@ -87,7 +91,7 @@ const start = function (argv) {
87
91
  const main = function (argv) {
88
92
  return start(
89
93
  yargs(hideBin(argv))
90
- .scriptName(`${CMD} ${SUBCMD}`)
94
+ .scriptName(`${TOOL} ${COMMAND}`)
91
95
  .usage("$0 [game] [options]")
92
96
  .command("$0 [game]", false, (cli) =>
93
97
  cli.positional("game", {
@@ -121,7 +125,7 @@ const main = function (argv) {
121
125
  })
122
126
  .help("help")
123
127
  .alias("help", "h")
124
- .version(pkg.version)
128
+ .version(VERSION)
125
129
  .alias("version", "v")
126
130
  .strict()
127
131
  .parse(),