Open History to see the last commit
1import { execFileSync } from "node:child_process";
2import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3import { tmpdir } from "node:os";
4import { dirname, join, resolve } from "node:path";
5import { fileURLToPath } from "node:url";
6
7const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
8
9const workspaceFiles = [
10 "package.json",
11 "bun.lock",
12 "apps/server/package.json",
13 "apps/desktop/package.json",
14 "apps/web/package.json",
15 "apps/marketing/package.json",
16 "packages/client-runtime/package.json",
17 "packages/contracts/package.json",
18 "packages/shared/package.json",
19 "scripts/package.json",
20] as const;
21
22function copyWorkspaceManifestFixture(targetRoot: string): void {
23 for (const relativePath of workspaceFiles) {
24 const sourcePath = resolve(repoRoot, relativePath);
25 const destinationPath = resolve(targetRoot, relativePath);
26 mkdirSync(dirname(destinationPath), { recursive: true });
27 cpSync(sourcePath, destinationPath);
28 }
29}
30
31function writeMacManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } {
32 const assetDirectory = resolve(targetRoot, "release-assets");
33 mkdirSync(assetDirectory, { recursive: true });
34
35 const arm64Path = resolve(assetDirectory, "latest-mac.yml");
36 const x64Path = resolve(assetDirectory, "latest-mac-x64.yml");
37
38 writeFileSync(
39 arm64Path,
40 `version: 9.9.9-smoke.0
41files:
42 - url: T3-Code-9.9.9-smoke.0-arm64.zip
43 sha512: arm64zip
44 size: 125621344
45 - url: T3-Code-9.9.9-smoke.0-arm64.dmg
46 sha512: arm64dmg
47 size: 131754935
48path: T3-Code-9.9.9-smoke.0-arm64.zip
49sha512: arm64zip
50releaseDate: '2026-03-08T10:32:14.587Z'
51`,
52 );
53
54 writeFileSync(
55 x64Path,
56 `version: 9.9.9-smoke.0
57files:
58 - url: T3-Code-9.9.9-smoke.0-x64.zip
59 sha512: x64zip
60 size: 132000112
61 - url: T3-Code-9.9.9-smoke.0-x64.dmg
62 sha512: x64dmg
63 size: 138148807
64path: T3-Code-9.9.9-smoke.0-x64.zip
65sha512: x64zip
66releaseDate: '2026-03-08T10:36:07.540Z'
67`,
68 );
69
70 return { arm64Path, x64Path };
71}
72
73function assertContains(haystack: string, needle: string, message: string): void {
74 if (!haystack.includes(needle)) {
75 throw new Error(message);
76 }
77}
78
79const tempRoot = mkdtempSync(join(tmpdir(), "t3-release-smoke-"));
80
81try {
82 copyWorkspaceManifestFixture(tempRoot);
83
84 execFileSync(
85 process.execPath,
86 [
87 resolve(repoRoot, "scripts/update-release-package-versions.ts"),
88 "9.9.9-smoke.0",
89 "--root",
90 tempRoot,
91 ],
92 {
93 cwd: repoRoot,
94 stdio: "inherit",
95 },
96 );
97
98 execFileSync("bun", ["install", "--lockfile-only", "--ignore-scripts"], {
99 cwd: tempRoot,
100 stdio: "inherit",
101 });
102
103 const lockfile = readFileSync(resolve(tempRoot, "bun.lock"), "utf8");
104 assertContains(
105 lockfile,
106 `"version": "9.9.9-smoke.0"`,
107 "Expected bun.lock to contain the smoke version.",
108 );
109
110 const { arm64Path, x64Path } = writeMacManifestFixtures(tempRoot);
111 execFileSync(
112 process.execPath,
113 [resolve(repoRoot, "scripts/merge-mac-update-manifests.ts"), arm64Path, x64Path],
114 {
115 cwd: repoRoot,
116 stdio: "inherit",
117 },
118 );
119
120 const mergedManifest = readFileSync(arm64Path, "utf8");
121 assertContains(
122 mergedManifest,
123 "T3-Code-9.9.9-smoke.0-arm64.zip",
124 "Merged manifest is missing the arm64 asset.",
125 );
126 assertContains(
127 mergedManifest,
128 "T3-Code-9.9.9-smoke.0-x64.zip",
129 "Merged manifest is missing the x64 asset.",
130 );
131
132 console.log("Release smoke checks passed.");
133} finally {
134 rmSync(tempRoot, { recursive: true, force: true });
135}