@arcadible/github-release-tools 0.1.29 → 0.1.32

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/README.md CHANGED
@@ -1,3 +1,38 @@
1
- # GitHub Release Tools
1
+ <p align="center">
2
+ <a href="https://arcadible.com">
3
+ <img src="https://adn-arcadible.imgix.net/images/i18n/core/www/appicon-512.png?w=256" alt="Arcadible" height="96">
4
+ </a>
5
+ </p>
2
6
 
3
- Provides helper commands for the `Arcadible Release` workflow on GitHub Actions.
7
+ <h1 align="center">Arcadible GitHub Release Tools</h1>
8
+
9
+ <p align="center">
10
+ Helper commands for the Arcadible Release workflow on GitHub Actions.
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://developer.arcadible.com/guides/publishing/deploying-from-github">Docs</a> ·
15
+ <a href="https://www.npmjs.com/package/arcadible">Arcadible CLI</a> ·
16
+ <a href="https://arcadible.com">Arcadible</a>
17
+ </p>
18
+
19
+ <br>
20
+
21
+ When `arc deploy git` pushes a release tag, the Arcadible Release workflow builds the game on GitHub Actions. It installs this package alongside the [Arcadible CLI](https://www.npmjs.com/package/arcadible) and uses its `arctool-*` commands to read the game's manifest. You don't need to install it yourself.
22
+
23
+ | Command | What it does |
24
+ | ------------------------ | --------------------------------------------------------------------- |
25
+ | `arctool-assert-tag` | Checks that the release tag matches the manifest's version |
26
+ | `arctool-assert-dir` | Checks that the build produced the deploy directory |
27
+ | `arctool-put-version` | Outputs the manifest's version |
28
+ | `arctool-put-prerelease` | Outputs whether the version is a prerelease |
29
+ | `arctool-put-build` | Outputs the build command |
30
+ | `arctool-put-deploy-dir` | Outputs the deploy directory |
31
+ | `arctool-put-cache` | Outputs the package manager to cache, from the project's lockfile |
32
+ | `arctool-install-deps` | Installs the project's dependencies exactly as its lockfile pins them |
33
+
34
+ Each `put` command writes its value to the step's `GITHUB_OUTPUT`. `arctool-install-deps` runs `npm ci`, or pnpm or Yarn through corepack, and does nothing without a lockfile.
35
+
36
+ ## License
37
+
38
+ Apache-2.0
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+ SCRIPT="$(realpath "$0")"
4
+ DIR="$(dirname "$SCRIPT")"
5
+ node "$DIR/../src/install-deps.js" "$1"
File without changes
File without changes
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
+ "author": "Offst, Inc.",
2
3
  "bin": {
3
4
  "arctool-assert-dir": "bin/arctool-assert-dir.sh",
4
5
  "arctool-assert-tag": "bin/arctool-assert-tag.sh",
6
+ "arctool-install-deps": "bin/arctool-install-deps.sh",
5
7
  "arctool-put-build": "bin/arctool-put-build.sh",
6
8
  "arctool-put-cache": "bin/arctool-put-cache.sh",
7
9
  "arctool-put-deploy-dir": "bin/arctool-put-deploy-dir.sh",
@@ -11,11 +13,24 @@
11
13
  "dependencies": {
12
14
  "semver": "^7.7.3"
13
15
  },
14
- "description": "Provides helper commands used by the Arcadible Release workflow on GitHub.",
16
+ "description": "Helper commands for the Arcadible Release workflow on GitHub Actions.",
15
17
  "engines": {
16
- "node": ">=24.11.1"
18
+ "node": ">=24"
17
19
  },
20
+ "files": [
21
+ "bin",
22
+ "src"
23
+ ],
24
+ "homepage": "https://developer.arcadible.com/guides/publishing/deploying-from-github",
25
+ "keywords": [
26
+ "arcadible",
27
+ "github-actions",
28
+ "release"
29
+ ],
18
30
  "license": "Apache-2.0",
19
31
  "name": "@arcadible/github-release-tools",
20
- "version": "0.1.29"
32
+ "scripts": {
33
+ "test": "node --test \"test/**/*.test.js\""
34
+ },
35
+ "version": "0.1.32"
21
36
  }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ // [import]
4
+
5
+ const cp = require("node:child_process");
6
+
7
+ // [import]
8
+
9
+ const detect = require("./lockfile");
10
+
11
+ // [use]
12
+
13
+ const spawnSync = cp.spawnSync; // eslint-disable-line no-sync
14
+
15
+ // [declare]
16
+
17
+ // the install that follows the lockfile exactly, for each package manager.
18
+ // pnpm and yarn run through corepack, which ships with Node.js 24 and uses the
19
+ // version a project's packageManager names.
20
+ const COMMANDS = {
21
+ npm: ["npm", ["ci"]],
22
+ pnpm: ["corepack", ["pnpm", "install", "--frozen-lockfile"]],
23
+ yarn: ["corepack", ["yarn", "install", "--frozen-lockfile"]],
24
+ };
25
+
26
+ // [define]
27
+
28
+ const dir = process.argv[2];
29
+
30
+ // [function]
31
+
32
+ const writeErr = function (data) {
33
+ process.stderr.write(data.trim().concat("\n"));
34
+ };
35
+
36
+ // [main]
37
+
38
+ try {
39
+ if (!dir) {
40
+ throw new Error("No directory provided.");
41
+ }
42
+ const manager = detect(dir);
43
+ if (manager) {
44
+ const [command, args] = COMMANDS[manager];
45
+ const { error, status } = spawnSync(command, args, {
46
+ cwd: dir,
47
+ env: { ...process.env, COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" },
48
+ stdio: "inherit",
49
+ });
50
+ if (error) {
51
+ throw error;
52
+ }
53
+ if (status !== 0) {
54
+ process.exit(status ?? 1);
55
+ }
56
+ }
57
+ } catch (ex) {
58
+ writeErr(ex.message);
59
+ process.exit(1);
60
+ }
@@ -0,0 +1,35 @@
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
+ // [declare]
14
+
15
+ // each package manager, and the lockfiles that mean a project uses it, in the
16
+ // order they're checked.
17
+ const LOCKFILES = [
18
+ ["npm", ["package-lock.json", "npm-shrinkwrap.json"]],
19
+ ["pnpm", ["pnpm-lock.yaml"]],
20
+ ["yarn", ["yarn.lock"]],
21
+ ];
22
+
23
+ // [function]
24
+
25
+ // the package manager a project's lockfile names, or "" when it has none.
26
+ const detect = function (root) {
27
+ const found = LOCKFILES.find(([, names]) =>
28
+ names.some((name) => existsSync(join(root, name))),
29
+ );
30
+ return found ? found[0] : "";
31
+ };
32
+
33
+ // [export]
34
+
35
+ module.exports = detect;
package/src/put-cache.js CHANGED
@@ -2,14 +2,15 @@
2
2
 
3
3
  // [import]
4
4
 
5
- const fs = require("node:fs");
6
5
  const path = require("node:path");
7
6
 
7
+ // [import]
8
+
9
+ const detect = require("./lockfile");
10
+
8
11
  // [use]
9
12
 
10
13
  const dirname = path.dirname;
11
- const existsSync = fs.existsSync; // eslint-disable-line no-sync
12
- const join = path.join;
13
14
 
14
15
  // [define]
15
16
 
@@ -33,19 +34,7 @@ try {
33
34
  if (!file) {
34
35
  throw new Error("No file provided.");
35
36
  }
36
- const root = dirname(file);
37
- if (
38
- existsSync(join(root, "package-lock.json")) ||
39
- existsSync(join(root, "npm-shrinkwrap.json"))
40
- ) {
41
- write("npm");
42
- } else if (existsSync(join(root, "pnpm-lock.yaml"))) {
43
- write("pnpm");
44
- } else if (existsSync(join(root, "yarn.lock"))) {
45
- write("yarn");
46
- } else {
47
- write("");
48
- }
37
+ write(detect(dirname(file)));
49
38
  } catch (ex) {
50
39
  writeErr(ex.message);
51
40
  process.exit(1);
package/.eslintrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "eslint-config-offst"
3
- }