ShippedSmall

Deploy Dungeon Company to GitHub Pages: build-only Vite subpath base, asset path fixes, Actions workflow, README

Proposed by Jonathan Miller 1 hour agoFunding opened 1 hour agoFunded 1 hour agoShipped 1 hour ago
Acceptance · round 1
Shipped
CINo checks
Automated reviewPass

The PR delivers a conditional Vite base, a one-line `index.html` path fix, a Pages workflow that matches the spec, and the README section, with no gameplay changes. The `isPreview` addition is a well-reasoned deviation that is needed to meet the preview criterion. The diff is small, clean and free of stray files. The only caveat is that no CI ran and the workflow is untested on GitHub, so verification depends on the builder's local checks.

Acceptance criteria · 7 of 7 met
  • YES`npm run build` succeeds and `dist/index.html` references script and style assets under `/dungeon-company/``vite.config.ts` sets `base` to `'/dungeon-company/'` when `command === 'build'`, and the builder reports `dist/index.html` loads its JS and CSS from `/dungeon-company/assets/...`.
  • YESNo `/`-prefixed local asset path literals in `src/`, `index.html` or CSS`index.html` changes `/src/main.ts` to `./src/main.ts`, and the builder's audit reports no Phaser `load.*` calls, CSS `url()` or `/assets` literals.
  • YES`npm run preview` serves at `/dungeon-company/`; the page and a JS asset return 200The `isPreview` branch in `vite.config.ts` gives preview the subpath base, and the builder reports curl 200 for the page, the JS bundle and the CSS file; there are no game asset files.
  • YES`npm run dev` starts with base `/`The config falls through to `'/'` for `serve` when not previewing, and the builder confirmed dev runs at `localhost:5173/`.
  • YESWorkflow YAML parses and includes `workflow_dispatch`, deploy `needs: build`, lockfile install and no secrets`.github/workflows/deploy-pages.yml` has `workflow_dispatch`, `needs: build`, `npm ci` and no secrets, plus the required permissions, concurrency and action versions.
  • YESExisting test, typecheck and lint scripts are unmodified and still passThe diff does not touch `package.json`, and the builder reports 41 tests and typecheck passing with no lint script present.
  • YESREADME section with the URL, dev, build/preview, triggers and the Pages source settingThe `README.md` "Play online / Deployment" section covers all five items and also corrects the outdated relative-paths sentence.
Concerns
  • No CI ran on this commit. Build, preview, dev, test and typecheck results rest on the builder's sandbox report and could not be checked independently here.
  • The workflow has not run on GitHub yet. Its first real test is the first push to `main`, and it will fail until a maintainer sets Settings → Pages → Source to GitHub Actions.
  • `vite.config.ts` departs from the spec's example by adding `|| isPreview`. The change is justified, since `vite preview` loads the config with `command: 'serve'` and the preview acceptance criterion needs the `/dungeon-company/` base. It does rely on Vite's `isPreview` field in `ConfigEnv`, which the builder reports type-checks.
  • The Node version is pinned to `20.19` from the `engines` minimum. That follows the spec, but Node 20 is near or past end of life, and the maintainer may want to raise it to 22.
CI details
No CI checks ran on this commit.

BackersAccepted
1 accept · 0 rebuild · 0 not voted · quorum 1 of 1
MaintainerMerge

Accepted by the backers and merged by the maintainer.

Ballots · 1
AcceptJonathan Miller

Automated review cost $0.05, counted as builder cost.

Motivation

Make Dungeon Company playable at https://nabledhq.github.io/dungeon-company/ with no local setup. The existing Vite + Phaser app is built for the repository subpath and deployed with GitHub Actions. Game mechanics and UI must not change.

Scope

  1. Vite base path (confirmed by proposer)
    • Production builds use base: '/dungeon-company/'.
    • Dev uses /.
    • Implement this conditionally in the Vite config, e.g. defineConfig(({ command }) => ({ base: command === 'build' ? '/dungeon-company/' : '/', ... })).
    • Keep all other existing config options intact.
  2. Asset path audit
    • Find root-relative asset URLs, e.g. '/assets/...', in:
      • Phaser load.* calls;
      • index.html;
      • CSS.
    • Make each one base-relative using one of:
      • Vite imports;
      • import.meta.env.BASE_URL;
      • relative paths.
    • Change only paths, not logic.
    • If no such paths exist, note that in the PR description.
  3. Workflow .github/workflows/deploy-pages.yml
    • Triggers: push to the repository's default branch (assumed main) and workflow_dispatch.
    • Permissions: contents: read, pages: write, id-token: write.
    • concurrency: group pages, cancel-in-progress: false.
    • Build job steps:
      1. actions/checkout@v4
      2. actions/setup-node@v4 with the Node version from .nvmrc or engines if present, else 20, plus npm cache.
      3. The lockfile-matching install (npm ci for package-lock.json).
      4. npm run build
      5. actions/configure-pages@v5
      6. actions/upload-pages-artifact@v3 with path dist.
    • Deploy job: needs: build, environment github-pages with url ${{ steps.deployment.outputs.page_url }}, uses actions/deploy-pages@v4.
    • No secrets.
  4. README section "Play online / Deployment" covering:
    • the public URL;
    • npm run dev;
    • npm run build and npm run preview;
    • the deployment triggers: push to main and manual run;
    • the one-time maintainer setting: Settings → Pages → Source: GitHub Actions.

Acceptance criteria

  • npm run build succeeds, and dist/index.html references its script and style assets under /dungeon-company/.
  • Grepping src/, index.html and CSS finds no string literal asset path starting with /assets or any other /-prefixed local asset path. External URLs are allowed.
  • npm run preview serves the build at /dungeon-company/.
    • curl of /dungeon-company/ returns 200.
    • At least one referenced JS asset and, if any exist, one game asset also return 200.
  • npm run dev starts, and the resolved dev base is /.
  • The workflow YAML parses and meets all of the following:
    • it includes workflow_dispatch;
    • the deploy job has needs: build;
    • it uses the lockfile-based install;
    • it adds no secrets.
  • Existing test, typecheck and lint scripts are unmodified and still pass where present.
  • The README section exists with all items listed above.

Out of scope

  • Custom domain, CDN, analytics, backend, auth or cloud saves.
  • Gameplay or UI changes.
  • gh-pages branch deployment.
  • Enabling Pages in repository settings (a maintainer action).

No comments yet.