()
| 18 | * Reads all issue descriptions from the filesystem into memory. |
| 19 | */ |
| 20 | export async function loadIssueDescriptions(): Promise<void> { |
| 21 | if (Object.keys(issueDescriptions).length > 0) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | const files = await fs.promises.readdir(DESCRIPTIONS_PATH); |
| 26 | const descriptions: Record<string, string> = {}; |
| 27 | |
| 28 | const results = await Promise.all( |
| 29 | files |
| 30 | .filter(file => file.endsWith('.md')) |
| 31 | .map(async file => { |
| 32 | const content = await fs.promises.readFile( |
| 33 | path.join(DESCRIPTIONS_PATH, file), |
| 34 | 'utf-8', |
| 35 | ); |
| 36 | return {file, content}; |
| 37 | }), |
| 38 | ); |
| 39 | |
| 40 | for (const {file, content} of results) { |
| 41 | descriptions[file] = content; |
| 42 | } |
| 43 | |
| 44 | issueDescriptions = descriptions; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Gets an issue description from the in-memory cache. |
no test coverage detected
searching dependent graphs…