Skip to content

Commit e7a59ad

Browse files
chore: wip
1 parent 1ea6bb9 commit e7a59ad

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

storage/framework/api/dev.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,21 @@ async function watchFolders() {
157157
log.success(`Hot reloaded Middleware: ${filename}`)
158158
}
159159
})
160+
161+
// Watch user models for ORM generation
162+
watch(path.userModelsPath(), { recursive: true }, (event: string, filename: string | null) => {
163+
if (filename === null)
164+
return
165+
166+
log.info(`Detected ${event} in user models/${filename}`)
167+
log.info('Generating ORM model files...')
168+
169+
runCommandSync('./buddy generate:model-files', {
170+
cwd: process.cwd(), // Run at root directory
171+
})
172+
173+
log.success(`Generated ORM model files for: ${filename}`)
174+
})
160175
}
161176

162177
// @ts-expect-error - somehow type is not recognized

0 commit comments

Comments
 (0)