Skip to content
当前有符合你浏览器所设置语言的版本,是否前往zh-CN版本的网站?
There is a version suitable for your browser's language settings. Would you like to go to the zh-CN language of the site?
HomeDocument

Generation Phase

H1

The generation phase is the source of the “magic” that allows you to access functionality without writing routing code.

All the “magic” of automatic type safety and creating routes just by creating files is done during the generation phase.

When you save a file, Milkio’s VS Code Extension quietly enters the generation phase in the background. It reads your code and generates the generated directory and everything you need. This is also the secret behind Milkio’s ability to easily work across runtimes.

Details

The generation phase consists of two parts: significant and insignificant. When the significant part ends, it means that the important parts have been generated, and you can then run code or start a server, among other operations. The insignificant part continues to execute asynchronously in the background.

By modifying the milkio.toml file, you can freely add tasks to be performed during these phases. You can add the commands to be executed in the generate section.

[generate]
significant = ['echo significant']
insignificant = ['echo insignificant']

You can find detailed output during the generation phase in the Milkio dropdown option in the output panel of VS Code.

You can also generate using commands, which is useful for workflows like GitHub Actions.

Terminal window
bun run milkio gen # Generate (significant + insignificant)
Terminal window
bun run milkio gen:significant # Generate only significant
Terminal window
bun run milkio gen:insignificant # Generate only insignificant