( path: string )
| 153 | } |
| 154 | |
| 155 | const readJsonFile = ( |
| 156 | path: string |
| 157 | ): Effect.Effect<unknown, never, FileSystem.FileSystem> => |
| 158 | Effect.gen(function*() { |
| 159 | const fs = yield* FileSystem.FileSystem |
| 160 | const content = yield* Effect.orDie(fs.readFileString(path)) |
| 161 | return yield* pipe( |
| 162 | Effect.try({ |
| 163 | try: () => JSON.parse(content), |
| 164 | catch: (error) => `[FileSystem] Unable to read and parse JSON file from '${path}': ${String(error)}` |
| 165 | }), |
| 166 | Effect.orDie |
| 167 | ) |
| 168 | }) |
| 169 | |
| 170 | const validateJsonFile = <A, I>( |
| 171 | schema: Schema.Codec<A, I>, |
no test coverage detected