arcadible 0.1.20 → 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.
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 +10 -4
  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
@@ -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,15 +27,16 @@ const resolve = path.resolve;
26
27
 
27
28
  // [declare]
28
29
 
29
- const CMD = "arc";
30
- const SUBCMD = "validate";
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(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
39
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
38
40
  };
39
41
 
40
42
  // [function]
@@ -48,7 +50,7 @@ const start = function (argv) {
48
50
  print({ issues });
49
51
  } else if (count) {
50
52
  log.hd(`${count} ${count === 1 ? "issue" : "issues"} found.`);
51
- log.p(issues.map((error) => `✗ ${error}`));
53
+ log.p(issues.map((issue) => `✗ ${issue}`));
52
54
  } else if (!argv.quiet) {
53
55
  log.hs("No issues found.");
54
56
  }
@@ -71,7 +73,7 @@ const start = function (argv) {
71
73
  const main = function (argv) {
72
74
  return start(
73
75
  yargs(hideBin(argv))
74
- .scriptName(`${CMD} ${SUBCMD}`)
76
+ .scriptName(`${TOOL} ${COMMAND}`)
75
77
  .usage("$0 [options]")
76
78
  .option("json", {
77
79
  alias: "j",
@@ -93,7 +95,7 @@ const main = function (argv) {
93
95
  })
94
96
  .help("help")
95
97
  .alias("help", "h")
96
- .version(pkg.version)
98
+ .version(VERSION)
97
99
  .alias("version", "v")
98
100
  .strict()
99
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 CMD = "arc";
27
- const SUBCMD = "whoami";
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(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
35
+ ...findRc(TOOL, COMMAND, process.argv, ["--cwd", "-C"]),
34
36
  };
35
37
 
36
38
  // [function]
@@ -51,10 +53,10 @@ const start = function (argv) {
51
53
  const sw = new SpinnerWheel("Checking... %s");
52
54
  return whoami({ handler: handler({ json, sw }) })
53
55
  .then((current) => {
54
- const profile = current?.profile;
55
- if (!profile) {
56
+ const user = current?.user;
57
+ if (!user) {
56
58
  if (json) {
57
- print({ profile: null });
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({ profile });
67
+ print({ user });
66
68
  } else {
67
69
  sw.stop(true);
68
- log.p(profile.display_name);
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(`${CMD} ${SUBCMD}`)
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(pkg.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 CMD = "arc";
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(pkg.bin)
26
- .filter((key) => key !== CMD)
27
- .map((key) => key.slice(CMD.length + 1));
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
@@ -61,5 +61,5 @@
61
61
  "license": "Apache-2.0",
62
62
  "main": "./src/cli/index.js",
63
63
  "name": "arcadible",
64
- "version": "0.1.20"
64
+ "version": "0.1.21"
65
65
  }
package/product.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "client": "Arcadible",
3
+ "domain": "arcadible.com",
4
+ "handle": "arcadible",
5
+ "id": "com.offst.arcadible.cli",
6
+ "protocol": "arcadible",
7
+ "title": "Arcadible",
8
+ "tool": "arc"
9
+ }
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(), CMD);
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 (account) {
46
+ const save = function (current) {
46
47
  return mkdir(dir, { recursive: true })
47
48
  .then(() =>
48
- writeFile(file, JSON.stringify(deepSort(account), null, 2), "utf8"),
49
+ writeFile(file, JSON.stringify(deepSort(current), null, 2), "utf8"),
49
50
  )
50
- .then(() => account);
51
+ .then(() => current);
51
52
  };
52
53
 
53
54
  // [function]
54
55
 
55
- const refresh = function ({ session, ...account }) {
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({ ...account, session: data }));
61
+ .then((data) => save({ ...current, session: data }));
61
62
  };
62
63
 
63
64
  // [function]
@@ -23,15 +23,15 @@ const deployRelease = function (version, { root }, handler, cb) {
23
23
 
24
24
  // [function]
25
25
 
26
- const deploy = function ({ version }, { root }, handler, cb) {
27
- deployRelease(version, { root }, handler, cb);
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({ root });
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
- session,
15
+ current,
16
16
  artifact,
17
17
  game,
18
18
  { onUploadProgress },
19
19
  cb,
20
20
  ) {
21
- release(session, artifact, game, onUploadProgress, (err) => {
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 (session, artifact, game, handler, cb) {
33
- deployRelease(session, artifact, game, handler, cb);
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
- session,
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(session, artifact, game, handler, (err, data) => {
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 MANIFEST = "arcadible.toml";
28
+ const HANDLE = cfgproduct.handle;
29
+ const MANIFEST = `${HANDLE}.toml`;
28
30
 
29
31
  // [function]
30
32
 
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ // [import]
4
+
5
+ const cfgproduct = require("../../config/product");
6
+
3
7
  // [declare]
4
8
 
5
9
  const ART = [
@@ -17,7 +21,8 @@ const ART = [
17
21
 
18
22
  // [declare]
19
23
 
20
- const MEDIA = ".arcadible";
24
+ const HANDLE = cfgproduct.handle;
25
+ const MEDIA = `.${HANDLE}`;
21
26
 
22
27
  // [function]
23
28
 
@@ -10,6 +10,7 @@ const fs = require("fs-extra");
10
10
 
11
11
  // [import]
12
12
 
13
+ const cfgproduct = require("../../config/product");
13
14
  const phrase = require("../../phrase");
14
15
  const project = require("../../parser/project");
15
16
  const size = require("../../util/size");
@@ -23,10 +24,15 @@ const resolve = path.resolve;
23
24
 
24
25
  // [declare]
25
26
 
27
+ const HANDLE = cfgproduct.handle;
28
+ const TOOL = cfgproduct.tool;
29
+
30
+ // [declare]
31
+
26
32
  const MAIN = "index.html";
27
- const MANIFEST = "arcadible.json";
28
- const MEDIA = ".arcadible";
29
- const OUTPUT = ".arc/package";
33
+ const MANIFEST = `${HANDLE}.json`;
34
+ const MEDIA = `.${HANDLE}`;
35
+ const OUTPUT = `.${TOOL}/package`;
30
36
 
31
37
  // [declare]
32
38
 
@@ -65,7 +71,7 @@ const pack = function (name, game, { inputPath, mediaPath, outputPath }) {
65
71
  if (existsInput) {
66
72
  zip.addDir(inputPath);
67
73
  }
68
- return zip;
74
+ throw new Error(phrase.unableToFind(inputPath));
69
75
  })
70
76
  .then(verifyPartial)
71
77
  .then(() => pathExists(mediaPath))
@@ -9,7 +9,7 @@ const s3 = require("../../util/s3");
9
9
  // [function]
10
10
 
11
11
  const uploadBuild = function (
12
- session,
12
+ current,
13
13
  artifact,
14
14
  { id, version },
15
15
  onUploadProgress,
@@ -21,18 +21,24 @@ const uploadBuild = function (
21
21
  form.append("sha256", artifact.sha256);
22
22
  form.append("size", artifact.size);
23
23
  // api
24
- const token = session?.access_token;
25
- return api.postUpload(form, { token }).then((upload) => {
26
- s3.upload(upload.upload_url, artifact, onUploadProgress, cb);
27
- }, cb);
24
+ return api
25
+ .postUpload(form, { token: current?.session?.access_token })
26
+ .then((upload) => {
27
+ s3.upload(upload.upload_url, artifact, onUploadProgress, cb);
28
+ }, cb);
28
29
  };
29
30
 
30
31
  // [function]
31
32
 
32
- const ensureVersion = function (session, { id, version }, cb) {
33
- const token = session?.access_token;
34
- return api.gameBuild(id, version, { token }).then(
35
- () => cb(new Error(phrase.versionExists(version))),
33
+ const ensureGame = function (current, idOrHandle, id, cb) {
34
+ return api.discoverGame(idOrHandle).then(
35
+ (game) => {
36
+ if (game.account === current?.user?.id && game.id === id) {
37
+ cb(null);
38
+ return;
39
+ }
40
+ cb(new Error(phrase.gameExists(idOrHandle)));
41
+ },
36
42
  (err) => {
37
43
  if (err.status === 404) {
38
44
  cb(null);
@@ -45,10 +51,39 @@ const ensureVersion = function (session, { id, version }, cb) {
45
51
 
46
52
  // [function]
47
53
 
48
- const release = function (session, artifact, game, onUploadProgress, cb) {
49
- uploadBuild(session, artifact, game, onUploadProgress, cb);
54
+ const ensureId = function (current, { handle, id }, cb) {
55
+ return ensureGame(current, id, id, (err) => {
56
+ if (err || handle === null) {
57
+ cb(err);
58
+ return;
59
+ }
60
+ ensureGame(current, handle, id, cb);
61
+ });
62
+ };
63
+
64
+ // [function]
65
+
66
+ const ensureVersion = function (current, { id, version }, cb) {
67
+ return api
68
+ .gameBuild(id, version, { token: current?.session?.access_token })
69
+ .then(
70
+ () => cb(new Error(phrase.gameVersionExists(version))),
71
+ (err) => {
72
+ if (err.status === 404) {
73
+ cb(null);
74
+ return;
75
+ }
76
+ cb(err);
77
+ },
78
+ );
79
+ };
80
+
81
+ // [function]
82
+
83
+ const release = function (current, artifact, game, onUploadProgress, cb) {
84
+ uploadBuild(current, artifact, game, onUploadProgress, cb);
50
85
  };
51
86
 
52
87
  // [export]
53
88
 
54
- module.exports = { ensureVersion, release };
89
+ module.exports = { ensureId, ensureVersion, release };
@@ -10,6 +10,7 @@ const semver = require("semver");
10
10
 
11
11
  // [import]
12
12
 
13
+ const cfgproduct = require("../../config/product");
13
14
  const phrase = require("../../phrase");
14
15
 
15
16
  // [use]
@@ -19,7 +20,8 @@ const prereleaseSemver = semver.prerelease;
19
20
 
20
21
  // [declare]
21
22
 
22
- const PREFIX = "arcadible/release/v";
23
+ const HANDLE = cfgproduct.handle;
24
+ const PREFIX = `${HANDLE}/release/v`;
23
25
 
24
26
  // [function]
25
27
 
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ // [import]
4
+
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+
8
+ // [use]
9
+
10
+ const existsSync = fs.existsSync; // eslint-disable-line no-sync
11
+ const join = path.join;
12
+
13
+ // [import]
14
+
15
+ const phrase = require("../../phrase");
16
+
17
+ // [function]
18
+
19
+ const ensureLockFile = function (root, cb) {
20
+ if (!existsSync(join(root, "package.json"))) {
21
+ cb(null);
22
+ return;
23
+ }
24
+ if (
25
+ // npm
26
+ existsSync(join(root, "package-lock.json")) ||
27
+ existsSync(join(root, "npm-shrinkwrap.json")) ||
28
+ // pnpm
29
+ existsSync(join(root, "pnpm-lock.yaml")) ||
30
+ // yarn
31
+ existsSync(join(root, "yarn.lock"))
32
+ ) {
33
+ cb(null);
34
+ return;
35
+ }
36
+ cb(new Error(phrase.noLockFile()));
37
+ };
38
+
39
+ // [export]
40
+
41
+ module.exports = { ensureLockFile };
@@ -3,11 +3,13 @@
3
3
  // [import]
4
4
 
5
5
  const git = require("./git");
6
+ const pm = require("./pm");
6
7
  const project = require("../../parser/project");
7
8
 
8
9
  // [use]
9
10
 
10
11
  const ensureClean = git.ensureClean;
12
+ const ensureLockFile = pm.ensureLockFile;
11
13
  const ensureRemote = git.ensureRemote;
12
14
  const ensureRepo = git.ensureRepo;
13
15
  const ensureVersion = git.ensureVersion;
@@ -26,7 +28,7 @@ const deployRelease = function (version, { root }, handler, cb) {
26
28
 
27
29
  // [function]
28
30
 
29
- const deployEnsure = function ({ root }, { onLogInfo }, cb) {
31
+ const deployEnsureGit = function ({ root }, { onLogInfo }, cb) {
30
32
  ensureRepo(root, (err) => {
31
33
  if (err) {
32
34
  cb(err);
@@ -50,13 +52,31 @@ const deployEnsure = function ({ root }, { onLogInfo }, cb) {
50
52
 
51
53
  // [function]
52
54
 
53
- const deploy = function ({ version }, { root }, handler, cb) {
54
- deployEnsure({ root }, handler, (err) => {
55
+ const deployEnsurePm = function ({ root }, handler, cb) {
56
+ ensureLockFile(root, cb);
57
+ };
58
+
59
+ // [function]
60
+
61
+ const deployEnsure = function (conf, handler, cb) {
62
+ deployEnsurePm(conf, handler, (err) => {
63
+ if (err) {
64
+ cb(err);
65
+ return;
66
+ }
67
+ deployEnsureGit(conf, handler, cb, cb);
68
+ });
69
+ };
70
+
71
+ // [function]
72
+
73
+ const deploy = function ({ version }, conf, handler, cb) {
74
+ deployEnsure(conf, handler, (err) => {
55
75
  if (err) {
56
76
  cb(err);
57
77
  return;
58
78
  }
59
- deployRelease(version, { root }, handler, cb);
79
+ deployRelease(version, conf, handler, cb);
60
80
  });
61
81
  };
62
82
 
@@ -64,7 +84,7 @@ const deploy = function ({ version }, { root }, handler, cb) {
64
84
 
65
85
  const main = function ({ root }, { onPredeployBegin, ...handler }) {
66
86
  if (onPredeployBegin) {
67
- onPredeployBegin({ root });
87
+ onPredeployBegin();
68
88
  }
69
89
  return project(root).then(
70
90
  ({ game }) =>
@@ -7,36 +7,43 @@ const project = require("../../parser/project");
7
7
 
8
8
  // [use]
9
9
 
10
+ const ensureId = ac.ensureId;
10
11
  const ensureVersion = ac.ensureVersion;
11
12
 
12
13
  // [function]
13
14
 
14
- const deployRelease = function (session, game, handler, cb) {
15
- ensureVersion(session, game, (err) => {
15
+ const deployRelease = function (current, game, handler, cb) {
16
+ ensureId(current, game, (err) => {
16
17
  if (err) {
17
18
  cb(err);
18
19
  return;
19
20
  }
20
- cb(null, { to: game.version });
21
+ ensureVersion(current, game, (err) => {
22
+ if (err) {
23
+ cb(err);
24
+ return;
25
+ }
26
+ cb(null, { to: game.version });
27
+ });
21
28
  });
22
29
  };
23
30
 
24
31
  // [function]
25
32
 
26
- const deploy = function (session, game, handler, cb) {
27
- deployRelease(session, game, handler, cb);
33
+ const deploy = function (current, game, handler, cb) {
34
+ deployRelease(current, game, handler, cb);
28
35
  };
29
36
 
30
37
  // [function]
31
38
 
32
- const main = function (session, { root }, { onPredeployBegin, ...handler }) {
39
+ const main = function (current, { root }, { onPredeployBegin, ...handler }) {
33
40
  if (onPredeployBegin) {
34
41
  onPredeployBegin({ root });
35
42
  }
36
43
  return project(root).then(
37
44
  ({ game }) =>
38
45
  new Promise((resolve, reject) => {
39
- deploy(session, game, handler, (err, data) => {
46
+ deploy(current, game, handler, (err, data) => {
40
47
  if (err) {
41
48
  reject(err);
42
49
  return;
package/src/api.js CHANGED
@@ -7,13 +7,12 @@ const request = require("./util/request");
7
7
 
8
8
  // [declare]
9
9
 
10
- const API_HOST = cfguri.HOST_HTTP_API;
11
- const API_VERSION = "v1";
10
+ const VERSION = "v1";
12
11
 
13
12
  // [function]
14
13
 
15
14
  const endpoint = function (path) {
16
- return `${API_HOST}/${API_VERSION}${path}`;
15
+ return `${cfguri.HOST_HTTP_API}/${VERSION}${path}`;
17
16
  };
18
17
 
19
18
  // [function]
@@ -42,6 +41,12 @@ const postUpload = function (form, opts) {
42
41
 
43
42
  // [function]
44
43
 
44
+ const game = function (id, opts) {
45
+ return request.get(endpoint(`/games/${id}`), opts);
46
+ };
47
+
48
+ // [function]
49
+
45
50
  const discoverGame = function (id, opts) {
46
51
  return request.get(endpoint(`/discover/games/${id}`), opts);
47
52
  };
@@ -64,6 +69,7 @@ module.exports = {
64
69
  discoverGame,
65
70
  discoverGameBuilds,
66
71
  flow,
72
+ game,
67
73
  gameBuild,
68
74
  postAuthRefresh,
69
75
  postFlow,
package/src/cli/deploy.js CHANGED
@@ -7,10 +7,10 @@ const deployToolGit = require("../action/deploy/tool-git");
7
7
 
8
8
  // [function]
9
9
 
10
- const main = function ({ artifact, git, handler, session, ...conf }) {
10
+ const main = function ({ artifact, current, git, handler, ...conf }) {
11
11
  return git
12
12
  ? deployToolGit(conf, handler)
13
- : deployTool(session, artifact, conf, handler);
13
+ : deployTool(current, artifact, conf, handler);
14
14
  };
15
15
 
16
16
  // [export]