@mp-lb/arcnet 0.7.20 → 0.7.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.
- package/dist/desktop/createDesktopCommands.d.ts.map +1 -1
- package/dist/desktop/createDesktopCommands.js +14 -3
- package/dist/desktop/createDesktopCommands.js.map +1 -1
- package/dist/desktop/verifyDesktopRelease.d.ts +5 -1
- package/dist/desktop/verifyDesktopRelease.d.ts.map +1 -1
- package/dist/desktop/verifyDesktopRelease.js +16 -6
- package/dist/desktop/verifyDesktopRelease.js.map +1 -1
- package/dist/desktop/writeLinuxUpdateManifest.d.ts +10 -0
- package/dist/desktop/writeLinuxUpdateManifest.d.ts.map +1 -0
- package/dist/desktop/writeLinuxUpdateManifest.js +55 -0
- package/dist/desktop/writeLinuxUpdateManifest.js.map +1 -0
- package/docs/public/commands.md +15 -2
- package/docs/public/llms-full.txt +15 -2
- package/package.json +1 -1
- package/src/desktop/createDesktopCommands.ts +27 -5
- package/src/desktop/verifyDesktopRelease.ts +28 -11
- package/src/desktop/writeLinuxUpdateManifest.ts +77 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDesktopCommands.d.ts","sourceRoot":"","sources":["../../src/desktop/createDesktopCommands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDesktopCommands.d.ts","sourceRoot":"","sources":["../../src/desktop/createDesktopCommands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,qBAAqB,GAChC,KAAK,OAAO,EACZ,QAAQ,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,SAmClC,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { verifyDesktopRelease } from "./verifyDesktopRelease.js";
|
|
2
|
+
import { writeLinuxUpdateManifest } from "./writeLinuxUpdateManifest.js";
|
|
2
3
|
export const createDesktopCommands = (cli, output) => {
|
|
3
4
|
const desktop = cli
|
|
4
5
|
.command("desktop")
|
|
5
|
-
.description("
|
|
6
|
+
.description("Prepare and verify desktop releases.");
|
|
6
7
|
desktop
|
|
7
8
|
.command("verify")
|
|
8
|
-
.description("Verify
|
|
9
|
+
.description("Verify desktop release assets are publicly downloadable.")
|
|
9
10
|
.requiredOption("--repository <owner/repo>", "Public releases repository")
|
|
10
|
-
.
|
|
11
|
+
.option("--tag <tag>", "Verify this release tag instead of the repository latest")
|
|
12
|
+
.option("--linux", "Require DEB, RPM, and a Linux update manifest")
|
|
13
|
+
.option("--windows", "Require a Windows installer")
|
|
14
|
+
.action(async (options) => output(await verifyDesktopRelease(options.repository, options)));
|
|
15
|
+
desktop
|
|
16
|
+
.command("linux-manifest")
|
|
17
|
+
.description("Verify and combine independently generated DEB and RPM update manifests.")
|
|
18
|
+
.requiredOption("--deb <file>", "DEB installer alongside its latest-linux.yml")
|
|
19
|
+
.requiredOption("--rpm <file>", "RPM installer alongside its latest-linux.yml")
|
|
20
|
+
.requiredOption("--output <file>", "Combined update manifest to write")
|
|
21
|
+
.action(async (options) => output(await writeLinuxUpdateManifest(options)));
|
|
11
22
|
};
|
|
12
23
|
//# sourceMappingURL=createDesktopCommands.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDesktopCommands.js","sourceRoot":"","sources":["../../src/desktop/createDesktopCommands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDesktopCommands.js","sourceRoot":"","sources":["../../src/desktop/createDesktopCommands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,GAAY,EACZ,MAAiC,EACjC,EAAE;IACF,MAAM,OAAO,GAAG,GAAG;SAChB,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,sCAAsC,CAAC,CAAC;IAEvD,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,0DAA0D,CAAC;SACvE,cAAc,CAAC,2BAA2B,EAAE,4BAA4B,CAAC;SACzE,MAAM,CACL,aAAa,EACb,0DAA0D,CAC3D;SACA,MAAM,CAAC,SAAS,EAAE,+CAA+C,CAAC;SAClE,MAAM,CAAC,WAAW,EAAE,6BAA6B,CAAC;SAClD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CACxB,MAAM,CAAC,MAAM,oBAAoB,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAChE,CAAC;IAEJ,OAAO;SACJ,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CACV,0EAA0E,CAC3E;SACA,cAAc,CACb,cAAc,EACd,8CAA8C,CAC/C;SACA,cAAc,CACb,cAAc,EACd,8CAA8C,CAC/C;SACA,cAAc,CAAC,iBAAiB,EAAE,mCAAmC,CAAC;SACtE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export declare const verifyDesktopRelease: (repository: string
|
|
1
|
+
export declare const verifyDesktopRelease: (repository: string, { linux, windows, tag, }?: {
|
|
2
|
+
linux?: boolean | undefined;
|
|
3
|
+
windows?: boolean | undefined;
|
|
4
|
+
tag?: string | undefined;
|
|
5
|
+
}) => Promise<{
|
|
2
6
|
operation: string;
|
|
3
7
|
tag: string;
|
|
4
8
|
assets: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyDesktopRelease.d.ts","sourceRoot":"","sources":["../../src/desktop/verifyDesktopRelease.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"verifyDesktopRelease.d.ts","sourceRoot":"","sources":["../../src/desktop/verifyDesktopRelease.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,GAC/B,YAAY,MAAM,EAClB;;;;CAIM;;;;;EAyEP,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export const verifyDesktopRelease = async (repository) => {
|
|
2
|
+
export const verifyDesktopRelease = async (repository, { linux = false, windows = false, tag = undefined, } = {}) => {
|
|
3
3
|
z.string()
|
|
4
4
|
.regex(/^[\w.-]+\/[\w.-]+$/)
|
|
5
5
|
.parse(repository);
|
|
6
|
-
const
|
|
6
|
+
const endpoint = tag ? `tags/${encodeURIComponent(tag)}` : "latest";
|
|
7
|
+
const response = await fetch(`https://api.github.com/repos/${repository}/releases/${endpoint}`, { headers: { Accept: "application/vnd.github+json" } });
|
|
7
8
|
if (!response.ok)
|
|
8
9
|
throw new Error(`Public release is unavailable: HTTP ${response.status}.`);
|
|
9
10
|
const release = z
|
|
@@ -16,11 +17,20 @@ export const verifyDesktopRelease = async (repository) => {
|
|
|
16
17
|
})),
|
|
17
18
|
})
|
|
18
19
|
.parse(await response.json());
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
if (tag && release.tag_name !== tag)
|
|
21
|
+
throw new Error("GitHub returned an unexpected release tag.");
|
|
22
|
+
const required = [".dmg", ".zip", "latest-mac.yml"];
|
|
23
|
+
if (linux)
|
|
24
|
+
required.push(".deb", ".rpm", "latest-linux.yml");
|
|
25
|
+
if (windows)
|
|
26
|
+
required.push(".exe");
|
|
27
|
+
for (const suffix of required) {
|
|
28
|
+
if (!release.assets.some(({ name }) => suffix.startsWith(".") ? name.endsWith(suffix) : name === suffix))
|
|
29
|
+
throw new Error(`Missing release asset: ${suffix}.`);
|
|
30
|
+
}
|
|
31
|
+
const assets = release.assets.filter(({ name }) => /\.(dmg|zip|deb|rpm|exe|yml)$/.test(name));
|
|
22
32
|
for (const asset of assets) {
|
|
23
|
-
if (!asset.browser_download_url.startsWith(`https://github.com/${repository}/releases/download/`))
|
|
33
|
+
if (!asset.browser_download_url.startsWith(`https://github.com/${repository}/releases/download/${encodeURIComponent(release.tag_name)}/`))
|
|
24
34
|
throw new Error("Unexpected release asset host or repository.");
|
|
25
35
|
const download = await fetch(asset.browser_download_url, {
|
|
26
36
|
method: "HEAD",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyDesktopRelease.js","sourceRoot":"","sources":["../../src/desktop/verifyDesktopRelease.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"verifyDesktopRelease.js","sourceRoot":"","sources":["../../src/desktop/verifyDesktopRelease.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,UAAkB,EAClB,EACE,KAAK,GAAG,KAAK,EACb,OAAO,GAAG,KAAK,EACf,GAAG,GAAG,SAA+B,MACnC,EAAE,EACN,EAAE;IACF,CAAC,CAAC,MAAM,EAAE;SACP,KAAK,CAAC,oBAAoB,CAAC;SAC3B,KAAK,CAAC,UAAU,CAAC,CAAC;IAErB,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IACpE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,gCAAgC,UAAU,aAAa,QAAQ,EAAE,EACjE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,6BAA6B,EAAE,EAAE,CACvD,CAAC;IAEF,IAAI,CAAC,QAAQ,CAAC,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,uCAAuC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAE7E,MAAM,OAAO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,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IACE,CAAC,KAAK,CAAC,oBAAoB,CAAC,UAAU,CACpC,sBAAsB,UAAU,sBAAsB,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAC9F;YAED,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAElE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,oBAAoB,EAAE;YACvD,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE;YACd,MAAM,IAAI,KAAK,CACb,8BAA8B,KAAK,CAAC,IAAI,UAAU,QAAQ,CAAC,MAAM,GAAG,CACrE,CAAC;IACN,CAAC;IAED,OAAO;QACL,SAAS,EAAE,gBAAgB;QAC3B,GAAG,EAAE,OAAO,CAAC,QAAQ;QACrB,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;QACzC,OAAO,EACL,4GAA4G;KAC/G,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeLinuxUpdateManifest.d.ts","sourceRoot":"","sources":["../../src/desktop/writeLinuxUpdateManifest.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,wBAAwB,GAAU,uBAI5C;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;;;;EAgDA,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* eslint-disable import/extensions -- Node ESM requires emitted .js extensions. */
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { createReadStream } from "node:fs";
|
|
4
|
+
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import { basename, dirname, join } from "node:path";
|
|
6
|
+
import { parse, stringify } from "yaml";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
const updateFile = z.object({
|
|
9
|
+
url: z.string(),
|
|
10
|
+
size: z.number().int().positive(),
|
|
11
|
+
sha512: z.string(),
|
|
12
|
+
});
|
|
13
|
+
const updateManifest = z.object({
|
|
14
|
+
version: z.string(),
|
|
15
|
+
releaseDate: z.string(),
|
|
16
|
+
files: z.array(updateFile),
|
|
17
|
+
});
|
|
18
|
+
export const writeLinuxUpdateManifest = async ({ deb, rpm, output, }) => {
|
|
19
|
+
const readPackage = async (extension, path) => {
|
|
20
|
+
if (!path.endsWith(extension))
|
|
21
|
+
throw new Error(`Expected a ${extension} installer: ${path}`);
|
|
22
|
+
const manifest = updateManifest.parse(parse(await readFile(join(dirname(path), "latest-linux.yml"), "utf8")));
|
|
23
|
+
const name = basename(path);
|
|
24
|
+
const file = manifest.files.find(({ url }) => url === name);
|
|
25
|
+
if (!file)
|
|
26
|
+
throw new Error(`Missing update metadata for ${name}`);
|
|
27
|
+
const hash = createHash("sha512");
|
|
28
|
+
for await (const chunk of createReadStream(path))
|
|
29
|
+
hash.update(chunk);
|
|
30
|
+
if (hash.digest("base64") !== file.sha512 ||
|
|
31
|
+
(await stat(path)).size !== file.size)
|
|
32
|
+
throw new Error(`Update metadata does not match ${name}`);
|
|
33
|
+
return { manifest, file };
|
|
34
|
+
};
|
|
35
|
+
const [debian, redhat] = await Promise.all([
|
|
36
|
+
readPackage(".deb", deb),
|
|
37
|
+
readPackage(".rpm", rpm),
|
|
38
|
+
]);
|
|
39
|
+
if (debian.manifest.version !== redhat.manifest.version)
|
|
40
|
+
throw new Error("Linux installers have different versions.");
|
|
41
|
+
const files = [debian.file, redhat.file];
|
|
42
|
+
await writeFile(output, stringify({
|
|
43
|
+
version: debian.manifest.version,
|
|
44
|
+
files,
|
|
45
|
+
path: debian.file.url,
|
|
46
|
+
sha512: debian.file.sha512,
|
|
47
|
+
releaseDate: debian.manifest.releaseDate,
|
|
48
|
+
}));
|
|
49
|
+
return {
|
|
50
|
+
operation: "desktop.linux-manifest",
|
|
51
|
+
path: output,
|
|
52
|
+
assets: files.map(({ url }) => url),
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=writeLinuxUpdateManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeLinuxUpdateManifest.js","sourceRoot":"","sources":["../../src/desktop/writeLinuxUpdateManifest.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,GAAG,EACH,GAAG,EACH,MAAM,GAKP,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,K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E,GAAG,CAAC;KACzB,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,KAAK,MAAM,CAAC,QAAQ,CAAC,OAAO;QACrD,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAE/D,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzC,MAAM,SAAS,CACb,MAAM,EACN,SAAS,CAAC;QACR,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO;QAChC,KAAK;QACL,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;QACrB,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;QAC1B,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW;KACzC,CAAC,CACH,CAAC;IAEF,OAAO;QACL,SAAS,EAAE,wBAAwB;QACnC,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;KACpC,CAAC;AACJ,CAAC,CAAC"}
|
package/docs/public/commands.md
CHANGED
|
@@ -93,15 +93,28 @@ Refresh encrypted snapshots from Forum and regenerate validation CI; no decrypti
|
|
|
93
93
|
|
|
94
94
|
## `arcnet desktop`
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
Prepare and verify desktop releases.
|
|
97
97
|
|
|
98
98
|
### `arcnet desktop verify`
|
|
99
99
|
|
|
100
|
-
Verify
|
|
100
|
+
Verify desktop release assets are publicly downloadable.
|
|
101
101
|
|
|
102
102
|
| Option | Description |
|
|
103
103
|
| --- | --- |
|
|
104
104
|
| `--repository <owner/repo>` | Public releases repository |
|
|
105
|
+
| `--tag <tag>` | Verify this release tag instead of the repository latest |
|
|
106
|
+
| `--linux` | Require DEB, RPM, and a Linux update manifest |
|
|
107
|
+
| `--windows` | Require a Windows installer |
|
|
108
|
+
|
|
109
|
+
### `arcnet desktop linux-manifest`
|
|
110
|
+
|
|
111
|
+
Verify and combine independently generated DEB and RPM update manifests.
|
|
112
|
+
|
|
113
|
+
| Option | Description |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `--deb <file>` | DEB installer alongside its latest-linux.yml |
|
|
116
|
+
| `--rpm <file>` | RPM installer alongside its latest-linux.yml |
|
|
117
|
+
| `--output <file>` | Combined update manifest to write |
|
|
105
118
|
|
|
106
119
|
## `arcnet variables`
|
|
107
120
|
|
|
@@ -149,15 +149,28 @@ Refresh encrypted snapshots from Forum and regenerate validation CI; no decrypti
|
|
|
149
149
|
|
|
150
150
|
## `arcnet desktop`
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
Prepare and verify desktop releases.
|
|
153
153
|
|
|
154
154
|
### `arcnet desktop verify`
|
|
155
155
|
|
|
156
|
-
Verify
|
|
156
|
+
Verify desktop release assets are publicly downloadable.
|
|
157
157
|
|
|
158
158
|
| Option | Description |
|
|
159
159
|
| --- | --- |
|
|
160
160
|
| `--repository <owner/repo>` | Public releases repository |
|
|
161
|
+
| `--tag <tag>` | Verify this release tag instead of the repository latest |
|
|
162
|
+
| `--linux` | Require DEB, RPM, and a Linux update manifest |
|
|
163
|
+
| `--windows` | Require a Windows installer |
|
|
164
|
+
|
|
165
|
+
### `arcnet desktop linux-manifest`
|
|
166
|
+
|
|
167
|
+
Verify and combine independently generated DEB and RPM update manifests.
|
|
168
|
+
|
|
169
|
+
| Option | Description |
|
|
170
|
+
| --- | --- |
|
|
171
|
+
| `--deb <file>` | DEB installer alongside its latest-linux.yml |
|
|
172
|
+
| `--rpm <file>` | RPM installer alongside its latest-linux.yml |
|
|
173
|
+
| `--output <file>` | Combined update manifest to write |
|
|
161
174
|
|
|
162
175
|
## `arcnet variables`
|
|
163
176
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/* eslint-disable import/extensions -- Node ESM requires emitted .js extensions. */
|
|
1
2
|
import { Command } from "commander";
|
|
2
3
|
import { verifyDesktopRelease } from "./verifyDesktopRelease.js";
|
|
4
|
+
import { writeLinuxUpdateManifest } from "./writeLinuxUpdateManifest.js";
|
|
3
5
|
|
|
4
6
|
export const createDesktopCommands = (
|
|
5
7
|
cli: Command,
|
|
@@ -7,15 +9,35 @@ export const createDesktopCommands = (
|
|
|
7
9
|
) => {
|
|
8
10
|
const desktop = cli
|
|
9
11
|
.command("desktop")
|
|
10
|
-
.description("
|
|
12
|
+
.description("Prepare and verify desktop releases.");
|
|
11
13
|
|
|
12
14
|
desktop
|
|
13
15
|
.command("verify")
|
|
14
|
-
.description(
|
|
15
|
-
"Verify the latest DMG, ZIP, and update manifest are publicly downloadable.",
|
|
16
|
-
)
|
|
16
|
+
.description("Verify desktop release assets are publicly downloadable.")
|
|
17
17
|
.requiredOption("--repository <owner/repo>", "Public releases repository")
|
|
18
|
+
.option(
|
|
19
|
+
"--tag <tag>",
|
|
20
|
+
"Verify this release tag instead of the repository latest",
|
|
21
|
+
)
|
|
22
|
+
.option("--linux", "Require DEB, RPM, and a Linux update manifest")
|
|
23
|
+
.option("--windows", "Require a Windows installer")
|
|
18
24
|
.action(async (options) =>
|
|
19
|
-
output(await verifyDesktopRelease(options.repository)),
|
|
25
|
+
output(await verifyDesktopRelease(options.repository, options)),
|
|
20
26
|
);
|
|
27
|
+
|
|
28
|
+
desktop
|
|
29
|
+
.command("linux-manifest")
|
|
30
|
+
.description(
|
|
31
|
+
"Verify and combine independently generated DEB and RPM update manifests.",
|
|
32
|
+
)
|
|
33
|
+
.requiredOption(
|
|
34
|
+
"--deb <file>",
|
|
35
|
+
"DEB installer alongside its latest-linux.yml",
|
|
36
|
+
)
|
|
37
|
+
.requiredOption(
|
|
38
|
+
"--rpm <file>",
|
|
39
|
+
"RPM installer alongside its latest-linux.yml",
|
|
40
|
+
)
|
|
41
|
+
.requiredOption("--output <file>", "Combined update manifest to write")
|
|
42
|
+
.action(async (options) => output(await writeLinuxUpdateManifest(options)));
|
|
21
43
|
};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
export const verifyDesktopRelease = async (
|
|
3
|
+
export const verifyDesktopRelease = async (
|
|
4
|
+
repository: string,
|
|
5
|
+
{
|
|
6
|
+
linux = false,
|
|
7
|
+
windows = false,
|
|
8
|
+
tag = undefined as string | undefined,
|
|
9
|
+
} = {},
|
|
10
|
+
) => {
|
|
4
11
|
z.string()
|
|
5
12
|
.regex(/^[\w.-]+\/[\w.-]+$/)
|
|
6
13
|
.parse(repository);
|
|
7
14
|
|
|
15
|
+
const endpoint = tag ? `tags/${encodeURIComponent(tag)}` : "latest";
|
|
8
16
|
const response = await fetch(
|
|
9
|
-
`https://api.github.com/repos/${repository}/releases
|
|
17
|
+
`https://api.github.com/repos/${repository}/releases/${endpoint}`,
|
|
10
18
|
{ headers: { Accept: "application/vnd.github+json" } },
|
|
11
19
|
);
|
|
12
20
|
|
|
@@ -26,21 +34,30 @@ export const verifyDesktopRelease = async (repository: string) => {
|
|
|
26
34
|
})
|
|
27
35
|
.parse(await response.json());
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
if (tag && release.tag_name !== tag)
|
|
38
|
+
throw new Error("GitHub returned an unexpected release tag.");
|
|
39
|
+
|
|
40
|
+
const required = [".dmg", ".zip", "latest-mac.yml"];
|
|
41
|
+
if (linux) required.push(".deb", ".rpm", "latest-linux.yml");
|
|
42
|
+
if (windows) required.push(".exe");
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
assets.some((
|
|
44
|
+
for (const suffix of required) {
|
|
45
|
+
if (
|
|
46
|
+
!release.assets.some(({ name }) =>
|
|
47
|
+
suffix.startsWith(".") ? name.endsWith(suffix) : name === suffix,
|
|
48
|
+
)
|
|
36
49
|
)
|
|
37
|
-
|
|
38
|
-
|
|
50
|
+
throw new Error(`Missing release asset: ${suffix}.`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const assets = release.assets.filter(({ name }) =>
|
|
54
|
+
/\.(dmg|zip|deb|rpm|exe|yml)$/.test(name),
|
|
55
|
+
);
|
|
39
56
|
|
|
40
57
|
for (const asset of assets) {
|
|
41
58
|
if (
|
|
42
59
|
!asset.browser_download_url.startsWith(
|
|
43
|
-
`https://github.com/${repository}/releases/download/`,
|
|
60
|
+
`https://github.com/${repository}/releases/download/${encodeURIComponent(release.tag_name)}/`,
|
|
44
61
|
)
|
|
45
62
|
)
|
|
46
63
|
throw new Error("Unexpected release asset host or repository.");
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* eslint-disable import/extensions -- Node ESM requires emitted .js extensions. */
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { createReadStream } from "node:fs";
|
|
4
|
+
import { readFile, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import { basename, dirname, join } from "node:path";
|
|
6
|
+
import { parse, stringify } from "yaml";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
const updateFile = z.object({
|
|
10
|
+
url: z.string(),
|
|
11
|
+
size: z.number().int().positive(),
|
|
12
|
+
sha512: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const updateManifest = z.object({
|
|
16
|
+
version: z.string(),
|
|
17
|
+
releaseDate: z.string(),
|
|
18
|
+
files: z.array(updateFile),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const writeLinuxUpdateManifest = async ({
|
|
22
|
+
deb,
|
|
23
|
+
rpm,
|
|
24
|
+
output,
|
|
25
|
+
}: {
|
|
26
|
+
deb: string;
|
|
27
|
+
rpm: string;
|
|
28
|
+
output: string;
|
|
29
|
+
}) => {
|
|
30
|
+
const readPackage = async (extension: string, path: string) => {
|
|
31
|
+
if (!path.endsWith(extension))
|
|
32
|
+
throw new Error(`Expected a ${extension} installer: ${path}`);
|
|
33
|
+
|
|
34
|
+
const manifest = updateManifest.parse(
|
|
35
|
+
parse(await readFile(join(dirname(path), "latest-linux.yml"), "utf8")),
|
|
36
|
+
);
|
|
37
|
+
const name = basename(path);
|
|
38
|
+
const file = manifest.files.find(({ url }) => url === name);
|
|
39
|
+
if (!file) throw new Error(`Missing update metadata for ${name}`);
|
|
40
|
+
|
|
41
|
+
const hash = createHash("sha512");
|
|
42
|
+
for await (const chunk of createReadStream(path)) hash.update(chunk);
|
|
43
|
+
if (
|
|
44
|
+
hash.digest("base64") !== file.sha512 ||
|
|
45
|
+
(await stat(path)).size !== file.size
|
|
46
|
+
)
|
|
47
|
+
throw new Error(`Update metadata does not match ${name}`);
|
|
48
|
+
|
|
49
|
+
return { manifest, file };
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const [debian, redhat] = await Promise.all([
|
|
53
|
+
readPackage(".deb", deb),
|
|
54
|
+
readPackage(".rpm", rpm),
|
|
55
|
+
]);
|
|
56
|
+
if (debian.manifest.version !== redhat.manifest.version)
|
|
57
|
+
throw new Error("Linux installers have different versions.");
|
|
58
|
+
|
|
59
|
+
const files = [debian.file, redhat.file];
|
|
60
|
+
|
|
61
|
+
await writeFile(
|
|
62
|
+
output,
|
|
63
|
+
stringify({
|
|
64
|
+
version: debian.manifest.version,
|
|
65
|
+
files,
|
|
66
|
+
path: debian.file.url,
|
|
67
|
+
sha512: debian.file.sha512,
|
|
68
|
+
releaseDate: debian.manifest.releaseDate,
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
operation: "desktop.linux-manifest",
|
|
74
|
+
path: output,
|
|
75
|
+
assets: files.map(({ url }) => url),
|
|
76
|
+
};
|
|
77
|
+
};
|