@arcadible/github-release-tools 1.0.33 → 1.0.35
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 +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/src/assert-dir.js +14 -3
- package/src/assert-tag.js +16 -4
- package/src/install-deps.js +3 -1
- package/src/put-artifact.js +6 -3
- package/src/put-cache.js +3 -1
- package/src/put-version.js +7 -1
- package/src/util/code.js +18 -0
- package/src/util/io.js +20 -7
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ When `arc deploy git` pushes a release tag, the Arcadible Release workflow build
|
|
|
33
33
|
| `arctool-install-deps <dir>` | Installs the project's dependencies exactly as its lockfile pins them |
|
|
34
34
|
| `arctool-put-artifact <file>` | Checks that `arc pack` wrote the package, and outputs `artifact`, its path |
|
|
35
35
|
|
|
36
|
-
`<manifest>` is the file `arc inspect --json` writes. `<file>` is the package `arc pack` wrote. 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. A command that fails says why on stderr, and exits 1.
|
|
36
|
+
`<manifest>` is the file `arc inspect --json` writes. `<file>` is the package `arc pack` wrote. 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. A command that fails says why on stderr, ending as the CLI's failures do, with its code and the link to its entry on the [Errors](https://developer.arcadible.com/references/errors) page (one of the CLI's codes: `git_tag_invalid`, `version_mismatch`, `deploy_dir_missing`, `validation_failed`, or `unexpected`), and exits 1.
|
|
37
37
|
|
|
38
38
|
## License
|
|
39
39
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"name": "@arcadible/github-release-tools",
|
|
25
|
-
"version": "1.0.
|
|
25
|
+
"version": "1.0.35"
|
|
26
26
|
},
|
|
27
27
|
"node_modules/semver": {
|
|
28
28
|
"bin": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"requires": true,
|
|
41
|
-
"version": "1.0.
|
|
41
|
+
"version": "1.0.35"
|
|
42
42
|
}
|
package/package.json
CHANGED
package/src/assert-dir.js
CHANGED
|
@@ -7,10 +7,13 @@ const fs = require("node:fs");
|
|
|
7
7
|
|
|
8
8
|
// [import]
|
|
9
9
|
|
|
10
|
+
const code = require("./util/code");
|
|
10
11
|
const io = require("./util/io");
|
|
11
12
|
|
|
12
13
|
// [use]
|
|
13
14
|
|
|
15
|
+
const DEPLOY_DIR_MISSING = code.DEPLOY_DIR_MISSING;
|
|
16
|
+
const UNEXPECTED = code.UNEXPECTED;
|
|
14
17
|
const fail = io.fail;
|
|
15
18
|
const run = io.run;
|
|
16
19
|
const statSync = fs.statSync; // eslint-disable-line no-sync
|
|
@@ -23,13 +26,21 @@ const dir = process.argv[2];
|
|
|
23
26
|
|
|
24
27
|
run(() => {
|
|
25
28
|
if (!dir) {
|
|
26
|
-
fail("No directory provided.");
|
|
29
|
+
fail(UNEXPECTED, "No directory provided.");
|
|
27
30
|
}
|
|
28
31
|
const info = statSync(dir, { throwIfNoEntry: false });
|
|
29
32
|
if (!info) {
|
|
30
|
-
fail(
|
|
33
|
+
fail(
|
|
34
|
+
DEPLOY_DIR_MISSING,
|
|
35
|
+
`Unable to find: ${dir}`,
|
|
36
|
+
"The build didn't write deploy_dir.",
|
|
37
|
+
);
|
|
31
38
|
}
|
|
32
39
|
if (!info.isDirectory()) {
|
|
33
|
-
fail(
|
|
40
|
+
fail(
|
|
41
|
+
DEPLOY_DIR_MISSING,
|
|
42
|
+
`Unable to find: ${dir}`,
|
|
43
|
+
"It's a file, and deploy_dir is a folder.",
|
|
44
|
+
);
|
|
34
45
|
}
|
|
35
46
|
});
|
package/src/assert-tag.js
CHANGED
|
@@ -8,10 +8,14 @@ const semver = require("semver");
|
|
|
8
8
|
|
|
9
9
|
// [import]
|
|
10
10
|
|
|
11
|
+
const code = require("./util/code");
|
|
11
12
|
const io = require("./util/io");
|
|
12
13
|
|
|
13
14
|
// [use]
|
|
14
15
|
|
|
16
|
+
const GIT_TAG_INVALID = code.GIT_TAG_INVALID;
|
|
17
|
+
const UNEXPECTED = code.UNEXPECTED;
|
|
18
|
+
const VERSION_MISMATCH = code.VERSION_MISMATCH;
|
|
15
19
|
const fail = io.fail;
|
|
16
20
|
const readManifest = io.readManifest;
|
|
17
21
|
const run = io.run;
|
|
@@ -30,18 +34,26 @@ const tag = process.argv[3];
|
|
|
30
34
|
|
|
31
35
|
run(() => {
|
|
32
36
|
if (!tag) {
|
|
33
|
-
fail("No tag provided.");
|
|
37
|
+
fail(UNEXPECTED, "No tag provided.");
|
|
34
38
|
}
|
|
35
39
|
const invalid = `Invalid tag: ${tag}`;
|
|
36
40
|
if (!tag.startsWith(PREFIX)) {
|
|
37
|
-
fail(invalid, `A release tag is ${PREFIX}<version>.`);
|
|
41
|
+
fail(GIT_TAG_INVALID, invalid, `A release tag is ${PREFIX}<version>.`);
|
|
38
42
|
}
|
|
39
43
|
const release = validSemver(tag.slice(PREFIX.length));
|
|
40
44
|
if (!release) {
|
|
41
|
-
fail(
|
|
45
|
+
fail(
|
|
46
|
+
GIT_TAG_INVALID,
|
|
47
|
+
invalid,
|
|
48
|
+
`${tag.slice(PREFIX.length)} isn't a version.`,
|
|
49
|
+
);
|
|
42
50
|
}
|
|
43
51
|
const version = validSemver(readManifest(file)?.game?.version);
|
|
44
52
|
if (release !== version) {
|
|
45
|
-
fail(
|
|
53
|
+
fail(
|
|
54
|
+
VERSION_MISMATCH,
|
|
55
|
+
invalid,
|
|
56
|
+
`The project's version is ${version ?? "not set"}.`,
|
|
57
|
+
);
|
|
46
58
|
}
|
|
47
59
|
});
|
package/src/install-deps.js
CHANGED
|
@@ -6,11 +6,13 @@ const cp = require("node:child_process");
|
|
|
6
6
|
|
|
7
7
|
// [import]
|
|
8
8
|
|
|
9
|
+
const code = require("./util/code");
|
|
9
10
|
const detect = require("./util/lockfile");
|
|
10
11
|
const io = require("./util/io");
|
|
11
12
|
|
|
12
13
|
// [use]
|
|
13
14
|
|
|
15
|
+
const UNEXPECTED = code.UNEXPECTED;
|
|
14
16
|
const fail = io.fail;
|
|
15
17
|
const run = io.run;
|
|
16
18
|
const spawnSync = cp.spawnSync; // eslint-disable-line no-sync
|
|
@@ -34,7 +36,7 @@ const dir = process.argv[2];
|
|
|
34
36
|
|
|
35
37
|
run(() => {
|
|
36
38
|
if (!dir) {
|
|
37
|
-
fail("No directory provided.");
|
|
39
|
+
fail(UNEXPECTED, "No directory provided.");
|
|
38
40
|
}
|
|
39
41
|
const manager = detect(dir);
|
|
40
42
|
if (!manager) {
|
package/src/put-artifact.js
CHANGED
|
@@ -10,10 +10,12 @@ const fs = require("node:fs");
|
|
|
10
10
|
|
|
11
11
|
// [import]
|
|
12
12
|
|
|
13
|
+
const code = require("./util/code");
|
|
13
14
|
const io = require("./util/io");
|
|
14
15
|
|
|
15
16
|
// [use]
|
|
16
17
|
|
|
18
|
+
const UNEXPECTED = code.UNEXPECTED;
|
|
17
19
|
const fail = io.fail;
|
|
18
20
|
const run = io.run;
|
|
19
21
|
const statSync = fs.statSync; // eslint-disable-line no-sync
|
|
@@ -27,20 +29,21 @@ const file = process.argv[2];
|
|
|
27
29
|
|
|
28
30
|
run(() => {
|
|
29
31
|
if (!file) {
|
|
30
|
-
fail("No file provided.");
|
|
32
|
+
fail(UNEXPECTED, "No file provided.");
|
|
31
33
|
}
|
|
32
34
|
const info = statSync(file, { throwIfNoEntry: false });
|
|
33
35
|
if (!info) {
|
|
34
|
-
fail(`Unable to find: ${file}`, "arc pack didn't write it.");
|
|
36
|
+
fail(UNEXPECTED, `Unable to find: ${file}`, "arc pack didn't write it.");
|
|
35
37
|
}
|
|
36
38
|
if (!info.isFile()) {
|
|
37
39
|
fail(
|
|
40
|
+
UNEXPECTED,
|
|
38
41
|
`Unable to find: ${file}`,
|
|
39
42
|
"It's a folder, and the package is a file.",
|
|
40
43
|
);
|
|
41
44
|
}
|
|
42
45
|
if (info.size === 0) {
|
|
43
|
-
fail(`Unable to use: ${file}`, "It's empty.");
|
|
46
|
+
fail(UNEXPECTED, `Unable to use: ${file}`, "It's empty.");
|
|
44
47
|
}
|
|
45
48
|
write(file);
|
|
46
49
|
});
|
package/src/put-cache.js
CHANGED
|
@@ -8,12 +8,14 @@ const path = require("node:path");
|
|
|
8
8
|
|
|
9
9
|
// [import]
|
|
10
10
|
|
|
11
|
+
const code = require("./util/code");
|
|
11
12
|
const detect = require("./util/lockfile");
|
|
12
13
|
const io = require("./util/io");
|
|
13
14
|
|
|
14
15
|
// [use]
|
|
15
16
|
|
|
16
17
|
const dirname = path.dirname;
|
|
18
|
+
const UNEXPECTED = code.UNEXPECTED;
|
|
17
19
|
const fail = io.fail;
|
|
18
20
|
const run = io.run;
|
|
19
21
|
const write = io.write;
|
|
@@ -26,7 +28,7 @@ const file = process.argv[2];
|
|
|
26
28
|
|
|
27
29
|
run(() => {
|
|
28
30
|
if (!file) {
|
|
29
|
-
fail("No manifest file provided.");
|
|
31
|
+
fail(UNEXPECTED, "No manifest file provided.");
|
|
30
32
|
}
|
|
31
33
|
write(detect(dirname(file)));
|
|
32
34
|
});
|
package/src/put-version.js
CHANGED
|
@@ -7,10 +7,12 @@ const semver = require("semver");
|
|
|
7
7
|
|
|
8
8
|
// [import]
|
|
9
9
|
|
|
10
|
+
const code = require("./util/code");
|
|
10
11
|
const io = require("./util/io");
|
|
11
12
|
|
|
12
13
|
// [use]
|
|
13
14
|
|
|
15
|
+
const VALIDATION_FAILED = code.VALIDATION_FAILED;
|
|
14
16
|
const fail = io.fail;
|
|
15
17
|
const readManifest = io.readManifest;
|
|
16
18
|
const run = io.run;
|
|
@@ -27,7 +29,11 @@ run(() => {
|
|
|
27
29
|
const value = readManifest(file)?.game?.version;
|
|
28
30
|
const version = validSemver(value);
|
|
29
31
|
if (version === null) {
|
|
30
|
-
fail(
|
|
32
|
+
fail(
|
|
33
|
+
VALIDATION_FAILED,
|
|
34
|
+
`Invalid version: ${value ?? "not set"}`,
|
|
35
|
+
"Run arc validate.",
|
|
36
|
+
);
|
|
31
37
|
}
|
|
32
38
|
write(version);
|
|
33
39
|
});
|
package/src/util/code.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// each failure's code, one of the CLI's (its src/config/code.ts, held to
|
|
3
|
+
// these by its tests), with its entry on the Errors page.
|
|
4
|
+
|
|
5
|
+
// [export]
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
// the build didn't write deploy_dir, or wrote a file
|
|
9
|
+
DEPLOY_DIR_MISSING: "deploy_dir_missing",
|
|
10
|
+
// a tag that isn't arcadible/release/v<version>
|
|
11
|
+
GIT_TAG_INVALID: "git_tag_invalid",
|
|
12
|
+
// anything that's these tools' own doing, or their workflow's: a bug
|
|
13
|
+
UNEXPECTED: "unexpected",
|
|
14
|
+
// a manifest whose version isn't one
|
|
15
|
+
VALIDATION_FAILED: "validation_failed",
|
|
16
|
+
// a tag's version that isn't the project's
|
|
17
|
+
VERSION_MISMATCH: "version_mismatch",
|
|
18
|
+
};
|
package/src/util/io.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// what every arctool command shares: its result on stdout, which the bash
|
|
3
3
|
// wrapper writes to $GITHUB_OUTPUT, and a failure on stderr, in arc's shape
|
|
4
|
-
// (the CLI's OUTPUT.md): what failed, then why
|
|
4
|
+
// (the CLI's OUTPUT.md): what failed, then why, then its code and its link,
|
|
5
|
+
// one of the CLI's codes, which its tests hold these to.
|
|
5
6
|
|
|
6
7
|
// [import]
|
|
7
8
|
|
|
8
9
|
const fs = require("node:fs");
|
|
9
10
|
|
|
11
|
+
// [import]
|
|
12
|
+
|
|
13
|
+
const codes = require("./code");
|
|
14
|
+
|
|
10
15
|
// [use]
|
|
11
16
|
|
|
17
|
+
const UNEXPECTED = codes.UNEXPECTED;
|
|
12
18
|
const readFileSync = fs.readFileSync; // eslint-disable-line no-sync
|
|
13
19
|
|
|
20
|
+
// [declare]
|
|
21
|
+
|
|
22
|
+
// where each code is explained: its entry on the Errors page.
|
|
23
|
+
const ERRORS = "https://developer.arcadible.com/references/errors";
|
|
24
|
+
|
|
14
25
|
// [function]
|
|
15
26
|
|
|
16
27
|
// writes `data` to stdout, one line.
|
|
@@ -20,9 +31,11 @@ const write = function (data) {
|
|
|
20
31
|
|
|
21
32
|
// [function]
|
|
22
33
|
|
|
23
|
-
// writes `lines` to stderr,
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
// writes `lines` to stderr, closed by `code` and its link, as arc closes a
|
|
35
|
+
// failure, then exits 1.
|
|
36
|
+
const fail = function (code, ...lines) {
|
|
37
|
+
const said = lines.join("\n").trim();
|
|
38
|
+
process.stderr.write(`${said}\n\nCode: ${code}\n${ERRORS}#${code}\n`);
|
|
26
39
|
process.exit(1);
|
|
27
40
|
};
|
|
28
41
|
|
|
@@ -31,12 +44,12 @@ const fail = function (...lines) {
|
|
|
31
44
|
// the resolved manifest `arc inspect --json` wrote to `file`.
|
|
32
45
|
const readManifest = function (file) {
|
|
33
46
|
if (!file) {
|
|
34
|
-
return fail("No manifest file provided.");
|
|
47
|
+
return fail(UNEXPECTED, "No manifest file provided.");
|
|
35
48
|
}
|
|
36
49
|
try {
|
|
37
50
|
return JSON.parse(readFileSync(file, "utf8"));
|
|
38
51
|
} catch (ex) {
|
|
39
|
-
return fail(`Unable to read ${file}.`, ex.message);
|
|
52
|
+
return fail(UNEXPECTED, `Unable to read ${file}.`, ex.message);
|
|
40
53
|
}
|
|
41
54
|
};
|
|
42
55
|
|
|
@@ -47,7 +60,7 @@ const run = function (main) {
|
|
|
47
60
|
try {
|
|
48
61
|
main();
|
|
49
62
|
} catch (ex) {
|
|
50
|
-
fail(ex.message);
|
|
63
|
+
fail(UNEXPECTED, ex.message);
|
|
51
64
|
}
|
|
52
65
|
};
|
|
53
66
|
|