(
templateName: string,
baseDir: string,
steps: BootstrapStepStatus,
stepsCompleted: string[],
telemetryCtx: {
distinctId: string
databaseId: string | undefined
linkResult: LinkResult | null
projectState: ReturnType<typeof detectProjectState>
},
)
| 569 | } |
| 570 | |
| 571 | private async scaffoldTemplate( |
| 572 | templateName: string, |
| 573 | baseDir: string, |
| 574 | steps: BootstrapStepStatus, |
| 575 | stepsCompleted: string[], |
| 576 | telemetryCtx: { |
| 577 | distinctId: string |
| 578 | databaseId: string | undefined |
| 579 | linkResult: LinkResult | null |
| 580 | projectState: ReturnType<typeof detectProjectState> |
| 581 | }, |
| 582 | ): Promise<void> { |
| 583 | const spinner = ora(`Downloading ${bold(templateName)} template...`).start() |
| 584 | const stepStart = performance.now() |
| 585 | |
| 586 | try { |
| 587 | await downloadAndExtractTemplate(templateName, baseDir) |
| 588 | spinner.succeed(`Template ${bold(templateName)} scaffolded`) |
| 589 | steps.template = 'completed' |
| 590 | steps.init = 'skipped' |
| 591 | stepsCompleted.push('template') |
| 592 | await emitStepCompleted(telemetryCtx, 'template', performance.now() - stepStart) |
| 593 | } catch (err) { |
| 594 | const isTimeout = err instanceof DOMException && err.name === 'TimeoutError' |
| 595 | const msg = isTimeout |
| 596 | ? 'Download timed out — check your network connection and try again' |
| 597 | : err instanceof Error |
| 598 | ? err.message |
| 599 | : String(err) |
| 600 | spinner.fail(`Template download failed: ${sanitizeErrorMessage(msg)}`) |
| 601 | steps.template = 'failed' |
| 602 | await emitStepFailed(telemetryCtx, 'template', sanitizeErrorMessage(msg)) |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | private async runInit( |
| 607 | steps: BootstrapStepStatus, |
no test coverage detected