@devries-cameron20 / t3code-1 / commits / 3fa79a5c83
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(scripts): copy web brand icons to an absolute target directory (#23491)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Victor Vogel committed Oct 30, 2026 at 15:51 UTC 3fa79a5c83817c15b04b07f5db6c639fca33abda
2 files changed +65 -5
scripts/apply-web-brand-assets.test.ts new
+63
@@ -0,0 +1,63 @@
1 +import * as NodeServices from "@effect/platform-node/NodeServices";
2 +import { assert, it } from "@effect/vitest";
3 +import * as Effect from "effect/Effect";
4 +import * as FileSystem from "effect/FileSystem";
5 +import * as Path from "effect/Path";
6 +
7 +import { applyWebBrandAssets } from "./apply-web-brand-assets.ts";
8 +
9 +const WEB_ICON_FILENAMES = [
10 + "apple-touch-icon.png",
11 + "favicon-16x16.png",
12 + "favicon-32x32.png",
13 + "favicon.ico",
14 +];
15 +
16 +it.layer(NodeServices.layer)("apply-web-brand-assets", (it) => {
17 + it.effect("copies the icons into an absolute target directory as given", () =>
18 + Effect.gen(function* () {
19 + const fs = yield* FileSystem.FileSystem;
20 + const targetDirectory = yield* fs.makeTempDirectoryScoped({
21 + prefix: "apply-web-brand-assets-",
22 + });
23 +
24 + yield* applyWebBrandAssets("production", targetDirectory);
25 +
26 + assert.deepStrictEqual(
27 + (yield* fs.readDirectory(targetDirectory)).toSorted(),
28 + WEB_ICON_FILENAMES,
29 + );
30 + }),
31 + );
32 +
33 + it.effect("resolves an empty target directory to the repo root", () =>
34 + Effect.gen(function* () {
35 + const fs = yield* FileSystem.FileSystem;
36 + const path = yield* Path.Path;
37 + const repoRoot = yield* path.fromFileUrl(new URL("..", import.meta.url));
38 + const destinations = WEB_ICON_FILENAMES.map((filename) => path.join(repoRoot, filename));
39 + // readDirectory does not follow symlinks, so a dangling link counts as an existing entry.
40 + // Names are lowercased so a case-insensitive filesystem cannot hide a differently cased file.
41 + const existingEntries = new Set(
42 + (yield* fs.readDirectory(repoRoot)).map((entry) => entry.toLowerCase()),
43 + );
44 + for (const destination of destinations) {
45 + assert.isFalse(
46 + existingEntries.has(path.basename(destination)),
47 + `${destination} already exists`,
48 + );
49 + }
50 + yield* Effect.addFinalizer(() =>
51 + Effect.forEach(destinations, (destination) => fs.remove(destination, { force: true })).pipe(
52 + Effect.orDie,
53 + ),
54 + );
55 +
56 + yield* applyWebBrandAssets("production", "");
57 +
58 + for (const destination of destinations) {
59 + assert.isTrue(yield* fs.exists(destination));
60 + }
61 + }),
62 + );
63 +});
scripts/apply-web-brand-assets.ts
+2 -5
@@ -29,12 +29,9 @@ export const applyWebBrandAssets = Effect.fn("applyWebBrandAssets")(function* (
29 const repoRoot = yield* path.fromFileUrl(new URL("..", import.meta.url));
30
31 yield* Effect.forEach(
32 - resolveWebIconOverrides(brand, targetDirectory),
32 + resolveWebIconOverrides(brand, path.resolve(repoRoot, targetDirectory)),
33 (override) =>
34 - fs.copyFile(
35 - path.join(repoRoot, override.sourceRelativePath),
36 - path.join(repoRoot, override.targetRelativePath),
37 - ),
34 + fs.copyFile(path.join(repoRoot, override.sourceRelativePath), override.targetRelativePath),
35 { concurrency: "unbounded" },
36 );
37 });