Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@
"@internationalized/date": "^3.5.5",
"@keystar/ui": "^0.7.16",
"@nodelib/fs.walk": "^3.0.0",
"@prisma/client": "6.5.0",
"@prisma/internals": "6.5.0",
"@prisma/migrate": "6.5.0",
"@prisma/client": "6.11.1",
"@prisma/client-generator-registry": "6.11.1",
"@prisma/internals": "6.11.1",
"@prisma/migrate": "6.11.1",
"@react-aria/i18n": "^3.12.1",
"@react-aria/label": "^3.7.10",
"@react-aria/utils": "^3.25.1",
Expand Down Expand Up @@ -278,7 +279,7 @@
"meow": "^9.0.0",
"next": "^15.1.0",
"pluralize": "^8.0.0",
"prisma": "6.5.0",
"prisma": "6.11.1",
"prompts": "^2.4.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
Expand Down
25 changes: 16 additions & 9 deletions packages/core/src/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ import type { ChildProcess } from 'node:child_process'
import fs from 'node:fs/promises'
import path from 'node:path'

import { formatSchema, getGenerators } from '@prisma/internals'
import { printSchema } from 'graphql'
import { defaultRegistry } from '@prisma/client-generator-registry'
import {
getGenerators,
formatSchema,
getSchemaWithPath,
processSchemaResult,
} from '@prisma/internals'

import { printPrismaSchema } from './lib/core/prisma-schema-printer'
import type { System } from './lib/system'
import { printGeneratedTypes } from './lib/typescript-schema-printer'
Expand Down Expand Up @@ -80,23 +87,23 @@ export async function generateTypes(cwd: string, system: System) {

export async function generatePrismaClient(cwd: string, system: System) {
const paths = system.getPaths(cwd)
const schemaResult = await getSchemaWithPath(paths.schema.prisma, undefined, { cwd })
const schemaContext = await processSchemaResult({ schemaResult, ignoreEnvVarErrors: true })

const generators = await getGenerators({
schemaPath: paths.schema.prisma,
schemaContext,
registry: defaultRegistry.toInternal(),
postinstall: false,
printDownloadProgress: false,
})

console.error(generators)
await Promise.all(
generators.map(async generator => {
try {
await generator.generate()
} finally {
const closePromise = new Promise<void>(resolve => {
const child = (generator as any).generatorProcess.child as ChildProcess
child.once('exit', () => {
resolve()
})
})
generator.stop()
await closePromise
}
})
)
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export async function build(
log('✨ Generated GraphQL and Prisma schemas') // TODO: generating?
}

console.log('✨ Generated Keystone types') // TODO: generating?
await generateTypes(cwd, system)

console.log('✨ Generated Prisma client') // TODO: generating?
await generatePrismaClient(cwd, system)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/scripts/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export async function cli(cwd: string, argv: string[]) {
// WARNING: postinstall is an alias for `build --frozen --no-ui`
if (command === 'postinstall') {
// uncomment when you need to update the schemas
// return build(cwd, defaultFlags(flags, { frozen: false, prisma: true, ui: false }))
return build(cwd, defaultFlags(flags, { frozen: false, prisma: true, ui: false }))
return build(cwd, defaultFlags(flags, { frozen: true, prisma: true, ui: false }))
}

Expand Down
Loading
Loading