(templateId: string, destDir: string)
| 50 | * aborts before a single file is written. |
| 51 | */ |
| 52 | export async function fetchRemoteTemplate(templateId: string, destDir: string): Promise<void> { |
| 53 | const items = await resolveItemWithDependencies(templateId); |
| 54 | const warnings = gateRegistryItemsCompatibility(items); |
| 55 | for (const warning of warnings) { |
| 56 | process.stderr.write(`hyperframes:registry ${warning}\n`); |
| 57 | } |
| 58 | for (const item of items) { |
| 59 | await installItem(item, { destDir }); |
| 60 | } |
| 61 | |
| 62 | // Safety check — an item with no index.html isn't a valid example. |
| 63 | if (!existsSync(join(destDir, "index.html"))) { |
| 64 | throw new Error( |
| 65 | `Example "${templateId}" installed but missing index.html. The registry item may be malformed.`, |
| 66 | ); |
| 67 | } |
| 68 | } |
no test coverage detected