()
| 22 | let seeded = false; |
| 23 | |
| 24 | export async function seedMetaFiles(): Promise<void> { |
| 25 | if (seeded) return; |
| 26 | seeded = true; |
| 27 | |
| 28 | const files: Array<{ path: string; name: string; content: string }> = []; |
| 29 | |
| 30 | for (const [filePath, content] of Object.entries(metaFiles)) { |
| 31 | const dirMatch = filePath.match(/\.\.\/pages\/([^/]+)\//); |
| 32 | if (!dirMatch) continue; |
| 33 | const appName = DIR_TO_APP_NAME[dirMatch[1]] || dirMatch[1].toLowerCase(); |
| 34 | const fileName = filePath.split('/').pop() || ''; |
| 35 | if (!fileName) continue; |
| 36 | files.push({ path: `apps/${appName}`, name: fileName, content }); |
| 37 | } |
| 38 | |
| 39 | if (files.length > 0) { |
| 40 | await idb.putTextFilesByJSON({ files }); |
| 41 | console.info(`[seedMeta] Seeded ${files.length} meta files to disk`); |
| 42 | } |
| 43 | } |
no test coverage detected