The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 22:00 UTC
fix(desktop): align bundled versions with the artifact version (#12768)
Co-authored-by: Rohan Patnaik <rohan-patnaik@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Rohan Patnaik committed
Oct 20, 2026 at 10:38 UTC
310f80ffc4226d4b978e201605f74c20c6d9ae04
2 files changed
+414
-10
scripts/build-desktop-artifact.test.ts
+277
@@ -6,16 +6,23 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
6
import { extractFile } from "@electron/asar";
7
import { assert, it } from "@effect/vitest";
8
import * as ConfigProvider from "effect/ConfigProvider";
9
+import * as Deferred from "effect/Deferred";
10
+import * as Fiber from "effect/Fiber";
11
+import * as Exit from "effect/Exit";
12
import * as FileSystem from "effect/FileSystem";
13
import * as Effect from "effect/Effect";
14
import * as Layer from "effect/Layer";
15
+import * as PlatformError from "effect/PlatformError";
16
import * as Option from "effect/Option";
17
import * as Path from "effect/Path";
18
import * as Sink from "effect/Sink";
19
+import * as Schema from "effect/Schema";
20
import * as Stream from "effect/Stream";
21
import { ChildProcess, ChildProcessSpawner } from "effect/process";
22
23
import {
24
+ buildDesktopBundles,
25
+ DesktopBuildManifestRestoreError,
26
BundleNotSelfContainedError,
27
BuildCommandFailedError,
28
parseWslRuntimeArchiveMembers,
@@ -94,10 +101,19 @@ import {
101
WslRuntimeArchiveMissingError,
102
wslRuntimeArchiveStem,
103
} from "./build-desktop-artifact.ts";
104
+import {
105
+ ReleasePackageManifestError,
106
+ releasePackageFiles,
107
+} from "./update-release-package-versions.ts";
108
import { BRAND_ASSET_PATHS } from "./lib/brand-assets.ts";
109
import * as HostProcess from "@t3tools/shared/HostProcess";
110
import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
111
112
+const encodeModuleUrl = Schema.encodeEffect(Schema.fromJsonString(Schema.String));
113
+const decodePackageVersion = Schema.decodeUnknownEffect(
114
+ Schema.fromJsonString(Schema.Struct({ version: Schema.String })),
115
+);
116
+
117
// Keeps pnpm from auto-installing TypeScript, a types-only peer, into the app.
118
const stagePackageExtensions = {
119
"electron-webauthn": { peerDependenciesMeta: { typescript: { optional: true } } },
@@ -262,6 +278,267 @@ const makeWindowsPayloadFixture = Effect.fn("test.makeWindowsPayloadFixture")(fu
278
});
279
280
it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
281
+ it.effect("rejects overlapping builds from another process until restoration finishes", () =>
282
+ Effect.gen(function* () {
283
+ const fs = yield* FileSystem.FileSystem;
284
+ const path = yield* Path.Path;
285
+ const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-concurrent-build-" });
286
+ yield* fs.writeFileString(
287
+ path.join(root, "package.json"),
288
+ '{ "scripts": { "build:desktop": "node build.cjs" } }',
289
+ );
290
+ const original = '{ "version": "0.0.42", "private": true }\n';
291
+ for (const relativePath of releasePackageFiles) {
292
+ const filePath = path.join(root, relativePath);
293
+ yield* fs.makeDirectory(path.dirname(filePath), { recursive: true });
294
+ yield* fs.writeFileString(filePath, original);
295
+ }
296
+ yield* fs.writeFileString(
297
+ path.join(root, "build.cjs"),
298
+ `require("node:fs").writeFileSync("version.txt", require("./apps/server/package.json").version);`,
299
+ );
300
+ const restoring = yield* Deferred.make<void>();
301
+ const resume = yield* Deferred.make<void>();
302
+ const contenderPath = path.join(root, "contender.mjs");
303
+ yield* fs.writeFileString(
304
+ contenderPath,
305
+ `import * as Effect from ${yield* encodeModuleUrl(import.meta.resolve("effect/Effect"))};
306
+ import * as NodeServices from ${yield* encodeModuleUrl(import.meta.resolve("@effect/platform-node/NodeServices"))};
307
+ import { buildDesktopBundles } from ${yield* encodeModuleUrl(import.meta.resolve("./build-desktop-artifact.ts"))};
308
+ const result = await Effect.runPromise(buildDesktopBundles(process.argv[2], "0.0.44", false).pipe(
309
+ Effect.as("success"), Effect.catch(error => Effect.succeed(error._tag)),
310
+ Effect.scoped, Effect.provide(NodeServices.layer)));
311
+ process.stdout.write(result);`,
312
+ );
313
+ const first = yield* Effect.forkChild(
314
+ Effect.exit(buildDesktopBundles(root, "0.0.43", false)).pipe(
315
+ Effect.provideService(FileSystem.FileSystem, {
316
+ ...fs,
317
+ writeFileString: (filePath, contents, options) =>
318
+ filePath === path.join(root, releasePackageFiles[0]) && contents === original
319
+ ? Deferred.succeed(restoring, undefined).pipe(
320
+ Effect.andThen(Deferred.await(resume)),
321
+ Effect.andThen(fs.writeFileString(filePath, contents, options)),
322
+ )
323
+ : fs.writeFileString(filePath, contents, options),
324
+ }),
325
+ ),
326
+ );
327
+ yield* Deferred.await(restoring);
328
+ yield* Effect.gen(function* () {
329
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
330
+ const child = yield* spawner.spawn(
331
+ ChildProcess.make(process.execPath, [contenderPath, root]),
332
+ );
333
+ const [stdout, stderr, exitCode] = yield* Effect.all(
334
+ [
335
+ child.stdout.pipe(Stream.decodeText, Stream.mkString),
336
+ child.stderr.pipe(Stream.decodeText, Stream.mkString),
337
+ child.exitCode,
338
+ ],
339
+ { concurrency: "unbounded" },
340
+ );
341
+ assert.equal(Number(exitCode), 0, stderr);
342
+ assert.equal(stdout, "DesktopBuildAlreadyRunningError");
343
+ }).pipe(Effect.ensuring(Deferred.succeed(resume, undefined)));
344
+ const firstExit = yield* Fiber.join(first);
345
+ assert.isTrue(Exit.isSuccess(firstExit));
346
+ assert.equal(yield* fs.readFileString(path.join(root, "version.txt")), "0.0.43");
347
+ for (const relativePath of releasePackageFiles) {
348
+ assert.equal(yield* fs.readFileString(path.join(root, relativePath)), original);
349
+ }
350
+ yield* buildDesktopBundles(root, "0.0.44", false);
351
+ assert.equal(yield* fs.readFileString(path.join(root, "version.txt")), "0.0.44");
352
+ for (const relativePath of releasePackageFiles) {
353
+ assert.equal(yield* fs.readFileString(path.join(root, relativePath)), original);
354
+ }
355
+ }),
356
+ );
357
+
358
+ it.effect("restores manifests and releases the checkout lock after interruption", () =>
359
+ Effect.gen(function* () {
360
+ const fs = yield* FileSystem.FileSystem;
361
+ const path = yield* Path.Path;
362
+ const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-interrupted-build-" });
363
+ const original = '{ "version": "0.0.42", "private": true }\n';
364
+ for (const relativePath of releasePackageFiles) {
365
+ const filePath = path.join(root, relativePath);
366
+ yield* fs.makeDirectory(path.dirname(filePath), { recursive: true });
367
+ yield* fs.writeFileString(filePath, original);
368
+ }
369
+ const started = yield* Deferred.make<void>();
370
+ const childStopped = yield* Deferred.make<{ lockExists: boolean; version: string }>();
371
+ const build = yield* Effect.forkChild(
372
+ buildDesktopBundles(root, "0.0.43", false).pipe(
373
+ Effect.provideService(
374
+ ChildProcessSpawner.ChildProcessSpawner,
375
+ ChildProcessSpawner.make(() =>
376
+ Effect.acquireRelease(
377
+ Effect.succeed({ ...mockProcess(0), exitCode: Effect.never }).pipe(
378
+ Effect.tap(() => Deferred.succeed(started, undefined)),
379
+ ),
380
+ () =>
381
+ Effect.gen(function* () {
382
+ const lockExists = yield* fs.exists(path.join(root, ".desktop-build.lock"));
383
+ const manifest = yield* decodePackageVersion(
384
+ yield* fs.readFileString(path.join(root, releasePackageFiles[0])),
385
+ );
386
+ yield* Deferred.succeed(childStopped, {
387
+ lockExists,
388
+ version: manifest.version,
389
+ });
390
+ }).pipe(Effect.orDie),
391
+ ),
392
+ ),
393
+ ),
394
+ Effect.scoped,
395
+ ),
396
+ );
397
+ yield* Deferred.await(started);
398
+ const aligned = yield* decodePackageVersion(
399
+ yield* fs.readFileString(path.join(root, releasePackageFiles[0])),
400
+ );
401
+ assert.equal(aligned.version, "0.0.43");
402
+ yield* Fiber.interrupt(build);
403
+ assert.deepEqual(yield* Deferred.await(childStopped), {
404
+ lockExists: true,
405
+ version: "0.0.43",
406
+ });
407
+ assert.isFalse(yield* fs.exists(path.join(root, ".desktop-build.lock")));
408
+ for (const relativePath of releasePackageFiles) {
409
+ assert.equal(yield* fs.readFileString(path.join(root, relativePath)), original);
410
+ }
411
+ yield* buildDesktopBundles(root, "0.0.44", false).pipe(
412
+ Effect.provideService(
413
+ ChildProcessSpawner.ChildProcessSpawner,
414
+ ChildProcessSpawner.make(() => Effect.succeed(mockProcess(0))),
415
+ ),
416
+ );
417
+ assert.isFalse(yield* fs.exists(path.join(root, ".desktop-build.lock")));
418
+ }),
419
+ );
420
+
421
+ it.effect(
422
+ "builds web, server and desktop with the resolved version, restores changed manifests and preserves edits to matching ones",
423
+ () =>
424
+ Effect.gen(function* () {
425
+ const fs = yield* FileSystem.FileSystem;
426
+ const path = yield* Path.Path;
427
+ const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-desktop-build-version-" });
428
+ const packageJson = `{
429
+ "name": "desktop-version-fixture",
430
+ "version": "0.0.42",
431
+ "scripts": { "build:desktop": "node build.cjs" }
432
+ }`;
433
+ yield* fs.writeFileString(path.join(root, "package.json"), packageJson);
434
+ const version = "0.0.43-nightly.20260920.2018";
435
+ const matchingPath = "packages/contracts/package.json";
436
+ const originals = releasePackageFiles.map((relativePath, index) => ({
437
+ relativePath,
438
+ contents: `{ "version": "${relativePath === matchingPath ? version : `0.0.${index + 1}`}", "name": "${relativePath}" }\r\n`,
439
+ }));
440
+ const afterBuild = originals.map(({ relativePath, contents }) => ({
441
+ relativePath,
442
+ contents:
443
+ relativePath === matchingPath
444
+ ? `${JSON.stringify({ version, name: matchingPath, description: "edited during compilation" })}\n`
445
+ : contents,
446
+ }));
447
+ for (const { relativePath, contents } of originals) {
448
+ const filePath = path.join(root, relativePath);
449
+ yield* fs.makeDirectory(path.dirname(filePath), { recursive: true });
450
+ yield* fs.writeFileString(filePath, contents);
451
+ }
452
+ yield* fs.writeFileString(
453
+ path.join(root, "build.cjs"),
454
+ `require("node:fs").writeFileSync("version.txt", [
455
+ process.env.APP_VERSION,
456
+ require("./apps/web/package.json").version,
457
+ require("./apps/server/package.json").version,
458
+ require("./apps/desktop/package.json").version
459
+ ].join("\\n"));
460
+ const manifest = require("./${matchingPath}");
461
+ manifest.description = "edited during compilation";
462
+ require("node:fs").writeFileSync("${matchingPath}", JSON.stringify(manifest) + "\\n");`,
463
+ );
464
+ yield* buildDesktopBundles(root, version, false);
465
+ assert.equal(
466
+ yield* fs.readFileString(path.join(root, "version.txt")),
467
+ [version, version, version, version].join("\n"),
468
+ );
469
+ for (const { relativePath, contents } of afterBuild) {
470
+ assert.equal(yield* fs.readFileString(path.join(root, relativePath)), contents);
471
+ }
472
+ assert.equal(yield* fs.readFileString(path.join(root, "package.json")), packageJson);
473
+ yield* fs.writeFileString(path.join(root, "build.cjs"), "process.exit(1);");
474
+ const failure = yield* Effect.flip(buildDesktopBundles(root, "0.0.44", false));
475
+ assert.instanceOf(failure, BuildCommandFailedError);
476
+ for (const { relativePath, contents } of afterBuild) {
477
+ assert.equal(yield* fs.readFileString(path.join(root, relativePath)), contents);
478
+ }
479
+ const invalidPath = releasePackageFiles[releasePackageFiles.length - 1]!;
480
+ yield* fs.writeFileString(path.join(root, invalidPath), "invalid manifest");
481
+ // A successful child would leave a marker if partial alignment accidentally starts it.
482
+ yield* fs.writeFileString(
483
+ path.join(root, "build.cjs"),
484
+ 'require("node:fs").writeFileSync("unexpected-build.txt", "started");',
485
+ );
486
+ const alignmentFailure = yield* Effect.flip(buildDesktopBundles(root, "0.0.44", false));
487
+ assert.instanceOf(alignmentFailure, ReleasePackageManifestError);
488
+ for (const { relativePath, contents } of afterBuild) {
489
+ assert.equal(
490
+ yield* fs.readFileString(path.join(root, relativePath)),
491
+ relativePath === invalidPath ? "invalid manifest" : contents,
492
+ );
493
+ }
494
+ assert.isFalse(yield* fs.exists(path.join(root, "unexpected-build.txt")));
495
+ assert.isFalse(yield* fs.exists(path.join(root, ".desktop-build.lock")));
496
+ assert.equal(yield* fs.readFileString(path.join(root, "package.json")), packageJson);
497
+ }),
498
+ );
499
+
500
+ it.effect("reports a restore failure while still restoring the remaining manifests", () =>
501
+ Effect.gen(function* () {
502
+ const fs = yield* FileSystem.FileSystem;
503
+ const path = yield* Path.Path;
504
+ const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-manifest-restore-failure-" });
505
+ yield* fs.writeFileString(
506
+ path.join(root, "package.json"),
507
+ `{
508
+ "name": "restore-fixture", "scripts": { "build:desktop": "node build.cjs" }
509
+ }`,
510
+ );
511
+ yield* fs.writeFileString(path.join(root, "build.cjs"), "process.exit(0);");
512
+ const original = '{ "version": "0.0.42" }\n';
513
+ for (const relativePath of releasePackageFiles) {
514
+ const filePath = path.join(root, relativePath);
515
+ yield* fs.makeDirectory(path.dirname(filePath), { recursive: true });
516
+ yield* fs.writeFileString(filePath, original);
517
+ }
518
+ const failedPath = path.join(root, releasePackageFiles[0]);
519
+ const writeFailure = PlatformError.systemError({
520
+ _tag: "PermissionDenied",
521
+ module: "FileSystem",
522
+ method: "writeFileString",
523
+ pathOrDescriptor: failedPath,
524
+ });
525
+ const failure = yield* Effect.flip(buildDesktopBundles(root, "0.0.43", false)).pipe(
526
+ Effect.provideService(FileSystem.FileSystem, {
527
+ ...fs,
528
+ writeFileString: (filePath, contents, options) =>
529
+ filePath === failedPath && contents === original
530
+ ? Effect.fail(writeFailure)
531
+ : fs.writeFileString(filePath, contents, options),
532
+ }),
533
+ );
534
+ assert.instanceOf(failure, DesktopBuildManifestRestoreError);
535
+ assert.notEqual(yield* fs.readFileString(failedPath), original);
536
+ for (const relativePath of releasePackageFiles.slice(1)) {
537
+ assert.equal(yield* fs.readFileString(path.join(root, relativePath)), original);
538
+ }
539
+ }),
540
+ );
541
+
542
it("resolves the dedicated nightly updater channel from nightly versions", () => {
543
assert.equal(resolveDesktopUpdateChannel("0.0.17-nightly.20260413.42"), "nightly");
544
assert.equal(resolveDesktopUpdateChannel("0.0.17"), "latest");
scripts/build-desktop-artifact.ts
+137
-10
@@ -24,6 +24,11 @@ import desktopPackageJson from "../apps/desktop/package.json" with { type: "json
24
import gnomeCaptureBundle from "../apps/desktop/gnome-extension/bundle.json" with { type: "json" };
25
import serverPackageJson from "../apps/server/package.json" with { type: "json" };
26
27
+import {
28
+ ReleasePackageManifestError,
29
+ releasePackageFiles,
30
+ updateReleasePackageVersions,
31
+} from "./update-release-package-versions.ts";
32
import { applyWebBrandAssets } from "./apply-web-brand-assets.ts";
33
import {
34
BRAND_ASSET_PATHS,
@@ -44,6 +49,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
49
import * as Config from "effect/Config";
50
import * as Duration from "effect/Duration";
51
import * as Effect from "effect/Effect";
52
+import * as Exit from "effect/Exit";
53
import * as FileSystem from "effect/FileSystem";
54
import * as Layer from "effect/Layer";
55
import * as Logger from "effect/Logger";
@@ -108,6 +114,9 @@ const RepoRoot = Effect.service(Path.Path).pipe(
114
Effect.flatMap((path) => path.fromFileUrl(new URL("..", import.meta.url))),
115
);
116
const encodeJsonString = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
117
+const decodeReleasePackageManifest = Schema.decodeEffect(
118
+ Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown)),
119
+);
120
const decodeWorkspaceConfig = Schema.decodeEffect(fromYaml(WorkspaceConfig));
121
const encodeStageWorkspaceConfig = Schema.encodeEffect(fromYaml(StageWorkspaceConfig));
122
@@ -302,6 +311,15 @@ export class InvalidMockUpdateServerPortError extends Schema.TaggedError<Invalid
311
}
312
}
313
314
+export class DesktopBuildManifestRestoreError extends Schema.TaggedError<DesktopBuildManifestRestoreError>()(
315
+ "DesktopBuildManifestRestoreError",
316
+ { failures: Schema.Array(ReleasePackageManifestError) },
317
+) {
318
+ override get message(): string {
319
+ return `Failed to restore release manifests: ${this.failures.map((failure) => failure.filePath).join(", ")}`;
320
+ }
321
+}
322
+
323
export class BuildCommandFailedError extends Schema.TaggedError<BuildCommandFailedError>()(
324
"BuildCommandFailedError",
325
{
@@ -1793,6 +1811,113 @@ const runCommand = Effect.fn("runCommand")(function* (
1811
}
1812
});
1813
1814
+export class DesktopBuildAlreadyRunningError extends Schema.TaggedError<DesktopBuildAlreadyRunningError>()(
1815
+ "DesktopBuildAlreadyRunningError",
1816
+ { lockPath: Schema.String },
1817
+) {
1818
+ override get message(): string {
1819
+ return `Another desktop build owns '${this.lockPath}'. Wait for it to finish. If a build was killed, confirm no desktop build is running, inspect and restore any changed release manifests, then remove this lock.`;
1820
+ }
1821
+}
1822
+
1823
+const withDesktopBuildLock = Effect.fn("withDesktopBuildLock")(function* <A, E, R>(
1824
+ repoRoot: string,
1825
+ build: Effect.Effect<A, E, R>,
1826
+) {
1827
+ const fs = yield* FileSystem.FileSystem;
1828
+ const path = yield* Path.Path;
1829
+ const lockPath = path.join(repoRoot, ".desktop-build.lock");
1830
+ return yield* Effect.acquireUseRelease(
1831
+ fs
1832
+ .makeDirectory(lockPath)
1833
+ .pipe(
1834
+ Effect.mapError((error) =>
1835
+ error.reason._tag === "AlreadyExists"
1836
+ ? new DesktopBuildAlreadyRunningError({ lockPath })
1837
+ : error,
1838
+ ),
1839
+ ),
1840
+ // Stop packaging children and finish stage cleanup before another build can enter.
1841
+ () => build.pipe(Effect.scoped),
1842
+ (_, exit) =>
1843
+ fs
1844
+ .remove(lockPath, { recursive: true })
1845
+ .pipe(
1846
+ Effect.catch((error) =>
1847
+ Exit.isFailure(exit) ? Effect.logError(error) : Effect.fail(error),
1848
+ ),
1849
+ ),
1850
+ );
1851
+});
1852
+
1853
+// The artifact entry point holds the checkout lock through staging/packaging,
1854
+// so it calls this implementation without reacquiring its own lock.
1855
+const buildDesktopBundlesUnlocked = Effect.fn("buildDesktopBundlesUnlocked")(function* (
1856
+ repoRoot: string,
1857
+ appVersion: string,
1858
+ verbose: boolean,
1859
+) {
1860
+ const fs = yield* FileSystem.FileSystem;
1861
+ const path = yield* Path.Path;
1862
+ const spawnCommand = yield* resolveSpawnCommand("vp", ["run", "build:desktop"]);
1863
+ yield* Effect.acquireUseRelease(
1864
+ Effect.forEach(releasePackageFiles, (relativePath) =>
1865
+ Effect.gen(function* () {
1866
+ const filePath = path.join(repoRoot, relativePath);
1867
+ const contents = yield* fs.readFileString(filePath);
1868
+ const needsRestore = yield* decodeReleasePackageManifest(contents).pipe(
1869
+ Effect.map((manifest) => manifest.version !== appVersion),
1870
+ // Let alignment report invalid manifests after any preceding writes.
1871
+ Effect.orElseSucceed(() => false),
1872
+ );
1873
+ return { filePath, contents, needsRestore };
1874
+ }),
1875
+ ),
1876
+ () =>
1877
+ Effect.gen(function* () {
1878
+ yield* updateReleasePackageVersions(appVersion, { rootDir: repoRoot });
1879
+ // The compiler must stop reading the aligned manifests before restoration.
1880
+ yield* runCommand(
1881
+ ChildProcess.make(spawnCommand.command, spawnCommand.args, {
1882
+ cwd: repoRoot,
1883
+ shell: spawnCommand.shell,
1884
+ env: { APP_VERSION: appVersion },
1885
+ extendEnv: true,
1886
+ }),
1887
+ { label: "vp run build:desktop", verbose },
1888
+ ).pipe(Effect.scoped);
1889
+ }),
1890
+ (originals, exit) =>
1891
+ Effect.gen(function* () {
1892
+ const [, failures] = yield* Effect.partition(
1893
+ originals.filter(({ needsRestore }) => needsRestore),
1894
+ ({ filePath, contents }) =>
1895
+ fs
1896
+ .writeFileString(filePath, contents)
1897
+ .pipe(
1898
+ Effect.mapError(
1899
+ (cause) =>
1900
+ new ReleasePackageManifestError({ operation: "write", filePath, cause }),
1901
+ ),
1902
+ ),
1903
+ );
1904
+ if (failures.length === 0) return;
1905
+ const error = new DesktopBuildManifestRestoreError({ failures });
1906
+ if (Exit.isFailure(exit)) {
1907
+ // Cleanup must not hide the original build or alignment failure.
1908
+ yield* Effect.logError(error);
1909
+ } else {
1910
+ return yield* error;
1911
+ }
1912
+ }),
1913
+ );
1914
+});
1915
+
1916
+export const buildDesktopBundles = Effect.fn("buildDesktopBundles")(
1917
+ (repoRoot: string, appVersion: string, verbose: boolean) =>
1918
+ withDesktopBuildLock(repoRoot, buildDesktopBundlesUnlocked(repoRoot, appVersion, verbose)),
1919
+);
1920
+
1921
const desktopBuildProbeSucceeds = Effect.fn("desktopBuildProbeSucceeds")(function* (
1922
command: ChildProcess.Command,
1923
label: string,
@@ -3440,7 +3565,7 @@ export const validateWindowsPackagedPayload = Effect.fn(
3565
return { packagedAppDir, fileCount, unpackedFiles } as const;
3566
});
3567
3443
-const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
3568
+const buildDesktopArtifactUnlocked = Effect.fn("buildDesktopArtifactUnlocked")(function* (
3569
options: ResolvedBuildOptions,
3570
) {
3571
const repoRoot = yield* RepoRoot;
@@ -3535,14 +3660,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
3660
3661
if (!options.skipBuild) {
3662
yield* Effect.log("[desktop-artifact] Building desktop/server/web artifacts...");
3538
- const spawnCommand = yield* resolveSpawnCommand("vp", ["run", "build:desktop"]);
3539
- yield* runCommand(
3540
- ChildProcess.make(spawnCommand.command, spawnCommand.args, {
3541
- cwd: repoRoot,
3542
- shell: spawnCommand.shell,
3543
- }),
3544
- { label: "vp run build:desktop", verbose: options.verbose },
3545
- );
3663
+ yield* buildDesktopBundlesUnlocked(repoRoot, appVersion, options.verbose);
3664
}
3665
3666
const requiredBuildInputs = [
@@ -3969,6 +4087,13 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
4087
);
4088
});
4089
4090
+const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
4091
+ options: ResolvedBuildOptions,
4092
+) {
4093
+ const repoRoot = yield* RepoRoot;
4094
+ return yield* withDesktopBuildLock(repoRoot, buildDesktopArtifactUnlocked(options));
4095
+});
4096
+
4097
const buildDesktopArtifactCli = Command.make("build-desktop-artifact", {
4098
platform: Flag.Literals("platform", BuildPlatform.literals).pipe(
4099
Flag.withDescription("Build platform (env: T3CODE_DESKTOP_PLATFORM)."),
@@ -3985,7 +4110,9 @@ const buildDesktopArtifactCli = Command.make("build-desktop-artifact", {
4110
Flag.optional,
4111
),
4112
buildVersion: Flag.String("build-version").pipe(
3988
- Flag.withDescription("Artifact version metadata (env: T3CODE_DESKTOP_VERSION)."),
4113
+ Flag.withDescription(
4114
+ "Compiled bundle and desktop package version (env: T3CODE_DESKTOP_VERSION).",
4115
+ ),
4116
Flag.optional,
4117
),
4118
outputDir: Flag.String("output-dir").pipe(