feat(cli): add site cli to run scripts + handle media

This commit is contained in:
Cory Dransfeldt 2025-06-05 18:48:20 -07:00
parent 5055816f68
commit d08787f5aa
No known key found for this signature in database
12 changed files with 1615 additions and 26 deletions

View file

@ -6,29 +6,43 @@ This is the source for my personal site [built using 11ty, PHP and a number of o
`npm run setup`
This will generate the required `.env` file, `apache` configs, commands and php extensions to install and enable on the server (if needed).
This will generate the required `.env` file, install dependencies and configure the CLI.
Once the CLI is installed, it is invoked by running `coryd`.
## Remote dev setup
`npm run setup:dev`
This runs `setup` and generates `apache` configs, commands and php extensions to install and enable on the server.
## Local dev workflow
1. `npm start`
1. `coryd run start`
2. Open `http://localhost:8080`
To debug and develop php components, run `npm run php`. This will start the PHP server on `http://localhost:8000` and inject required environment variables from `.env`. It will also serve the static 11ty files from `dist`, so you can test the full site locally while leaving 11ty running to generate updates to files it watches.
This will run `eleventy --watch` and the PHP cli concurrently, allowing for an environment similar to production where both static and dynamic pages are available.
## CLI
- `cli init`: begins a series of prompts to populate the config used by `cli download`.
- `cli run`: presents a list of commands available to run (described below).
- `cli run [command]`: runs the specified command immediately.
- `cli download`: presents prompts to download images, name them consistently and place them in the directories specified when running `cli init`.
## Commands
- `npm run start`: primary dev command that runs `watch` and `php` concurrently.
- `npm run start:eleventy`: starts 11ty.
- `npm run start:eleventy:quick`: starts 11ty a bit quicker (provided it's already been built).
- `npm run debug`: runs 11ty with additional debug output.
- `npm run watch`: watch and update when files change without running the web server.
- `npm run build`: builds static site output.
- `npm run php`: starts a PHP server for local development.
- `npm run update:deps`: checks for dependency updates and updates 11ty.
- `npm run setup`: populates `.env` from 1Password and installs dependencies using `npm` and `composer`.
- `npm run clean`: removes the `dist` and `.cache` folders.
- `npm run clean:cache`: removes the `.cache` folder.
- `npm run clean:dist`: removes the `dist` folder.
- `coryd run start`: primary dev command that runs `watch` and `php` concurrently.
- `coryd run start:eleventy`: starts 11ty.
- `coryd run start:eleventy:quick`: starts 11ty a bit quicker (provided it's already been built).
- `coryd run debug`: runs 11ty with additional debug output.
- `coryd run watch`: watch and update when files change without running the web server.
- `coryd run build`: builds static site output.
- `coryd run php`: starts a PHP server for local development.
- `coryd run update:deps`: checks for dependency updates and updates 11ty.
- `coryd run clean`: removes the `dist` and `.cache` folders.
- `coryd run clean:cache`: removes the `.cache` folder.
- `coryd run clean:dist`: removes the `dist` folder.
## Required environment variables