Skip to content
Source
Sign inSign up
pingdotgg/t3code

Add file-backed appearance config for font overrides #464

Closednassimna(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/464/headopened View on GitHub

Showing 26 changed files with 164 additions and 0 deletions (loading 25).

x
0 of 26 viewed, 26 left
164 additions and 0 deletionsapps/server/src/appearance.test.tsAdded
View file
@@ -0,0 +1,164 @@
+import { AppearanceConfig, type AppearanceConfigIssue } from "@t3tools/contracts";
+import * as NodeServices from "@effect/platform-node/NodeServices";
+import { assert, it } from "@effect/vitest";
+import { Effect, Fiber, FileSystem, Layer, Path, Schema, Stream } from "effect";
+import { ServerConfig, type ServerConfigShape } from "./config";
+​
+import { Appearance, AppearanceLive, DEFAULT_APPEARANCE_CONFIG } from "./appearance";
+​
+const AppearanceConfigJson = Schema.fromJsonString(AppearanceConfig);
+​
+const makeAppearanceLayer = (
+ resolveAppearanceConfigPath?: (stateDir: string, join: Path.Path["join"]) => string,
+) =>
+ AppearanceLive.pipe(
+ Layer.provideMerge(
+ Layer.effect(
+ ServerConfig,
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const { join } = yield* Path.Path;
+ const dir = yield* fs.makeTempDirectoryScoped({ prefix: "t3code-appearance-test-" });
+ const appearanceConfigPath =
+ resolveAppearanceConfigPath?.(dir, join) ?? join(dir, "appearance.json");
+ return { appearanceConfigPath } as ServerConfigShape;
+ }),
+ ),
+ ),
+ );
+​
+const readAppearanceConfig = (configPath: string) =>