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 21, 03:37 UTC
| 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 { referenceRepos } from "./lib/reference-repos.ts"; |
| 8 | import { planReferenceRepoSync, resolveReferenceRepoRef } from "./sync-reference-repos.ts"; |
| 9 | |
| 10 | const effectRepo = referenceRepos[0]!; |
| 11 | const alchemyEffect = referenceRepos[1]!; |
| 12 | |
| 13 | it.layer(NodeServices.layer)("sync-reference-repos", (it) => { |
| 14 | it.effect("resolves reference tags from the root catalog", () => |
| 15 | Effect.gen(function* () { |
| 16 | const fs = yield* FileSystem.FileSystem; |
| 17 | const path = yield* Path.Path; |
| 18 | const rootDir = yield* fs.makeTempDirectoryScoped({ |
| 19 | prefix: "sync-reference-repos-version-", |
| 20 | }); |
| 21 | yield* fs.writeFileString( |
| 22 | path.join(rootDir, "pnpm-workspace.yaml"), |
| 23 | "catalog:\n alchemy: 2.0.0-beta.84\n effect: 4.0.0-beta.73\n", |
| 24 | ); |
| 25 | |
| 26 | assert.equal( |
| 27 | yield* resolveReferenceRepoRef(effectRepo, rootDir, false), |
| 28 | "effect@4.0.0-beta.73", |
| 29 | ); |
| 30 | assert.equal(yield* resolveReferenceRepoRef(alchemyEffect, rootDir, false), "v2.0.0-beta.84"); |
| 31 | }), |
| 32 | ); |
| 33 | |
| 34 | it.effect("plans a shallow, tagless clone of the resolved ref", () => |
| 35 | Effect.gen(function* () { |
| 36 | const fs = yield* FileSystem.FileSystem; |
| 37 | const path = yield* Path.Path; |
| 38 | const rootDir = yield* fs.makeTempDirectoryScoped({ |
| 39 | prefix: "sync-reference-repos-plan-", |
| 40 | }); |
| 41 | yield* fs.writeFileString( |
| 42 | path.join(rootDir, "pnpm-workspace.yaml"), |
| 43 | "catalog:\n effect: 4.0.0-beta.73\n", |
| 44 | ); |
| 45 | |
| 46 | const plan = yield* planReferenceRepoSync(effectRepo, rootDir, false); |
| 47 | assert.equal(plan.ref, "effect@4.0.0-beta.73"); |
| 48 | assert.deepStrictEqual(plan.cloneArgs, [ |
| 49 | "clone", |
| 50 | "--quiet", |
| 51 | "--depth=1", |
| 52 | "--no-tags", |
| 53 | "--single-branch", |
| 54 | "--branch=effect@4.0.0-beta.73", |
| 55 | "https://github.com/Effect-TS/effect.git", |
| 56 | ]); |
| 57 | }), |
| 58 | ); |
| 59 | }); |