| @@ -1,21 +1,13 @@ |
| 1 | // @effect-diagnostics nodeBuiltinImport:off | 1 | // @effect-diagnostics nodeBuiltinImport:off |
| 2 | import { execFileSync } from "node:child_process"; | 2 | import * as NodeChildProcess from "node:child_process"; |
| 3 | import { | 3 | import * as NodeFS from "node:fs"; |
| 4 | cpSync, | 4 | import * as NodeOS from "node:os"; |
| 5 | existsSync, | 5 | import * as NodePath from "node:path"; |
| 6 | mkdirSync, | 6 | import * as NodeURL from "node:url"; |
| 7 | mkdtempSync, | | |
| 8 | readFileSync, | | |
| 9 | rmSync, | | |
| 10 | writeFileSync, | | |
| 11 | } from "node:fs"; | | |
| 12 | import { tmpdir } from "node:os"; | | |
| 13 | import { dirname, join, resolve } from "node:path"; | | |
| 14 | import { fileURLToPath } from "node:url"; | | |
| 15 | import * as Console from "effect/Console"; | 7 | import * as Console from "effect/Console"; |
| 16 | import * as Effect from "effect/Effect"; | 8 | import * as Effect from "effect/Effect"; |
| 17 | | 9 | |
| 18 | const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); | 10 | const repoRoot = NodePath.resolve(NodePath.dirname(NodeURL.fileURLToPath(import.meta.url)), ".."); |
| 19 | | 11 | |
| 20 | const workspaceFiles = [ | 12 | const workspaceFiles = [ |
| 21 | "package.json", | 13 | "package.json", |
| @@ -44,26 +36,26 @@ const workspaceFiles = [ · 22 unmodified lines |
| 44 | | 36 | |
| 45 | function copyWorkspaceManifestFixture(targetRoot: string): void { | 37 | function copyWorkspaceManifestFixture(targetRoot: string): void { |
| 46 | for (const relativePath of workspaceFiles) { | 38 | for (const relativePath of workspaceFiles) { |
| 47 | const sourcePath = resolve(repoRoot, relativePath); | 39 | const sourcePath = NodePath.resolve(repoRoot, relativePath); |
| 48 | const destinationPath = resolve(targetRoot, relativePath); | 40 | const destinationPath = NodePath.resolve(targetRoot, relativePath); |
| 49 | mkdirSync(dirname(destinationPath), { recursive: true }); | 41 | NodeFS.mkdirSync(NodePath.dirname(destinationPath), { recursive: true }); |
| 50 | cpSync(sourcePath, destinationPath); | 42 | NodeFS.cpSync(sourcePath, destinationPath); |
| 51 | } | 43 | } |
| 52 | | 44 | |
| 53 | const patchesDirectory = resolve(repoRoot, "patches"); | 45 | const patchesDirectory = NodePath.resolve(repoRoot, "patches"); |
| 54 | if (existsSync(patchesDirectory)) { | 46 | if (NodeFS.existsSync(patchesDirectory)) { |
| 55 | cpSync(patchesDirectory, resolve(targetRoot, "patches"), { recursive: true }); | 47 | NodeFS.cpSync(patchesDirectory, NodePath.resolve(targetRoot, "patches"), { recursive: true }); |
| 56 | } | 48 | } |
| 57 | } | 49 | } |
| 58 | | 50 | |
| 59 | function writeMacManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } { | 51 | function writeMacManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } { |
| 60 | const assetDirectory = resolve(targetRoot, "release-assets"); | 52 | const assetDirectory = NodePath.resolve(targetRoot, "release-assets"); |
| 61 | mkdirSync(assetDirectory, { recursive: true }); | 53 | NodeFS.mkdirSync(assetDirectory, { recursive: true }); |
| 62 | | 54 | |
| 63 | const arm64Path = resolve(assetDirectory, "latest-mac.yml"); | 55 | const arm64Path = NodePath.resolve(assetDirectory, "latest-mac.yml"); |
| 64 | const x64Path = resolve(assetDirectory, "latest-mac-x64.yml"); | 56 | const x64Path = NodePath.resolve(assetDirectory, "latest-mac-x64.yml"); |
| 65 | | 57 | |
| 66 | writeFileSync( | 58 | NodeFS.writeFileSync( |
| 67 | arm64Path, | 59 | arm64Path, |
| 68 | `version: 9.9.9-smoke.0 | 60 | `version: 9.9.9-smoke.0 |
| 69 | files: | 61 | files: |
| @@ -79,7 +71,7 @@ releaseDate: '2026-03-08T10:32:14.587Z' · 9 unmodified lines |
| 79 | `, | 71 | `, |
| 80 | ); | 72 | ); |
| 81 | | 73 | |
| 82 | writeFileSync( | 74 | NodeFS.writeFileSync( |
| 83 | x64Path, | 75 | x64Path, |
| 84 | `version: 9.9.9-smoke.0 | 76 | `version: 9.9.9-smoke.0 |
| 85 | files: | 77 | files: |
| @@ -102,13 +94,13 @@ function writeWindowsManifestFixtures( · 16 unmodified lines |
| 102 | targetRoot: string, | 94 | targetRoot: string, |
| 103 | channel: string, | 95 | channel: string, |
| 104 | ): { arm64Path: string; x64Path: string } { | 96 | ): { arm64Path: string; x64Path: string } { |
| 105 | const assetDirectory = resolve(targetRoot, "release-assets"); | 97 | const assetDirectory = NodePath.resolve(targetRoot, "release-assets"); |
| 106 | mkdirSync(assetDirectory, { recursive: true }); | 98 | NodeFS.mkdirSync(assetDirectory, { recursive: true }); |
| 107 | | 99 | |
| 108 | const arm64Path = resolve(assetDirectory, `${channel}-win-arm64.yml`); | 100 | const arm64Path = NodePath.resolve(assetDirectory, `${channel}-win-arm64.yml`); |
| 109 | const x64Path = resolve(assetDirectory, `${channel}-win-x64.yml`); | 101 | const x64Path = NodePath.resolve(assetDirectory, `${channel}-win-x64.yml`); |
| 110 | | 102 | |
| 111 | writeFileSync( | 103 | NodeFS.writeFileSync( |
| 112 | arm64Path, | 104 | arm64Path, |
| 113 | `version: 9.9.9-smoke.0 | 105 | `version: 9.9.9-smoke.0 |
| 114 | files: | 106 | files: |
| @@ -124,7 +116,7 @@ releaseDate: '2026-03-08T10:32:14.587Z' · 9 unmodified lines |
| 124 | `, | 116 | `, |
| 125 | ); | 117 | ); |
| 126 | | 118 | |
| 127 | writeFileSync( | 119 | NodeFS.writeFileSync( |
| 128 | x64Path, | 120 | x64Path, |
| 129 | `version: 9.9.9-smoke.0 | 121 | `version: 9.9.9-smoke.0 |
| 130 | files: | 122 | files: |
| @@ -147,11 +139,11 @@ function writeWindowsBuilderDebugFixtures(targetRoot: string): { · 16 unmodified lines |
| 147 | arm64Path: string; | 139 | arm64Path: string; |
| 148 | x64Path: string; | 140 | x64Path: string; |
| 149 | } { | 141 | } { |
| 150 | const assetDirectory = resolve(targetRoot, "release-assets"); | 142 | const assetDirectory = NodePath.resolve(targetRoot, "release-assets"); |
| 151 | mkdirSync(assetDirectory, { recursive: true }); | 143 | NodeFS.mkdirSync(assetDirectory, { recursive: true }); |
| 152 | | 144 | |
| 153 | const arm64Path = resolve(assetDirectory, "builder-debug-win-arm64.yml"); | 145 | const arm64Path = NodePath.resolve(assetDirectory, "builder-debug-win-arm64.yml"); |
| 154 | const x64Path = resolve(assetDirectory, "builder-debug-win-x64.yml"); | 146 | const x64Path = NodePath.resolve(assetDirectory, "builder-debug-win-x64.yml"); |
| 155 | const debugFixture = `arm64: | 147 | const debugFixture = `arm64: |
| 156 | firstOrDefaultFilePatterns: | 148 | firstOrDefaultFilePatterns: |
| 157 | - '**/*' | 149 | - '**/*' |
| @@ -160,8 +152,8 @@ nsis: · 2 unmodified lines |
| 160 | !include "example.nsh" | 152 | !include "example.nsh" |
| 161 | `; | 153 | `; |
| 162 | | 154 | |
| 163 | writeFileSync(arm64Path, debugFixture); | 155 | NodeFS.writeFileSync(arm64Path, debugFixture); |
| 164 | writeFileSync(x64Path, debugFixture); | 156 | NodeFS.writeFileSync(x64Path, debugFixture); |
| 165 | | 157 | |
| 166 | return { arm64Path, x64Path }; | 158 | return { arm64Path, x64Path }; |
| 167 | } | 159 | } |
| @@ -172,13 +164,13 @@ function assertContains(haystack: string, needle: string, message: string): void · 4 unmodified lines |
| 172 | } | 164 | } |
| 173 | | 165 | |
| 174 | function assertExists(path: string, message: string): void { | 166 | function assertExists(path: string, message: string): void { |
| 175 | if (!existsSync(path)) { | 167 | if (!NodeFS.existsSync(path)) { |
| 176 | throw new Error(message); | 168 | throw new Error(message); |
| 177 | } | 169 | } |
| 178 | } | 170 | } |
| 179 | | 171 | |
| 180 | function assertPackageVersion(path: string, version: string): void { | 172 | function assertPackageVersion(path: string, version: string): void { |
| 181 | const packageJson = JSON.parse(readFileSync(path, "utf8")) as { | 173 | const packageJson = JSON.parse(NodeFS.readFileSync(path, "utf8")) as { |
| 182 | readonly version?: unknown; | 174 | readonly version?: unknown; |
| 183 | }; | 175 | }; |
| 184 | | 176 | |
| @@ -188,20 +180,20 @@ function assertPackageVersion(path: string, version: string): void { · 3 unmodified lines |
| 188 | } | 180 | } |
| 189 | | 181 | |
| 190 | function assertMissing(path: string, message: string): void { | 182 | function assertMissing(path: string, message: string): void { |
| 191 | if (existsSync(path)) { | 183 | if (NodeFS.existsSync(path)) { |
| 192 | throw new Error(message); | 184 | throw new Error(message); |
| 193 | } | 185 | } |
| 194 | } | 186 | } |
| 195 | | 187 | |
| 196 | const tempRoot = mkdtempSync(join(tmpdir(), "t3-release-smoke-")); | 188 | const tempRoot = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-release-smoke-")); |
| 197 | | 189 | |
| 198 | try { | 190 | try { |
| 199 | copyWorkspaceManifestFixture(tempRoot); | 191 | copyWorkspaceManifestFixture(tempRoot); |
| 200 | | 192 | |
| 201 | execFileSync( | 193 | NodeChildProcess.execFileSync( |
| 202 | process.execPath, | 194 | process.execPath, |
| 203 | [ | 195 | [ |
| 204 | resolve(repoRoot, "scripts/update-release-package-versions.ts"), | 196 | NodePath.resolve(repoRoot, "scripts/update-release-package-versions.ts"), |
| 205 | "9.9.9-smoke.0", | 197 | "9.9.9-smoke.0", |
| 206 | "--root", | 198 | "--root", |
| 207 | tempRoot, | 199 | tempRoot, |
| @@ -212,14 +204,14 @@ try { · 4 unmodified lines |
| 212 | }, | 204 | }, |
| 213 | ); | 205 | ); |
| 214 | | 206 | |
| 215 | rmSync(resolve(tempRoot, "pnpm-lock.yaml"), { force: true }); | 207 | NodeFS.rmSync(NodePath.resolve(tempRoot, "pnpm-lock.yaml"), { force: true }); |
| 216 | | 208 | |
| 217 | execFileSync("vp", ["install", "--lockfile-only", "--ignore-scripts"], { | 209 | NodeChildProcess.execFileSync("vp", ["install", "--lockfile-only", "--ignore-scripts"], { |
| 218 | cwd: tempRoot, | 210 | cwd: tempRoot, |
| 219 | stdio: "inherit", | 211 | stdio: "inherit", |
| 220 | }); | 212 | }); |
| 221 | | 213 | |
| 222 | const lockfile = readFileSync(resolve(tempRoot, "pnpm-lock.yaml"), "utf8"); | 214 | const lockfile = NodeFS.readFileSync(NodePath.resolve(tempRoot, "pnpm-lock.yaml"), "utf8"); |
| 223 | assertContains(lockfile, "lockfileVersion:", "Expected pnpm-lock.yaml to be regenerated."); | 215 | assertContains(lockfile, "lockfileVersion:", "Expected pnpm-lock.yaml to be regenerated."); |
| 224 | | 216 | |
| 225 | for (const relativePath of [ | 217 | for (const relativePath of [ |
| @@ -228,13 +220,13 @@ try { · 2 unmodified lines |
| 228 | "apps/web/package.json", | 220 | "apps/web/package.json", |
| 229 | "packages/contracts/package.json", | 221 | "packages/contracts/package.json", |
| 230 | ]) { | 222 | ]) { |
| 231 | assertPackageVersion(resolve(tempRoot, relativePath), "9.9.9-smoke.0"); | 223 | assertPackageVersion(NodePath.resolve(tempRoot, relativePath), "9.9.9-smoke.0"); |
| 232 | } | 224 | } |
| 233 | | 225 | |
| 234 | const nightlyReleaseMetadata = execFileSync( | 226 | const nightlyReleaseMetadata = NodeChildProcess.execFileSync( |
| 235 | process.execPath, | 227 | process.execPath, |
| 236 | [ | 228 | [ |
| 237 | resolve(repoRoot, "scripts/resolve-nightly-release.ts"), | 229 | NodePath.resolve(repoRoot, "scripts/resolve-nightly-release.ts"), |
| 238 | "--date", | 230 | "--date", |
| 239 | "20260413", | 231 | "20260413", |
| 240 | "--run-number", | 232 | "--run-number", |
| @@ -266,10 +258,10 @@ try { · 25 unmodified lines |
| 266 | ); | 258 | ); |
| 267 | | 259 | |
| 268 | const { arm64Path, x64Path } = writeMacManifestFixtures(tempRoot); | 260 | const { arm64Path, x64Path } = writeMacManifestFixtures(tempRoot); |
| 269 | execFileSync( | 261 | NodeChildProcess.execFileSync( |
| 270 | process.execPath, | 262 | process.execPath, |
| 271 | [ | 263 | [ |
| 272 | resolve(repoRoot, "scripts/merge-update-manifests.ts"), | 264 | NodePath.resolve(repoRoot, "scripts/merge-update-manifests.ts"), |
| 273 | "--platform", | 265 | "--platform", |
| 274 | "mac", | 266 | "mac", |
| 275 | arm64Path, | 267 | arm64Path, |
| @@ -281,7 +273,7 @@ try { · 5 unmodified lines |
| 281 | }, | 273 | }, |
| 282 | ); | 274 | ); |
| 283 | | 275 | |
| 284 | const mergedManifest = readFileSync(arm64Path, "utf8"); | 276 | const mergedManifest = NodeFS.readFileSync(arm64Path, "utf8"); |
| 285 | assertContains( | 277 | assertContains( |
| 286 | mergedManifest, | 278 | mergedManifest, |
| 287 | "T3-Code-9.9.9-smoke.0-arm64.zip", | 279 | "T3-Code-9.9.9-smoke.0-arm64.zip", |
| @@ -297,21 +289,21 @@ try { · 9 unmodified lines |
| 297 | tempRoot, | 289 | tempRoot, |
| 298 | "latest", | 290 | "latest", |
| 299 | ); | 291 | ); |
| 300 | const mergedWindowsManifestPath = resolve(tempRoot, "release-assets/latest.yml"); | 292 | const mergedWindowsManifestPath = NodePath.resolve(tempRoot, "release-assets/latest.yml"); |
| 301 | const { arm64Path: nightlyWinArm64Path, x64Path: nightlyWinX64Path } = | 293 | const { arm64Path: nightlyWinArm64Path, x64Path: nightlyWinX64Path } = |
| 302 | writeWindowsManifestFixtures(tempRoot, "nightly"); | 294 | writeWindowsManifestFixtures(tempRoot, "nightly"); |
| 303 | const mergedNightlyWindowsManifestPath = resolve(tempRoot, "release-assets/nightly.yml"); | 295 | const mergedNightlyWindowsManifestPath = NodePath.resolve(tempRoot, "release-assets/nightly.yml"); |
| 304 | const { arm64Path: previewWinArm64Path, x64Path: previewWinX64Path } = | 296 | const { arm64Path: previewWinArm64Path, x64Path: previewWinX64Path } = |
| 305 | writeWindowsManifestFixtures(tempRoot, "preview"); | 297 | writeWindowsManifestFixtures(tempRoot, "preview"); |
| 306 | const mergedPreviewWindowsManifestPath = resolve(tempRoot, "release-assets/preview.yml"); | 298 | const mergedPreviewWindowsManifestPath = NodePath.resolve(tempRoot, "release-assets/preview.yml"); |
| 307 | const { arm64Path: winDebugArm64Path, x64Path: winDebugX64Path } = | 299 | const { arm64Path: winDebugArm64Path, x64Path: winDebugX64Path } = |
| 308 | writeWindowsBuilderDebugFixtures(tempRoot); | 300 | writeWindowsBuilderDebugFixtures(tempRoot); |
| 309 | execFileSync( | 301 | NodeChildProcess.execFileSync( |
| 310 | "bash", | 302 | "bash", |
| 311 | [ | 303 | [ |
| 312 | "-lc", | 304 | "-lc", |
| 313 | ` | 305 | ` |
| 314 | release_assets_dir=${JSON.stringify(resolve(tempRoot, "release-assets"))} | 306 | release_assets_dir=${JSON.stringify(NodePath.resolve(tempRoot, "release-assets"))} |
| 315 | shopt -s nullglob | 307 | shopt -s nullglob |
| 316 | found_windows_manifest=false | 308 | found_windows_manifest=false |
| 317 | for x64_manifest in "$release_assets_dir"/*-win-x64.yml; do | 309 | for x64_manifest in "$release_assets_dir"/*-win-x64.yml; do |
| @@ -327,7 +319,7 @@ try { · 9 unmodified lines |
| 327 | fi | 319 | fi |
| 328 | | 320 | |
| 329 | found_windows_manifest=true | 321 | found_windows_manifest=true |
| 330 | ${JSON.stringify(process.execPath)} ${JSON.stringify(resolve(repoRoot, "scripts/merge-update-manifests.ts"))} --platform win \ | 322 | ${JSON.stringify(process.execPath)} ${JSON.stringify(NodePath.resolve(repoRoot, "scripts/merge-update-manifests.ts"))} --platform win \ |
| 331 | "$arm64_manifest" \ | 323 | "$arm64_manifest" \ |
| 332 | "$x64_manifest" \ | 324 | "$x64_manifest" \ |
| 333 | "$output_manifest" | 325 | "$output_manifest" |
| @@ -346,7 +338,7 @@ try { · 12 unmodified lines |
| 346 | }, | 338 | }, |
| 347 | ); | 339 | ); |
| 348 | | 340 | |
| 349 | const mergedWindowsManifest = readFileSync(mergedWindowsManifestPath, "utf8"); | 341 | const mergedWindowsManifest = NodeFS.readFileSync(mergedWindowsManifestPath, "utf8"); |
| 350 | assertContains( | 342 | assertContains( |
| 351 | mergedWindowsManifest, | 343 | mergedWindowsManifest, |
| 352 | "T3-Code-9.9.9-smoke.0-arm64.exe", | 344 | "T3-Code-9.9.9-smoke.0-arm64.exe", |
| @@ -357,7 +349,10 @@ try { · 4 unmodified lines |
| 357 | "T3-Code-9.9.9-smoke.0-x64.exe", | 349 | "T3-Code-9.9.9-smoke.0-x64.exe", |
| 358 | "Merged Windows manifest is missing the x64 asset.", | 350 | "Merged Windows manifest is missing the x64 asset.", |
| 359 | ); | 351 | ); |
| 360 | const mergedNightlyWindowsManifest = readFileSync(mergedNightlyWindowsManifestPath, "utf8"); | 352 | const mergedNightlyWindowsManifest = NodeFS.readFileSync( |
| | 353 | mergedNightlyWindowsManifestPath, |
| | 354 | "utf8", |
| | 355 | ); |
| 361 | assertContains( | 356 | assertContains( |
| 362 | mergedNightlyWindowsManifest, | 357 | mergedNightlyWindowsManifest, |
| 363 | "T3-Code-9.9.9-smoke.0-arm64.exe", | 358 | "T3-Code-9.9.9-smoke.0-arm64.exe", |
| @@ -368,7 +363,10 @@ try { · 4 unmodified lines |
| 368 | "T3-Code-9.9.9-smoke.0-x64.exe", | 363 | "T3-Code-9.9.9-smoke.0-x64.exe", |
| 369 | "Merged nightly Windows manifest is missing the x64 asset.", | 364 | "Merged nightly Windows manifest is missing the x64 asset.", |
| 370 | ); | 365 | ); |
| 371 | const mergedPreviewWindowsManifest = readFileSync(mergedPreviewWindowsManifestPath, "utf8"); | 366 | const mergedPreviewWindowsManifest = NodeFS.readFileSync( |
| | 367 | mergedPreviewWindowsManifestPath, |
| | 368 | "utf8", |
| | 369 | ); |
| 372 | assertContains( | 370 | assertContains( |
| 373 | mergedPreviewWindowsManifest, | 371 | mergedPreviewWindowsManifest, |
| 374 | "T3-Code-9.9.9-smoke.0-arm64.exe", | 372 | "T3-Code-9.9.9-smoke.0-arm64.exe", |
| @@ -411,5 +409,5 @@ try { · 36 unmodified lines |
| 411 | | 409 | |
| 412 | Effect.runSync(Console.log("Release smoke checks passed.")); | 410 | Effect.runSync(Console.log("Release smoke checks passed.")); |
| 413 | } finally { | 411 | } finally { |
| 414 | rmSync(tempRoot, { recursive: true, force: true }); | 412 | NodeFS.rmSync(tempRoot, { recursive: true, force: true }); |
| 415 | } | 413 | } |