# Easy WordPress Bootstrap

Easily set up a new WordPress dev environment utilizing Laravel Herd and DBngin (or other MySQL/MariaDB solutions).

One command to spin up a new WordPress project locally:

- Creates a project folder in your Herd workspace
- Provisions MySQL DB + user via DBngin or other MySQL/MariaDB solution.
- Generates wp-config.php with salts
- Installs WP and sets default options (Home/News, other useful pages, permalinks)
- Installs/activates plugins from `plugins.json`
- Clones theme starter (with fresh history), activates it, and initializes a clean repo

## Prerequisites

- macOS or [Windows](windows/README-Windows.md) (PowerShell)
- Herd installed and a workspace directory (default: `~/Herd`)
- DBngin or other MySQL/MariaDB server
- CLI tools in PATH: `wp`, `git`, `curl`, `openssl`, `mysql`, and optionally `jq`

## Quick Start

1. Copy `wp-bootstraprc.example` to `~/.wp-bootstraprc` and edit values (one-time setup):

   ```bash
   cp wp-bootstraprc.example ~/.wp-bootstraprc
   ```

2. (Optional) Edit `plugins.json`.

3. Run the bootstrap:

   ```bash
   chmod +x wp-bootstrap.sh
   ./wp-bootstrap.sh
   ```

4. Answer prompts. When finished, the script prints a summary and writes `bootstrap-summary.txt`.

## Configuration

- **Herd workspace**: set `HERD_WORKSPACE` in `~/.wp-bootstraprc`.
- **Local TLD**: set `LOCAL_TLD` (`test` by default).
- **DBngin**: set `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_ROOT_USER`, `MYSQL_ROOT_PASS`.
- **Theme starter**: set `THEME_STARTER_REPO`. The script clones shallow, removes `.git`, then re-initializes the theme repo.
- **Theme remote**: set `DEFAULT_THEME_REMOTE_ORIGIN` if you want the script to push the new theme repo automatically.

## Plugins

Baseline plugins are defined in `plugins.json`. Each entry accepts either a WordPress.org **slug** or a direct **zip** URL.

> Premium/private zips: use signed/internal URLs or manually download and point to a local `/tmp/file.zip` (adjust the script to `wp plugin install /tmp/file.zip`).

## Notes

- The script sets friendly permalinks (`/%postname%/`) and creates Home/News pages by default.
- Sample content is removed if present.
- A plugin install log is written to `wp-content/plugin-bootstrap.log`.

## Troubleshooting

- If `wp` is not found, ensure WP-CLI is installed and available in `PATH`.
- If MySQL connection fails, confirm DBngin is running and credentials are correct in `~/.wp-bootstraprc`.
- On Windows, prefer WSL or Git Bash for best results.

--
DIY-first policy: keep `plugins.json` minimal. Add big off-the-shelf stacks (e.g., ecomm) only when warranted.
