MCPcopy Create free account
hub / github.com/Effect-TS/effect / readFileString

Function readFileString

packages/tools/docgen/test/Configuration.test.ts:49–57  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

47 const context = yield* Effect.context<never>()
48 const docgenJson = Option.getOrElse(Context.getOption(context, DocgenJsonTag), () => ({} as DocgenJson))
49 const readFileString: FileSystem.FileSystem["readFileString"] = (filePath) => {
50 const fileName = path.basename(filePath)
51 if (fileName === "package.json") {
52 return Effect.succeed(JSON.stringify({ name: "name", homepage: "homepage" }))
53 } else if (fileName === "docgen.json") {
54 return Effect.succeed(JSON.stringify(docgenJson))
55 }
56 return Effect.die(`file not found: ${filePath}`)
57 }
58 const exists: FileSystem.FileSystem["exists"] = (filePath) => {
59 const fileName = path.basename(filePath)
60 if (fileName === "invalid-json.txt") {

Callers

nothing calls this directly

Calls 1

succeedMethod · 0.45

Tested by

no test coverage detected