| 101 | }) |
| 102 | |
| 103 | function discover(fs: FSUtil.Interface, directory: string) { |
| 104 | return Effect.forEach(legacySources, (source) => |
| 105 | fs |
| 106 | .glob(source.pattern, { cwd: directory, absolute: true, dot: true, symlink: true }) |
| 107 | .pipe( |
| 108 | Effect.map((files) => files.toSorted().map((filepath) => ({ directory, filepath, primary: source.primary }))), |
| 109 | ), |
| 110 | ).pipe( |
| 111 | Effect.map((files) => files.flat()), |
| 112 | Effect.catch(() => Effect.succeed([])), |
| 113 | ) |
| 114 | } |
| 115 | |
| 116 | function decode(file: { directory: string; filepath: string; primary: boolean }, content: string) { |
| 117 | const markdown = ConfigMarkdown.parseOption(content) |