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
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
"chalk": "^4.1.2",
"ci-info": "^4.0.0",
"clipboard-copy": "^4.0.1",
"conf": "^10.2.0",
"conf": "^15.0.0",
"cookie": "^1.0.0",
"cors": "^2.8.5",
"dataloader": "^2.1.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/lib/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ export async function withMigrate<T>(
},
})
} finally {
await (migrate.engine as any).initPromise
// @ts-expect-error
await migrate.engine.initPromise
const closePromise = new Promise<void>(resolve => {
;(migrate.engine as any).child.once('exit', resolve)
// @ts-expect-error
migrate.engine.child.once('exit', resolve)
})
migrate.stop()
await closePromise
Expand Down
33 changes: 14 additions & 19 deletions packages/core/src/scripts/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ function stripExtendHttpServer(config: KeystoneConfig): KeystoneConfig {
}
}

function maybePrint (context: string, list: string[]) {
if (!list.length) return
console.error()
console.error(context)
console.error()
for (const item of list) {
console.error(` • ${item}`)
}
console.error()
}

function resolvablePromise<T>() {
let _resolve!: (value: T) => void
const promise: any = new Promise<T>(resolve => {
Expand Down Expand Up @@ -173,19 +184,8 @@ export async function dev(

// if there are unexecutable steps, we need to reset the database [or the user can use migrations]
if (migration_.unexecutable.length) {
console.error(
`${chalk.bold.red('\n⚠️ We found changes that cannot be executed:\n')}`
)
for (const item of migration_.unexecutable) {
console.error(` • ${item}`)
}

if (migration_.warnings.length) {
console.error(chalk.bold(`\n⚠️ Warnings:\n`))
for (const warning of migration_.warnings) {
console.error(` • ${warning}`)
}
}
maybePrint(chalk.bold.red('⚠️ Some changes cannot be executed:'), migration_.unexecutable)
maybePrint(chalk.bold('⚠️ Warnings:'), migration_.warnings)

console.error('\nTo apply this migration, we need to reset the database')
if (
Expand All @@ -202,12 +202,7 @@ export async function dev(
}

if (migration_.warnings.length) {
if (migration_.warnings.length) {
console.error(chalk.bold(`\n⚠️ Warnings:\n`))
for (const warning of migration_.warnings) {
console.error(` • ${warning}`)
}
}
maybePrint(chalk.bold('⚠️ Warnings:'), migration_.warnings)

if (
!(await confirmPrompt(
Expand Down
Loading
Loading