create-app-bundle
Create App Bundle
Set up the metadata and assets needed for the game to appear on Puzzmo.
Steps
-
Create a
public/directory for static assets if it doesn't exist. -
Add the
appBundlePlugintovite.config.ts:import { defineConfig } from "vite" import { puzzmoSimulator, appBundlePlugin } from "@puzzmo/sdk/vite" export default defineConfig({ plugins: [puzzmoSimulator({ slug: "your-game-slug", fixturesGlob: "/fixtures/puzzles/**/*.json" }), appBundlePlugin()], build: { outDir: "dist", assetsDir: "assets", }, })The
appBundlePluginruns after the main build and producesdist/app-bundle.jsas a separate ES module library build fromsrc/appBundle.js. -
Create
src/appBundle.js(orsrc/appBundle.ts) that exports therenderThumbnailfunction:
export type AppBundle = {
/** Renders a puzzle and optional state string into an SVG */
renderThumbnail(puzzleStr: string, inputStr?: string, config?: ThumbnailConfig): string
}
You can find the ThumbnailConfig type definition in @puzzmo-com/sdk/types.
The function should return an SVG string that visually represents the puzzle. You could use code from the original game but the goal is a drastically simplified rendering that captures the essence of the puzzle in a small thumbnail. The thumbnail will be used on the Puzzmo platform to represent the puzzle in lists and previews.
- Verify the build output has:
dist/index.html- All JS/CSS properly bundled
- All static assets in
dist/ dist/app-bundle.jswith therenderThumbnailexport
Success Criteria
npm run buildcompletes without errorsdist/directory contains a complete, self-contained game- Thumbnail SVG exists and renders
More from puzzmo-com/oss
add-deeds
Generate interesting gameplay statistics (deeds) sent on game completion
9setup-deploy
Configure the Puzzmo CLI for uploading game builds
9convert-to-vite
Convert a standalone HTML game into a Vite project with proper module structure
9add-keyboard-support
Add Puzzmo on-screen keyboard support to a game using the SDK
1