Vite plugin and configuration
Today, mk dev and mk publish find a game by convention: src/game.ts and network/velocity.ts. The plan is one configuration that says what a project builds and where it goes, like a Cloudflare Workers project with its Vite plugin and Wrangler.
The configuration
Section titled “The configuration”import { minekube } from "@minekube/vite";import { defineConfig } from "vite";
export default defineConfig({ plugins: [ minekube({ bundles: { arena: { platform: "paper", entry: "src/game.ts" }, lobby: { platform: "velocity", entry: "network/velocity.ts" }, }, targets: { canary: { network: "play", selector: "channel=canary" }, prod: { network: "play", selector: "*", hostnames: ["arena"], domains: ["arena.example.com"], }, }, }), ],});bundlesis required. Nothing is built by convention. Name, platform and entry are explicit, and a project can have several bundles per platform.targetsare wheremk deploygoes, like Wrangler’s environments. With one target,mk deployneeds no argument.selectoris required. All servers of a network are"*", written out, so a forgotten selector never rolls out to everyone.- There are no build commands. The build is Vite itself. An extra step is a Vite plugin or a script in
package.json. - The plugin checks the configuration with an Effect Schema and names the field that is wrong.
One core for the plugin and the CLI
Section titled “One core for the plugin and the CLI”The Vite plugin and mk share one core: read and check the configuration, build, run the dev server, install and upload. mk dev, mk build and mk deploy call the same functions as vite dev and vite build. Paper and Velocity become environments of Vite’s Environment API, as Cloudflare’s plugin runs workerd. Bun stays the runtime, package manager and test runner.
vite build writes dist/ with the bundles and a minekube.json that names each bundle with its platform and SHA-256. What you tested is what you upload.
Commands
Section titled “Commands”| Today | Planned | Like |
|---|---|---|
mk publish |
mk deploy [target]: build, upload, assign |
wrangler deploy |
mk versions upload: upload without assigning |
wrangler versions upload |
|
mk versions deploy <id> [--batch 20%] |
wrangler versions deploy |
|
mk revisions |
mk versions list, mk deployments list |
wrangler versions list, deployments list |
mk publish --revision |
mk rollback [id] |
wrangler rollback |
mk unpublish |
mk undeploy [target] |
--message and --tag describe a version. Without them, mk deploy takes the commit message and hash from git. The network keeps the last 100 versions and every version that is assigned.
Related
Section titled “Related”- Controlled updates: waves, and games that hold an update until a round ends.
- Hostnames and custom domains: the
hostnamesanddomainsof a target.
Was this helpful?
Thanks for the feedback.