108 lines
3.0 KiB
Markdown
108 lines
3.0 KiB
Markdown
# CHRNX WordPress Theme
|
|
|
|
Custom WordPress theme for chrnx.dev. This repository currently contains the
|
|
approved design materials and a reproducible local development scaffold.
|
|
|
|
## Prerequisites
|
|
|
|
- Node.js 22 (use `nvm use`)
|
|
- npm
|
|
- Docker through Colima on macOS
|
|
- Docker Compose v2 available as a Docker CLI plugin
|
|
|
|
## Local setup
|
|
|
|
```sh
|
|
nvm use
|
|
npm ci
|
|
npx playwright install chromium firefox webkit
|
|
colima start
|
|
PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run env:start
|
|
PATH="/opt/homebrew/opt/docker/bin:$PATH" npm run composer -- install
|
|
```
|
|
|
|
Composer is provided by the wp-env CLI container; no host Composer installation
|
|
is required.
|
|
|
|
The local WordPress site is available at <http://localhost:8888>. Once the
|
|
theme implementation exists, activate it with `npm run env:activate`.
|
|
|
|
Run the configuration smoke test with:
|
|
|
|
```sh
|
|
npm run test:smoke
|
|
```
|
|
|
|
## Local visual review
|
|
|
|
Seed the local `wp-env` site with deterministic review content:
|
|
|
|
```sh
|
|
./scripts/seed-test-content.sh
|
|
```
|
|
|
|
The script accepts only `localhost` or `127.0.0.1`. It updates records marked
|
|
with `_chrnx_fixture_key` and leaves unrelated local content alone. Repeated
|
|
runs reuse the same pages and posts.
|
|
|
|
Use an allowlisted local edge scenario, then restore the default dataset:
|
|
|
|
```sh
|
|
./scripts/seed-test-content.sh featured-1
|
|
./scripts/seed-test-content.sh featured-2
|
|
./scripts/seed-test-content.sh featured-3
|
|
./scripts/seed-test-content.sh subscribe-unpublished
|
|
./scripts/seed-test-content.sh subscribe-unavailable
|
|
./scripts/seed-test-content.sh default
|
|
```
|
|
|
|
Rebuild the responsive portrait derivatives on macOS with `sips`, `cwebp`, and
|
|
`avifenc`:
|
|
|
|
```sh
|
|
./scripts/build-responsive-images.sh
|
|
```
|
|
|
|
For a non-destructive reproducibility check, pass an explicit absolute temporary
|
|
directory: `./scripts/build-responsive-images.sh "$(mktemp -d)"`. The automated
|
|
smoke test byte-compares all 35 outputs, validates their formats and dimensions,
|
|
and enforces 160 KiB per derivative and 1.7 MiB total payload bounds.
|
|
|
|
The PNG masters remain unchanged. WordPress serves 384 px and 768 px AVIF or
|
|
WebP sources, with the PNG as a fallback.
|
|
|
|
Capture the approved local review routes with Chromium:
|
|
|
|
```sh
|
|
node scripts/capture-visual-review.mjs
|
|
```
|
|
|
|
The capture script rejects public hosts and writes its screenshots to
|
|
`tmp/imagegen/`, which Git ignores.
|
|
|
|
Use `npm run env:stop` to stop the local WordPress environment.
|
|
|
|
If Homebrew's Docker CLI cannot find an existing standalone Compose v2 binary,
|
|
link it into Docker's per-user plugin directory before starting wp-env:
|
|
|
|
```sh
|
|
compose_source="$(command -v docker-compose)" || {
|
|
echo "docker-compose is not installed" >&2
|
|
exit 1
|
|
}
|
|
docker-compose version
|
|
plugin_dir="${DOCKER_CONFIG:-$HOME/.docker}/cli-plugins"
|
|
plugin_path="$plugin_dir/docker-compose"
|
|
if [ -e "$plugin_path" ] || [ -L "$plugin_path" ]; then
|
|
echo "Refusing to replace existing $plugin_path" >&2
|
|
exit 1
|
|
fi
|
|
mkdir -p -- "$plugin_dir"
|
|
ln -s -- "$compose_source" "$plugin_path"
|
|
```
|
|
|
|
## Deployment boundary
|
|
|
|
This setup is local-only. It does not create or configure a production
|
|
deployment, publish the theme, or mutate chrnx.dev.
|