67 lines
3.2 KiB
Markdown
67 lines
3.2 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
JAILGAMES is a static website for publishing and downloading indie games. Built with **Eleventy (11ty) v3** using Nunjucks templates, served via **Nginx in Docker**. **The entire site must be in Valencian (Catalan variant).** All UI text, game descriptions, taglines, and any user-facing content must be written in Valencian.
|
|
|
|
## Commands
|
|
|
|
- `npm ci` — install dependencies
|
|
- `npm run serve` — local dev server on port 8080 (auto-rebuilds on changes)
|
|
- `npm run build` — generate static site into `_site/`
|
|
- `npm run clean` — delete `_site/`
|
|
- `docker compose up --build -d` — build and run locally via Docker on port 80
|
|
|
|
## Architecture
|
|
|
|
**Static site generator (Eleventy)** configured in `.eleventy.js`:
|
|
- Input: `src/` — Output: `_site/`
|
|
- Templates: Nunjucks (`.njk`), data files: YAML
|
|
- Custom "games" collection built by reading all `src/games/*.yaml` files, sorted by `release_date` desc
|
|
- Custom filters: `dateFormat` (Spanish locale dates), `markdown` (markdown-it rendering)
|
|
- Passthrough copies: `static/logo` -> `logo`, `static/games` -> `games`, `downloads/`, `src/css`, `src/js`
|
|
|
|
**Data-driven game pages:** Each game is a YAML file in `src/games/<slug>.yaml` with fields: name, slug, tagline, description, version, release_date, tags, logo, screenshots, downloads (per-platform), engine, players, genre, repo. The `src/game.njk` template uses Eleventy pagination to generate `/game/<slug>/` pages from the games collection.
|
|
|
|
**Templates hierarchy:**
|
|
- `base.njk` — HTML shell (head, header, footer, CSS/JS includes)
|
|
- `game-card.njk` — game card partial used on the homepage grid
|
|
- `game-page.njk` — full game detail page layout
|
|
- `index.njk` — homepage iterating `collections.games`
|
|
|
|
**Static assets** live outside `src/`: `static/` for images, `downloads/` for game binaries. These are passed through to the build output and also mounted as Docker volumes for live updates without rebuilding.
|
|
|
|
## Adding a New Game
|
|
|
|
1. Create `src/games/<slug>.yaml` (copy from an existing game)
|
|
2. Add images to `static/games/<slug>/`
|
|
3. Add downloadable files to `downloads/<slug>/`
|
|
4. Ensure paths in the YAML match the actual files
|
|
|
|
## Deployment
|
|
|
|
- **Local Docker:** `docker compose up --build -d` (multi-stage Dockerfile: node build + nginx serve)
|
|
- **Production (esta máquina):** `./deploy.sh` — compila y copia a los volúmenes Docker persistentes
|
|
- **Production manual:** Uses `docker-compose.portainer.yml` with Traefik reverse proxy
|
|
- Domain: `jailgames.sustancia.synology.me`
|
|
|
|
### deploy.sh
|
|
|
|
Script para desplegar cambios en producción local. Ejecutar desde la raíz del proyecto:
|
|
|
|
```bash
|
|
./deploy.sh
|
|
```
|
|
|
|
Lo que hace:
|
|
1. `npm ci` — instala dependencias
|
|
2. `npm run build` — compila el sitio en `_site/`
|
|
3. Copia `_site/` a `/var/volumes/web_jailgames/` (contenido HTML)
|
|
4. Copia `downloads/` a `/var/volumes/web_jailgames/downloads/` (binarios de juegos)
|
|
5. Copia `nginx.conf` a `/var/volumes/web_jailgames-nginx/jailgames.conf`
|
|
6. Recarga nginx en el contenedor `jailgames` (si está activo)
|
|
|
|
Requiere `docker` (para el reload de nginx). Los volúmenes en `/var/volumes/` son propiedad del usuario `sergio`.
|