( rootDir: string, allFilePaths: string[], )
| 98 | } |
| 99 | |
| 100 | export async function findOrphanedFiles( |
| 101 | rootDir: string, |
| 102 | allFilePaths: string[], |
| 103 | ): Promise<string[]> { |
| 104 | const hubs = await discoverHubs(rootDir); |
| 105 | const linkedFiles = new Set<string>(); |
| 106 | |
| 107 | for (const hubRelPath of hubs) { |
| 108 | const info = await parseHubFile(resolve(rootDir, hubRelPath)); |
| 109 | for (const link of info.links) { |
| 110 | linkedFiles.add(link.target.replace(/\\/g, "/")); |
| 111 | } |
| 112 | linkedFiles.add(hubRelPath); |
| 113 | } |
| 114 | |
| 115 | return allFilePaths |
| 116 | .filter((f) => !f.endsWith(".md")) |
| 117 | .filter((f) => !linkedFiles.has(f.replace(/\\/g, "/"))); |
| 118 | } |
| 119 | |
| 120 | export function formatHubLink(target: string, description: string): string { |
| 121 | return description |
no test coverage detected