refactor(just): reorganize Justfiles to match project architecture and format code

This commit is contained in:
2025-12-30 04:20:19 -06:00
parent 884f42a855
commit eedf22f86d
10 changed files with 161 additions and 83 deletions
+31 -7
View File
@@ -8,27 +8,51 @@ mod web 'web/Justfile'
default: default:
@just --list --list-submodules @just --list --list-submodules
alias b := bun
alias bu := bun
# Runs 'bun' from within the 'web/' folder
bun *args:
cd web/ && bun {{args}}
alias bx := bunx
alias bux := bunx
# Runs 'bunx' from within the 'web/' folder
bunx *args:
cd web/ && bunx {{args}}
# Run the game (pacman::run) # Run the game (pacman::run)
run *args: run *args:
@just pacman::run {{args}} @just pacman::run {{args}}
# Run all checks (pacman::check) # Run all checks (Rust workspace + web)
check: check:
@just pacman::check @echo "Checking format..."
@cargo fmt --all -- --check || echo "⚠ Format issues detected (run \`just format\` to fix)"
@echo "Running clippy for desktop target..."
@cargo clippy --workspace --all-targets --all-features --quiet -- -D warnings || true
@echo "Running clippy for wasm target..."
@cargo clippy -p pacman --target wasm32-unknown-emscripten --all-targets --all-features --quiet -- -D warnings || true
@echo "Running web checks..."
@just web::check || true
@echo "Check complete!"
alias lint := check alias lint := check
# Run tests (pacman::test) # Run tests (Rust workspace + web)
test: test:
@just pacman::test cargo nextest run --workspace --no-fail-fast
@just web::test || true
# Format code (pacman::format) # Format code (Rust workspace + web)
format: format:
@just pacman::format cargo fmt --all
@just web::format
alias fmt := format alias fmt := format
# Frontend dev server (web::dev) # Dev servers (web + server)
dev: dev:
@just web::dev @just web::dev
+12
View File
@@ -25,3 +25,15 @@ run: image
--env PORT=3000 \ --env PORT=3000 \
--env-file pacman-server/.env \ --env-file pacman-server/.env \
pacman-server pacman-server
# Run checks (clippy) for server package
check:
cargo clippy -p pacman-server --all-targets --all-features --quiet -- -D warnings
# Format code for server package
format:
cargo fmt -p pacman-server
# Run tests for server package
test:
cargo nextest run -p pacman-server --no-fail-fast
+7 -10
View File
@@ -10,26 +10,23 @@ vcpkg:
run *args: run *args:
cargo run -p pacman {{args}} cargo run -p pacman {{args}}
# Run all checks (clippy for desktop + wasm, warns on format) # Run all checks (clippy for desktop + wasm, warns on format) for pacman package
check: check:
@echo "Checking format..." @echo "Checking format..."
@cargo fmt --all -- --check || echo "⚠ Format issues detected (run \`just format\` to fix)" @cargo fmt -p pacman -- --check || echo "⚠ Format issues detected (run \`just format\` to fix)"
@echo "Running clippy for desktop target..." @echo "Running clippy for desktop target..."
@cargo clippy --all-targets --all-features --quiet -- -D warnings @cargo clippy -p pacman --all-targets --all-features --quiet -- -D warnings
@echo "Running clippy for wasm target..." @echo "Running clippy for wasm target..."
@cargo clippy -p pacman --target wasm32-unknown-emscripten --all-targets --all-features --quiet -- -D warnings @cargo clippy -p pacman --target wasm32-unknown-emscripten --all-targets --all-features --quiet -- -D warnings
@echo "Running frontend checks..."
@bun run --cwd web check
@bun run --cwd web lint
@echo "All checks passed!" @echo "All checks passed!"
# Run tests with nextest # Run tests with nextest for pacman package
test: test:
cargo nextest run --no-fail-fast cargo nextest run -p pacman --no-fail-fast
# Auto-format code # Auto-format code for pacman package
format: format:
cargo fmt --all cargo fmt -p pacman
# Fix linting errors & formatting # Fix linting errors & formatting
fix: fix:
+19
View File
@@ -0,0 +1,19 @@
# Build output
dist/
build/
.svelte-kit/
# Dependencies
node_modules/
# Generated files
.vercel/
.netlify/
static/pacman.data
static/pacman.js
static/pacman.wasm
static/pacman.wasm.map
# Package manager
pnpm-lock.yaml
bun.lockb
+13
View File
@@ -21,3 +21,16 @@ serve *args:
bun run pacman/web.build.ts {{args}} bun run pacman/web.build.ts {{args}}
bun run --cwd web build bun run --cwd web build
caddy file-server --root web/dist/client --listen :8547 caddy file-server --root web/dist/client --listen :8547
# Run checks (type-checking and linting)
check:
bun run check
bun run lint
# Format code
format:
bun run format
# Run tests
test:
bun run test
+3 -1
View File
@@ -16,7 +16,9 @@
"prepare": "svelte-kit sync || echo ''", "prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint ." "lint": "eslint .",
"format": "prettier --write .",
"test": "vitest run"
}, },
"dependencies": { "dependencies": {
"@tabler/icons-svelte": "^3.35.0", "@tabler/icons-svelte": "^3.35.0",
+19 -3
View File
@@ -167,7 +167,12 @@
</button> </button>
<div class="flex items-center gap-8"> <div class="flex items-center gap-8">
<NavLink href="/leaderboard" icon={IconTrophy} label="Leaderboard" active={isActive('/leaderboard')} /> <NavLink
href="/leaderboard"
icon={IconTrophy}
label="Leaderboard"
active={isActive('/leaderboard')}
/>
<a <a
href="/" href="/"
@@ -188,7 +193,12 @@
</h1> </h1>
</a> </a>
<NavLink href="/download" icon={IconDownload} label="Download" active={isActive('/download')} /> <NavLink
href="/download"
icon={IconDownload}
label="Download"
active={isActive('/download')}
/>
</div> </div>
<div class="absolute right-4 hidden sm:flex gap-4 items-center"> <div class="absolute right-4 hidden sm:flex gap-4 items-center">
@@ -257,7 +267,13 @@
</div> </div>
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
{#each links as link} {#each links as link}
<NavLink href={link.href} icon={link.icon} label={link.label} active={isActive(link.href)} size={28} /> <NavLink
href={link.href}
icon={link.icon}
label={link.label}
active={isActive(link.href)}
size={28}
/>
{/each} {/each}
</div> </div>
</div> </div>
+3 -1
View File
@@ -2,7 +2,9 @@
<div class="space-y-6"> <div class="space-y-6">
<div class="card"> <div class="card">
<h2 class="text-2xl font-bold mb-4">Download Pac-Man</h2> <h2 class="text-2xl font-bold mb-4">Download Pac-Man</h2>
<p class="text-gray-300 mb-4">Download instructions and releases will be available here soon.</p> <p class="text-gray-300 mb-4">
Download instructions and releases will be available here soon.
</p>
</div> </div>
</div> </div>
</div> </div>
+5 -7
View File
@@ -20,12 +20,7 @@
<tr class="bg-black"> <tr class="bg-black">
<td class="py-2"> <td class="py-2">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<img <img src={entry.avatar} alt={entry.name} class="w-9 h-9 rounded-sm" loading="lazy" />
src={entry.avatar}
alt={entry.name}
class="w-9 h-9 rounded-sm"
loading="lazy"
/>
<div class="flex flex-col"> <div class="flex flex-col">
<span class="text-yellow-400 font-semibold text-lg">{entry.name}</span> <span class="text-yellow-400 font-semibold text-lg">{entry.name}</span>
<span class="text-xs text-gray-400">{entry.submittedAt}</span> <span class="text-xs text-gray-400">{entry.submittedAt}</span>
@@ -49,7 +44,10 @@
<div class="space-y-6"> <div class="space-y-6">
<div class="card"> <div class="card">
<div class="flex gap-2 border-b border-yellow-400/20 pb-2 mb-4"> <div class="flex gap-2 border-b border-yellow-400/20 pb-2 mb-4">
<button onclick={() => (activeTab = 'global')} class={tabButtonClass(activeTab === 'global')}> <button
onclick={() => (activeTab = 'global')}
class={tabButtonClass(activeTab === 'global')}
>
<IconTrophy size={16} /> <IconTrophy size={16} />
Global Global
</button> </button>
+2 -7
View File
@@ -266,9 +266,7 @@ async function extractFontMetadata(
} }
// Log extracted family name for debugging // Log extracted family name for debugging
logInfo( logInfo(` Font family: "${family}" (from ${familySource})`);
` Font family: "${family}" (from ${familySource})`
);
return { return {
family, family,
@@ -432,10 +430,7 @@ function generateUnicodeRange(whitelist: string): UnicodeRange {
// CSS Generation // CSS Generation
// ============================================================================ // ============================================================================
async function generateCssFile( async function generateCssFile(fonts: FontFaceDescriptor[], cssOutputPath: string): Promise<void> {
fonts: FontFaceDescriptor[],
cssOutputPath: string
): Promise<void> {
const lines = [ const lines = [
'/* Auto-generated by vite-plugin-font-subset */', '/* Auto-generated by vite-plugin-font-subset */',
'/* Do not edit manually - changes will be overwritten */', '/* Do not edit manually - changes will be overwritten */',