tj-digital/mimir
Composer 安装命令:
composer create-project tj-digital/mimir
包简介
A WordPress skeleton installation template with WP CLI integration for modern Wordpress development
README 文档
README
A portable bash setup script for new GAIN WordPress projects. Handles WordPress core installation, Erebus parent theme setup, child theme scaffolding, and git initialisation — all via WP-CLI.
Prerequisites
Ensure the following are available in your environment before running the script:
| Tool | Install | Notes |
|---|---|---|
| WP-CLI | brew install wp-cli |
wp --info should return without error |
| Git | brew install git |
|
| PHP 8.2+ | via Valet or Homebrew | |
| MySQL / MariaDB | via Valet or Docker | Server must be running before mimir is invoked |
| MySQL client | brew install mysql-client |
Required by WP-CLI for database operations — see note below |
MySQL client note: WP-CLI's database commands require the
mysqlbinary to be available in your PATH, even when MySQL is already running via Valet or Docker. Install the client tools withbrew install mysql-client. Homebrew installs this as keg-only (not auto-linked), but the script handles that automatically.
Installation
Install mimir as a global command once, then use it for every new project:
curl -fsSL https://raw.githubusercontent.com/thisisgain/Mimir/main/install.sh | bash
This downloads setup.sh to /usr/local/bin/mimir and prompts for your password (sudo required to write there). You only need to do this once per machine.
To update to the latest version, run the same command again.
Usage
From an empty directory that will become your project root:
mkdir my-project && cd my-project mimir
Local development (without global install)
If you have the repo cloned locally, you can symlink the script instead of installing a static copy — any changes you make to the repo are reflected immediately:
sudo ln -sf /path/to/Mimir/setup.sh /usr/local/bin/mimir
What the script does
The interactive wizard walks through the following steps in order:
- Requirements check — verifies WP-CLI, Git, and PHP are available
- Database configuration — DB name, user, password, and host
- Site configuration — URL, title, admin credentials
- WordPress core — downloads core (
en_GB), generateswp-config.php, creates the database, runs the install - Theme setup — clones Erebus as the parent theme, scaffolds a child theme with the correct
Template:header - Git initialisation — writes a
.gitignore, makes the initial commit onmain, optionally sets a remote and pushes - (Placeholder) Plugin installation
- (Placeholder) Optional WP settings configuration
- (Placeholder) Front-end build dependency installation
After setup
Navigate into the Erebus parent theme directory and follow its README to install and run the front-end build:
cd wp-content/themes/erebus # follow Erebus README
wp-config.php
wp-config.php is intentionally excluded from version control. It should be created per-environment:
- Local — generated automatically by this script
- WP Engine — added via the WP Engine custom config panel or directly on the server
TODO
The following are planned additions. Each has a placeholder stub in setup.sh marked with a TODO comment.
-
Child theme scaffold —
setup_themes()generates placeholderstyle.css,functions.php, andindex.phpfiles. These need updating once the Erebus child theme approach is finalised (asset enqueuing, namespace setup, any required config files). -
Plugin installation —
setup_plugins()is a stub. Implement a default plugin set installed and activated viawp plugin install <slug> --activate. Consider either a hardcoded list or aplugins.jsonconfig file for flexibility. -
Settings configuration —
setup_config()is a stub. Implement optional WordPress settings (permalink structure, timezone, default post/comment settings, etc.) usingwp option update. -
Build dependencies —
setup_build()is a stub. Once the Erebus build tooling is confirmed, implementnpm install(and an optional initial build run) in both the parent and child theme directories.
Troubleshooting
env: mysql: No such file or directory
WP-CLI needs the mysql binary even when MySQL is already running. Install the client tools:
brew install mysql-client
The script adds /opt/homebrew/opt/mysql-client/bin to PATH automatically, so no further config is needed.
Error: Database connection error (2002) No such file or directory
PHP is trying to connect via a Unix socket but can't find it. Use 127.0.0.1 instead of localhost as the DB host — this forces a TCP connection which works reliably with both Valet and Docker.
Error: WordPress files seem to already be present here
The script is resumable — re-run mimir from the same directory and it will skip any steps that already completed (WP download, config, DB creation, theme setup) and continue from where it left off.
Deprecation notices in WP-CLI output
The script filters PHP deprecation and notice lines from WP-CLI output automatically. If you still see them, ensure you are running the latest version of the script (mimir --help shows the version).
Contributing
Branch from main, open a PR, and tag the GAIN dev team for review.
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unlicense
- 更新时间: 2022-01-22