import chalk from 'chalk' ; import path from 'path' ; import { getClientEngineType } from '../client/getClientEngineType' ; import type { Generator } from '../Generator' ; import { formatms } from '../utils/formatms' ; import { parseEnvValue } from '../utils/parseEnvValue' ; param time export function getGeneratorSuccessMessage ( generator , time ) { const name = generator . getPrettyName ( ) ; const version = formatVersion ( generator ) ; const to = formatOutput ( generator ) ; return `✔ Generated ${ chalk . bold ( name ) }${ version ? ` (${ version })` : '' }${ to } in ${ formatms ( time ) }` ; } function formatVersion ( generator ) { const version = generator . manifest ?. version ; if ( generator . getProvider ( ) === 'prisma-client-js' ) { const engineType = getClientEngineType ( generator . config ) ; return version ? `${ version } | ${ engineType }` : engineType ; } return version ; } function formatOutput ( generator ) { const output = generator . options ?. generator . output ; return output ? chalk . dim ( ` to .${ path . sep }${ path . relative ( process . cwd ( ) , parseEnvValue ( output ) ) }` ) : '' ; }