Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- run: pnpm install --frozen-lockfile

- run: pnpm typecheck

- run: pnpm test

- run: pnpm lint
86 changes: 86 additions & 0 deletions .github/workflows/deploy-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Deploy Examples

on:
push:
branches: [main]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- run: pnpm install --frozen-lockfile

- name: Build vanilla example
run: pnpm -C packages/examples/js-vanilla run build -- --base=/floormap/vanilla/

- name: Build react example
run: pnpm -C packages/examples/react run build -- --base=/floormap/react/

- name: Assemble pages
run: |
mkdir -p pages/vanilla pages/react
cp -r packages/examples/js-vanilla/dist/. pages/vanilla/
cp -r packages/examples/react/dist/. pages/react/
cat > pages/index.html << 'EOF'
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Floormap — Examples</title>
<style>
body { font-family: sans-serif; max-width: 480px; margin: 80px auto; padding: 0 24px; }
h1 { font-size: 1.5rem; margin-bottom: 8px; }
p { color: #555; margin-bottom: 32px; }
a { display: block; padding: 14px 20px; border: 1px solid #e5e7eb;
border-radius: 8px; text-decoration: none; color: #111;
margin-bottom: 12px; }
a:hover { background: #f9fafb; }
a span { display: block; font-size: 0.85rem; color: #888; margin-top: 2px; }
</style>
</head>
<body>
<h1>Floormap</h1>
<p>Interactive 2D editor toolkit — live examples</p>
<a href="vanilla/">
Vanilla JS
<span>@floormap/core + @floormap/svg</span>
</a>
<a href="react/">
React
<span>@floormap/core + @floormap/react</span>
</a>
</body>
</html>
EOF

- uses: actions/upload-pages-artifact@v3
with:
path: pages

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
registry-url: https://npm.pkg.github.com
scope: '@floormap'

- run: pnpm install --frozen-lockfile

- run: pnpm typecheck

- run: pnpm test

- run: pnpm build

- run: pnpm changeset publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ node_modules
dist
.vscode
.DS_Store
pnpm-lock.yaml
coverage
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint": "eslint .",
"test": "vitest run",
"test:watch": "vitest --w",
"typecheck": "tsc -b --verbose",
"typecheck": "tsc --noEmit",
"release": "changeset version && pnpm install --no-frozen-lockfile && changeset publish"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('FloormapCanvas', () => {

it('re-renders with selected=true when entity is selected', () => {
const core = makeCore();
const drawEntity = vi.fn((_e: Entity) => null);
const drawEntity = vi.fn((_e: Entity, _ctx: { selected: boolean }) => null);
render(<FloormapCanvas core={core} drawEntity={drawEntity} />);

act(() => {
Expand Down
Loading
Loading