diff --git a/.project/designs/serve.js b/.project/designs/serve.js index 1b694e9b..c1621c5a 100644 --- a/.project/designs/serve.js +++ b/.project/designs/serve.js @@ -3,7 +3,7 @@ const http = require("http"); const fs = require("fs"); const path = require("path"); -const PORT = 7777; +const PORT = parseInt(process.argv[2] || "7777", 10); const ROOT = __dirname; const MIME = { diff --git a/run b/run index d239543b..04a47289 100755 --- a/run +++ b/run @@ -23,7 +23,8 @@ usage() { echo -e "${YELLOW}Development${NC}" echo " play Launch the game locally" echo " editor Open Godot editor" - echo " guide Start guide dev server (port 5800)" + echo " guide Start guide dev server (port 5800) + designs [port] Serve .project/designs/ HTML sketches (default port 7777)" echo " lint Lint all (GDScript + Rust + TypeScript)" echo " lint:gd GDScript only (gdlint + gdformat --check)" echo " lint:rust Rust only (fmt --check + clippy + machete)" diff --git a/scripts/run/dev.sh b/scripts/run/dev.sh index f91e6b0e..9e2c1871 100644 --- a/scripts/run/dev.sh +++ b/scripts/run/dev.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Dev subcommands: play, editor, guide, screenshot. +# Dev subcommands: play, editor, guide, designs, screenshot. # # Previously this file was 546L conflating lint/format/test/verify/autoplay/ # dev-server into one module. It's now split: @@ -50,6 +50,13 @@ cmd_guide() { pnpm --prefix "$GUIDE_DIR" dev } +cmd_designs() { + local port="${1:-7777}" + echo -e "${BLUE}Starting design viewer (port ${port})...${NC}" + echo -e "${BLUE} http://localhost:${port}${NC}" + node "$REPO_ROOT/.project/designs/serve.js" "$port" +} + cmd_screenshot() { "$REPO_ROOT/tools/screenshot.sh" "$@" }