MCPcopy
hub / github.com/prisma/prisma / scaffoldTemplate

Method scaffoldTemplate

packages/cli/src/bootstrap/Bootstrap.ts:571–604  ·  view source on GitHub ↗
(
    templateName: string,
    baseDir: string,
    steps: BootstrapStepStatus,
    stepsCompleted: string[],
    telemetryCtx: {
      distinctId: string
      databaseId: string | undefined
      linkResult: LinkResult | null
      projectState: ReturnType<typeof detectProjectState>
    },
  )

Source from the content-addressed store, hash-verified

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,

Callers 1

runMethod · 0.95

Calls 7

emitStepCompletedFunction · 0.90
sanitizeErrorMessageFunction · 0.90
emitStepFailedFunction · 0.90
failMethod · 0.80
startMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected