arcadible 0.1.4 → 0.1.6

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.
@@ -31,12 +31,12 @@ const main = function (argv) {
31
31
  .scriptName(CMD)
32
32
  .usage("$0 <command> [options]")
33
33
  .command("deploy", "Deploy to Arcadible")
34
- .command("init", "Initialize a project")
34
+ .command("validate", "Validate workspace")
35
35
  .command("inspect", "Inspect project metadata")
36
+ .command("init", "Initialize a project")
37
+ .command("whoami", "Show current Arcadible account")
36
38
  .command("login", "Log in to Arcadible")
37
39
  .command("logout", "Log out of Arcadible")
38
- .command("validate", "Validate workspace")
39
- .command("whoami", "Show current account")
40
40
  .help("help")
41
41
  .alias("help", "h")
42
42
  .version(pkg.version)
package/bin/arc-deploy.js CHANGED
@@ -111,27 +111,26 @@ const main = function (argv) {
111
111
  .scriptName(`${CMD} ${SUBCMD}`)
112
112
  .usage("$0 [options]")
113
113
  .option("git", {
114
- alias: "g",
115
114
  default: conf.git,
116
- describe: "Deploy through Git.",
115
+ describe: "Deploy through Git",
117
116
  type: "boolean",
118
117
  })
119
118
  .option("json", {
120
119
  alias: "j",
121
120
  default: conf.json,
122
- describe: "Format output as JSON.",
121
+ describe: "Format output as JSON",
123
122
  type: "boolean",
124
123
  })
125
124
  .option("quiet", {
126
125
  alias: "q",
127
126
  default: conf.quiet,
128
- describe: "Output only errors.",
127
+ describe: "Output only errors",
129
128
  type: "boolean",
130
129
  })
131
130
  .option("cwd", {
132
131
  alias: "C",
133
132
  default: ".",
134
- describe: "Set the working directory.",
133
+ describe: "Set the working directory",
135
134
  type: "string",
136
135
  })
137
136
  .help("help")
package/bin/arc-init.js CHANGED
@@ -20,7 +20,7 @@ const output = require("../src/util/output");
20
20
  const pkg = require("../package.json");
21
21
  const project = require("../src/prompt/project");
22
22
  const rc = require("../src/util/rc");
23
- const starter = require("../src/prompt/starter");
23
+ const template = require("../src/prompt/template");
24
24
 
25
25
  // [use]
26
26
 
@@ -70,7 +70,7 @@ const start = function (argv) {
70
70
  handler: handler({ json, quiet }),
71
71
  project: argv.project,
72
72
  root,
73
- starter: argv.starter,
73
+ template: argv.template,
74
74
  })
75
75
  .then((data) => {
76
76
  const dir = relative(root, data.path);
@@ -110,14 +110,14 @@ const prompt = async function ({ yes, ...argv }) {
110
110
  const opts = { ...argv };
111
111
  if (yes) {
112
112
  opts.project ??= project.input.default;
113
- opts.starter ??= starter.select.default;
113
+ opts.template ??= template.select.default;
114
114
  return opts;
115
115
  }
116
116
  if (!argv.project) {
117
117
  opts.project = await input(project.input);
118
118
  }
119
- if (!argv.starter) {
120
- opts.starter = await select(starter.select);
119
+ if (!argv.template) {
120
+ opts.template = await select(template.select);
121
121
  }
122
122
  return opts;
123
123
  };
@@ -131,43 +131,43 @@ const main = function (argv) {
131
131
  .usage("$0 <project> [options]")
132
132
  .command("$0 <project>", false, (cli) =>
133
133
  cli.positional("project", {
134
- describe: "Set the project directory.",
134
+ describe: "Project directory",
135
135
  type: "string",
136
136
  }),
137
137
  )
138
- .option("starter", {
138
+ .option("template", {
139
139
  alias: "t",
140
- describe: "Select a project starter.",
140
+ describe: "Project template",
141
141
  type: "string",
142
142
  })
143
143
  .option("yes", {
144
144
  alias: "y",
145
145
  default: conf.yes,
146
- describe: "Answer prompts using default values.",
146
+ describe: "Answer prompts using default values",
147
147
  type: "boolean",
148
148
  })
149
149
  .option("force", {
150
150
  alias: "f",
151
151
  default: conf.force,
152
- describe: "Overwrite an existing directory.",
152
+ describe: "Overwrite an existing directory",
153
153
  type: "boolean",
154
154
  })
155
155
  .option("json", {
156
156
  alias: "j",
157
157
  default: conf.json,
158
- describe: "Format output as JSON.",
158
+ describe: "Format output as JSON",
159
159
  type: "boolean",
160
160
  })
161
161
  .option("quiet", {
162
162
  alias: "q",
163
163
  default: conf.quiet,
164
- describe: "Output only errors.",
164
+ describe: "Output only errors",
165
165
  type: "boolean",
166
166
  })
167
167
  .option("cwd", {
168
168
  alias: "C",
169
169
  default: ".",
170
- describe: "Set the working directory.",
170
+ describe: "Set the working directory",
171
171
  type: "string",
172
172
  })
173
173
  .help("help")
@@ -71,20 +71,20 @@ const main = function (argv) {
71
71
  .command("$0 [key]", false, (cli) =>
72
72
  cli.positional("key", {
73
73
  default: conf.key,
74
- describe: "Select a metadata key.",
74
+ describe: "Metadata key",
75
75
  type: "string",
76
76
  }),
77
77
  )
78
78
  .option("json", {
79
79
  alias: "j",
80
80
  default: conf.json,
81
- describe: "Format output as JSON.",
81
+ describe: "Format output as JSON",
82
82
  type: "boolean",
83
83
  })
84
84
  .option("cwd", {
85
85
  alias: "C",
86
86
  default: ".",
87
- describe: "Set the working directory.",
87
+ describe: "Set the working directory",
88
88
  type: "string",
89
89
  })
90
90
  .help("help")
package/bin/arc-login.js CHANGED
@@ -104,7 +104,8 @@ const main = function (argv) {
104
104
  .usage("$0 [options]")
105
105
  .option("browser", {
106
106
  default: conf.browser,
107
- describe: "Open a web browser automatically.",
107
+ describe:
108
+ "Open a web browser automatically (use --no-browser to disable)",
108
109
  type: "boolean",
109
110
  })
110
111
  .help("help")
package/bin/arc-pack.js CHANGED
@@ -34,7 +34,7 @@ const SUBCMD = "pack";
34
34
 
35
35
  const conf = {
36
36
  json: false,
37
- output: "package.zip",
37
+ output: "project.zip",
38
38
  quiet: false,
39
39
  ...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
40
40
  };
@@ -84,25 +84,25 @@ const main = function (argv) {
84
84
  .option("output", {
85
85
  alias: "o",
86
86
  default: conf.output,
87
- describe: "Set the output path.",
87
+ describe: "Set the output path",
88
88
  type: "string",
89
89
  })
90
90
  .option("json", {
91
91
  alias: "j",
92
92
  default: conf.json,
93
- describe: "Format output as JSON.",
93
+ describe: "Format output as JSON",
94
94
  type: "boolean",
95
95
  })
96
96
  .option("quiet", {
97
97
  alias: "q",
98
98
  default: conf.quiet,
99
- describe: "Output only errors.",
99
+ describe: "Output only errors",
100
100
  type: "boolean",
101
101
  })
102
102
  .option("cwd", {
103
103
  alias: "C",
104
104
  default: ".",
105
- describe: "Set the working directory.",
105
+ describe: "Set the working directory",
106
106
  type: "string",
107
107
  })
108
108
  .help("help")
@@ -45,16 +45,13 @@ const start = function (argv) {
45
45
  return validate({ root: resolve(process.cwd(), argv.cwd) })
46
46
  .then((issues) => {
47
47
  const count = issues.length;
48
- const term = count === 1 ? "issue" : "issues";
49
48
  if (json) {
50
49
  print({ issues });
50
+ } else if (count) {
51
+ log.hd(`${count} ${count === 1 ? "issue" : "issues"} found.`);
52
+ log.p(issues.map((error) => `✗ ${error}`));
51
53
  } else if (!quiet) {
52
- if (count) {
53
- log.hd(`${count} ${term} found.`);
54
- log.p(issues.map((error) => `✗ ${error}`));
55
- } else {
56
- log.hs("Validated.");
57
- }
54
+ log.hs("Validated.");
58
55
  }
59
56
  process.exit(count ? 1 : 0);
60
57
  })
@@ -80,19 +77,19 @@ const main = function (argv) {
80
77
  .option("json", {
81
78
  alias: "j",
82
79
  default: conf.json,
83
- describe: "Format output as JSON.",
80
+ describe: "Format output as JSON",
84
81
  type: "boolean",
85
82
  })
86
83
  .option("quiet", {
87
84
  alias: "q",
88
85
  default: conf.quiet,
89
- describe: "Output only errors.",
86
+ describe: "Output only errors",
90
87
  type: "boolean",
91
88
  })
92
89
  .option("cwd", {
93
90
  alias: "C",
94
91
  default: ".",
95
- describe: "Set the working directory.",
92
+ describe: "Set the working directory",
96
93
  type: "string",
97
94
  })
98
95
  .help("help")
package/bin/arc-whoami.js CHANGED
@@ -88,7 +88,7 @@ const main = function (argv) {
88
88
  .option("json", {
89
89
  alias: "j",
90
90
  default: conf.json,
91
- describe: "Format output as JSON.",
91
+ describe: "Format output as JSON",
92
92
  type: "boolean",
93
93
  })
94
94
  .help("help")
package/package.json CHANGED
@@ -51,5 +51,5 @@
51
51
  "license": "Apache-2.0",
52
52
  "main": "./src/cli/index.js",
53
53
  "name": "arcadible",
54
- "version": "0.1.4"
54
+ "version": "0.1.6"
55
55
  }
@@ -27,7 +27,7 @@ const git = function (root, args, cb) {
27
27
  const ensureRepo = function (root, cb) {
28
28
  const message = [
29
29
  "Unable to find a Git repository.",
30
- "Navigate to a Git repository and try again.",
30
+ "Ensure you are in a Git repository, or create one before continuing.",
31
31
  ];
32
32
  git(root, ["rev-parse", "--is-inside-work-tree"], (err) => {
33
33
  if (err) {
@@ -43,7 +43,7 @@ const ensureRepo = function (root, cb) {
43
43
  const ensureRemote = function (root, cb) {
44
44
  const message = [
45
45
  "Unable to access Git remote 'origin'.",
46
- "Verify the remote exists and you have permission to access it.",
46
+ "Ensure the remote exists and you have permission to access it.",
47
47
  ];
48
48
  git(root, ["ls-remote", "origin"], (err) => {
49
49
  if (err) {
@@ -58,8 +58,8 @@ const ensureRemote = function (root, cb) {
58
58
 
59
59
  const ensureClean = function (root, cb) {
60
60
  const message = [
61
- "Unable to continue with unstaged changes.",
62
- "Stage, commit, or discard your local changes before deploying.",
61
+ "Unable to continue with Git changes present.",
62
+ "Ensure all changes are staged, committed, or discarded before continuing.",
63
63
  ];
64
64
  git(root, ["diff", "--quiet"], (err) => {
65
65
  if (err) {
@@ -89,7 +89,7 @@ const ensureClean = function (root, cb) {
89
89
  const createTag = function (root, version, cb) {
90
90
  const message = [
91
91
  "Unable to create Git tag.",
92
- "Verify the release tag does not already exist locally.",
92
+ "Ensure the release tag does not already exist locally.",
93
93
  ];
94
94
  git(
95
95
  root,
@@ -117,7 +117,7 @@ const createTag = function (root, version, cb) {
117
117
  const pushTag = function (root, version, cb) {
118
118
  const message = [
119
119
  "Unable to push Git tag.",
120
- "Verify the release tag does not already exist on remote 'origin'.",
120
+ "Ensure the release tag does not already exist on remote 'origin'.",
121
121
  ];
122
122
  git(root, ["push", "origin", `${PREFIX}${version}`], (err) => {
123
123
  if (err) {
@@ -40,7 +40,7 @@ const deployEnsure = function ({ root }, { onInfo }, cb) {
40
40
  if (diff.cached) {
41
41
  onInfo({
42
42
  level: "warn",
43
- message: "Staged but uncommitted changes will not be deployed.",
43
+ message: "Staged but uncommitted changes will not be included.",
44
44
  });
45
45
  }
46
46
  ensureRemote(root, cb);
@@ -64,7 +64,7 @@ const deploy = function (version, { root }, handler, cb) {
64
64
 
65
65
  const main = function ({ root }, { onBegin, ...handler }) {
66
66
  onBegin({ root });
67
- return project.parse(root).then(
67
+ return project(root).then(
68
68
  ({ game }) =>
69
69
  new Promise((resolve, reject) => {
70
70
  deploy(game.version, { root }, handler, (err, data) => {
@@ -27,14 +27,16 @@ const init = function (src, dest, { onBegin, onInfo }) {
27
27
 
28
28
  // [function]
29
29
 
30
- const main = function ({ force, project, root, starter }, handler) {
30
+ const main = function ({ force, project, root, template }, handler) {
31
31
  const dest = resolve(root, project);
32
32
  return pathExists(dest)
33
33
  .then((exists) => {
34
34
  if (exists && !force) {
35
- throw new Error("Directory exists. Run with `--force` to overwrite.");
35
+ throw new Error(
36
+ "Directory already exists. Use `--force` to overwrite.",
37
+ );
36
38
  }
37
- return init(starter, dest, handler);
39
+ return init(template, dest, handler);
38
40
  })
39
41
  .then(() => ({ path: dest }));
40
42
  };
@@ -17,7 +17,7 @@ const inspect = function (proj, key) {
17
17
  // [function]
18
18
 
19
19
  const main = function ({ key, root }) {
20
- return project.parse(root).then((proj) => inspect(proj, key));
20
+ return project(root).then((proj) => inspect(proj, key));
21
21
  };
22
22
 
23
23
  // [export]
@@ -15,8 +15,8 @@ const Zip = require("../../util/zip");
15
15
 
16
16
  // [use]
17
17
 
18
+ const parse = path.parse;
18
19
  const pathExists = fs.pathExists;
19
- const pathParse = path.parse;
20
20
  const resolve = path.resolve;
21
21
 
22
22
  // [declare]
@@ -46,8 +46,8 @@ const pack = function (name, game, { deployPath, mediaPath, zipPath }) {
46
46
  // [function]
47
47
 
48
48
  const main = function ({ output, root }) {
49
- return project.parse(root).then(({ game, workflow }) =>
50
- pack(pathParse(output).name, game, {
49
+ return project(root).then(({ game, workflow }) =>
50
+ pack(parse(output).name, game, {
51
51
  deployPath: resolve(root, workflow.deploy_dir),
52
52
  mediaPath: resolve(root, MEDIA),
53
53
  zipPath: resolve(root, output),
@@ -31,7 +31,7 @@ const validate = function (proj, { root }) {
31
31
  // [function]
32
32
 
33
33
  const main = function ({ root }) {
34
- return project.parse(root).then((proj) => validate(proj, { root }));
34
+ return project(root).then((proj) => validate(proj, { root }));
35
35
  };
36
36
 
37
37
  // [export]
@@ -5,6 +5,6 @@
5
5
  module.exports = {
6
6
  /* eslint-disable camelcase */
7
7
  deploy_dir: ".arcadible-public",
8
- skip_build: false,
8
+ skip_build: true,
9
9
  /* eslint-enable camelcase */
10
10
  };
@@ -33,7 +33,7 @@ const parseToml = function (buf) {
33
33
 
34
34
  // [function]
35
35
 
36
- const parse = function (root) {
36
+ const main = function (root) {
37
37
  const file = join(root, MANIFEST);
38
38
  return pathExists(file)
39
39
  .then((exists) => (exists ? readFile(file, "utf8") : null))
@@ -42,4 +42,4 @@ const parse = function (root) {
42
42
 
43
43
  // [export]
44
44
 
45
- module.exports = { parse };
45
+ module.exports = main;
@@ -14,11 +14,11 @@ const objs = require("../util/objs");
14
14
 
15
15
  // [use]
16
16
 
17
- const compactObjs = objs.compact;
17
+ const deepCompact = objs.deepCompact;
18
18
  const extname = path.extname;
19
19
  const join = path.join;
20
+ const parse = path.parse;
20
21
  const pathExists = fs.pathExists;
21
- const pathParse = path.parse;
22
22
  const readdir = fs.promises.readdir;
23
23
 
24
24
  // [declare]
@@ -44,7 +44,7 @@ const MEDIA = ".arcadible";
44
44
 
45
45
  const handleArt = function (exists) {
46
46
  return Object.fromEntries(
47
- ART.map((f, i) => [pathParse(f).name, exists[i] ? join(MEDIA, f) : null]),
47
+ ART.map((f, i) => [parse(f).name, exists[i] ? join(MEDIA, f) : null]),
48
48
  );
49
49
  };
50
50
 
@@ -79,12 +79,12 @@ const gallery = function (root) {
79
79
 
80
80
  // [function]
81
81
 
82
- const parse = function (root) {
82
+ const main = function (root) {
83
83
  return new Promise((resolve, reject) => {
84
84
  Promise.resolve({})
85
85
  .then(art(root))
86
86
  .then(gallery(root))
87
- .then(compactObjs)
87
+ .then(deepCompact)
88
88
  .then((game) => ({ game }))
89
89
  .then(resolve)
90
90
  .catch(reject);
@@ -93,4 +93,4 @@ const parse = function (root) {
93
93
 
94
94
  // [export]
95
95
 
96
- module.exports = { parse };
96
+ module.exports = main;
package/src/parser/pkg.js CHANGED
@@ -8,8 +8,13 @@ const path = require("node:path");
8
8
 
9
9
  const fs = require("fs-extra");
10
10
 
11
+ // [import]
12
+
13
+ const objs = require("../util/objs");
14
+
11
15
  // [use]
12
16
 
17
+ const deepCompact = objs.deepCompact;
13
18
  const join = path.join;
14
19
  const pathExists = fs.pathExists;
15
20
  const readFile = fs.readFile;
@@ -33,17 +38,16 @@ const parseJson = function (buf) {
33
38
  // [function]
34
39
 
35
40
  const extract = function (pkg) {
36
- const game = { version: pkg.version || null };
37
- return Object.fromEntries(
38
- Object.entries({ game }).filter(([, value]) =>
39
- Object.values(value).some(Boolean),
40
- ),
41
- );
41
+ /* eslint-disable camelcase */
42
+ const game = { version: pkg.version };
43
+ const workflow = { skip_build: pkg.scripts?.build ? false : null };
44
+ /* eslint-enable camelcase */
45
+ return deepCompact({ game, workflow });
42
46
  };
43
47
 
44
48
  // [function]
45
49
 
46
- const parse = function (root) {
50
+ const main = function (root) {
47
51
  const file = join(root, PACKAGE);
48
52
  return pathExists(file)
49
53
  .then((exists) => (exists ? readFile(file, "utf8") : null))
@@ -53,4 +57,4 @@ const parse = function (root) {
53
57
 
54
58
  // [export]
55
59
 
56
- module.exports = { parse };
60
+ module.exports = main;
@@ -24,21 +24,22 @@ const configGame = function (readmeGame, mediaGame, pkgGame, manifestGame) {
24
24
 
25
25
  // [function]
26
26
 
27
- const configWorkflow = function (manifestWorkflow) {
27
+ const configWorkflow = function (pkgWorkflow, manifestWorkflow) {
28
28
  return {
29
29
  ...cfgworkflow,
30
+ ...(pkgWorkflow || {}),
30
31
  ...(manifestWorkflow || {}),
31
32
  };
32
33
  };
33
34
 
34
35
  // [function]
35
36
 
36
- const parse = function (root) {
37
+ const main = function (root) {
37
38
  const parsers = [
38
- () => manifest.parse(root),
39
- () => media.parse(root),
40
- () => pkg.parse(root),
41
- () => readme.parse(root),
39
+ () => manifest(root),
40
+ () => media(root),
41
+ () => pkg(root),
42
+ () => readme(root),
42
43
  ];
43
44
  return promise
44
45
  .serial(parsers)
@@ -49,11 +50,11 @@ const parse = function (root) {
49
50
  pkgData.game,
50
51
  manifestData.game,
51
52
  );
52
- const workflow = configWorkflow(manifestData.workflow);
53
+ const workflow = configWorkflow(pkgData.workflow, manifestData.workflow);
53
54
  return { game, workflow };
54
55
  });
55
56
  };
56
57
 
57
58
  // [export]
58
59
 
59
- module.exports = { parse };
60
+ module.exports = main;
@@ -17,7 +17,7 @@ const strs = require("../util/strs");
17
17
 
18
18
  // [use]
19
19
 
20
- const compactObjs = objs.compact;
20
+ const deepCompact = objs.deepCompact;
21
21
  const join = path.join;
22
22
  const pathExists = fs.pathExists;
23
23
  const readFile = fs.readFile;
@@ -141,14 +141,14 @@ const findReadme = function (root) {
141
141
 
142
142
  // [function]
143
143
 
144
- const parse = function (root) {
144
+ const main = function (root) {
145
145
  return findReadme(root)
146
146
  .then((file) => (file ? readFile(join(root, file), "utf8") : null))
147
147
  .then((buf) => (buf === null ? null : parseReadme(buf)))
148
- .then(compactObjs)
148
+ .then(deepCompact)
149
149
  .then((game) => ({ game: game || null }));
150
150
  };
151
151
 
152
152
  // [export]
153
153
 
154
- module.exports = { parse };
154
+ module.exports = main;
@@ -10,32 +10,32 @@ module.exports = {
10
10
  select: {
11
11
  choices: [
12
12
  {
13
- description: "Blank starter template.",
13
+ description: "Blank starter.",
14
14
  name: "Blank",
15
15
  value: `${REPO}/starter`,
16
16
  },
17
17
  {
18
- description: "Three.js starter template.",
18
+ description: "Three.js starter.",
19
19
  name: "Three.js",
20
20
  value: `${REPO}/starter-threejs`,
21
21
  },
22
22
  {
23
- description: "Phaser starter template.",
23
+ description: "Phaser starter.",
24
24
  name: "Phaser",
25
25
  value: `${REPO}/starter-phaser`,
26
26
  },
27
27
  {
28
- description: "PixiJS starter template.",
28
+ description: "PixiJS starter.",
29
29
  name: "PixiJS",
30
30
  value: `${REPO}/starter-pixijs`,
31
31
  },
32
32
  {
33
- description: "Babylon.js starter template.",
33
+ description: "Babylon.js starter.",
34
34
  name: "Babylon.js",
35
35
  value: `${REPO}/starter-babylonjs`,
36
36
  },
37
37
  ],
38
38
  default: `${REPO}/starter`,
39
- message: "Starter",
39
+ message: "Template",
40
40
  },
41
41
  };