feat(bgm): add vite plugin and build integration test
Move the bgm vite plugin into the package so it can be tested in isolation from the web app. Serve each package as a JSON module, serializing its maps, and verify resolution through a real vite build against a self-contained fixture.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# Harbor
|
||||
|
||||
A tiny example game used to exercise the bgm loader end-to-end through a real
|
||||
vite build.
|
||||
|
||||
```yaml file=harbor.yaml
|
||||
role: package
|
||||
id: harbor
|
||||
title: Harbor
|
||||
designer: Jane Doe
|
||||
players: 2
|
||||
language: en
|
||||
```
|
||||
|
||||
```yaml file=parts/tokens.yaml
|
||||
role: part
|
||||
type: token
|
||||
id: wood
|
||||
face: ./assets/tokens.png
|
||||
faceCrop: [1, 0, 5, 2]
|
||||
back: ./assets/tokens.png
|
||||
backCrop: [3, 0, 5, 2]
|
||||
shape: ./assets/token-shape.png
|
||||
size: [20, 20, 3]
|
||||
fillet: 2
|
||||
```
|
||||
|
||||
```yaml file=parts/board.yaml
|
||||
type: board
|
||||
id: harbor
|
||||
role: surface
|
||||
size: [300, 200]
|
||||
layout:
|
||||
- route: /dock/:seat
|
||||
candidates:
|
||||
$variants: ./seats.csv
|
||||
- route: /deck
|
||||
x: -100
|
||||
y: 0
|
||||
rotation: 0
|
||||
```
|
||||
|
||||
```csv file=parts/seats.csv
|
||||
seat,x,y,rotation
|
||||
string,number,number,number
|
||||
0,40,0,0
|
||||
1,40,20,0
|
||||
```
|
||||
|
||||
```yaml file=setup/main.yaml
|
||||
role: setup
|
||||
type: game
|
||||
id: main
|
||||
setup:
|
||||
/dock/0: harbor:token#wood
|
||||
/deck: harbor:token#grain
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>bgm build fixture</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,9 @@
|
||||
import harbor from 'bgm/harbor';
|
||||
|
||||
// Re-export the package data so the test can assert the bundled output.
|
||||
export const parts = [...harbor.parts.keys()];
|
||||
export const surfaces = [...harbor.surfaces.keys()];
|
||||
export const setups = [...harbor.setups.keys()];
|
||||
export const title = harbor.meta.title;
|
||||
|
||||
console.log(title, parts, surfaces, setups);
|
||||
Reference in New Issue
Block a user