MCPcopy
hub / github.com/prisma/prisma / getUniquePackageName

Function getUniquePackageName

packages/client-generator-js/src/generateClient.ts:654–658  ·  view source on GitHub ↗

* This function ensures that each generated client has unique package name * It appends sha256 of the schema to the fixed prefix. That ensures unique schemas * produce unique generated packages while still keeping `generate` results reproducible. * * Without unique package name, if you have seve

(datamodel: string)

Source from the content-addressed store, hash-verified

652 * @returns
653 */
654function getUniquePackageName(datamodel: string) {
655 const hash = createHash('sha256')
656 hash.write(datamodel)
657 return `${GENERATED_PACKAGE_NAME_PREFIX}${hash.digest().toString('hex')}`
658}
659
660const GENERATED_PACKAGE_NAME_PREFIX = 'prisma-client-'

Callers 1

buildClientFunction · 0.85

Calls 4

createHashFunction · 0.90
digestMethod · 0.80
writeMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected