This document covers local development, testing, profiling, and the content update/release workflow.
Build assets:
npm run build:assetsNote: Compiled assets in docroot/css/ and docroot/js/ are committed to git. Remember to rebuild and commit compiled assets when modifying source files in src/css/ or src/js/.
Code quality checks:
npm run check:codeRun the full test suite:
npm testNotes:
BASE_URLcan be overridden for tests that target a web server (e.g. Playwright):BASE_URL=https://pccd.dites.cat npm test- If e2e tests fail after data changes, run
npm run refresh:test-data - To run validation over many pages, use
npm run validate:sitemap-urls - If Lighthouse audits crash, try specifying
CHROME_PATH:CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" npm run validate:lighthouse
Profiling (dev only, Apache-based):
docker compose build --build-arg profiler=spx && docker compose up
docker compose build --build-arg profiler=xhprof && docker compose upProfiler reports are available in /admin/ (admin password is set in .env).
Test production setup locally (FPM + Nginx):
docker compose -f docker-compose.fpm.yml up --build- Docker
Install system dependencies for database conversion and image processing:
- Linux (Debian-based):
sudo apt-get install -y $(cat apt_dev_deps.txt) - Linux (Alpine):
apk add $(cat apk_dev_deps.txt) - macOS (Homebrew):
brew bundle install
Then install npm dependencies:
npm ciPut the MS Access database (database.accdb) and any image archives (Cobertes.zip, Imatges.zip, Obres-VPR.zip) in the root directory, then run:
npm run releaseThis single command:
- Decompresses and optimizes images (if zip files are present)
- Converts the MS Access database to MariaDB
- Rebuilds containers and waits for the database to be healthy
- Runs the installation script
- Exports the database, runs tests, and generates reports
Options:
npm run release -- --skip-images- Skip image processingnpm run release -- --skip-tests- Skip running testsnpm run release -- --skip-reports- Skip report generation
Then commit and push:
git add . && git commit -m 'new release' && git push
npm run export:codeThe release can also run entirely inside Docker using the build container:
docker compose -f docker-compose.build.yml run build npm ci
docker compose -f docker-compose.build.yml run build npm run release