|
| 1 | +# Repo Setup |
| 2 | + |
| 3 | +## Concept |
| 4 | + |
| 5 | +These are the basic dev scripts that every repo should have. They provide a standardized interface for common development tasks that works across different platforms and environments. |
| 6 | + |
| 7 | +The underlying tool is Mise-en-Place, aka "Mise" (https://mise.jdx.dev/), which manages tools and tasks within the project scope without requiring system-wide installations. |
| 8 | + |
| 9 | +The idea is that you can clone a repo on a clean machine, then run one of these scripts, and it will just work (assuming Mise is already installed). |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +1. **Mise** - The only system requirement. All other tools are managed by Mise per-project. |
| 14 | + |
| 15 | +Mise automatically: |
| 16 | +- Installs required tools (defined in `.mise.toml`) |
| 17 | +- Creates and manages virtual environments |
| 18 | +- Handles dependencies |
| 19 | +- Runs tasks with proper environment setup |
| 20 | + |
| 21 | +## Implemented Scripts |
| 22 | + |
| 23 | +### Core Scripts |
| 24 | + |
| 25 | +1. **`build_and_test.sh/.cmd`** - Runs the full build pipeline including tests, type checking, linting, and integration tests |
| 26 | +2. **`format_code.sh`** - Formats code using configured formatters |
| 27 | +3. **`run_mdsnippets.sh/.cmd`** - Updates markdown documentation with code snippets |
| 28 | + |
| 29 | +### Script Implementation Details |
| 30 | + |
| 31 | +Prefer to name scripts and tasks using `snake_case`. |
| 32 | + |
| 33 | +**Bash Scripts (.sh):** |
| 34 | +- Include error handling (`set -euo pipefail`) |
| 35 | +- Check for Mise availability with helpful error messages |
| 36 | +- Use `mise task run` to execute configured tasks |
| 37 | +- Support parallel task execution where appropriate |
| 38 | + |
| 39 | +**Windows Scripts (.cmd):** |
| 40 | +- Use Git Bash to execute the corresponding `.sh` file |
| 41 | +- Provide cross-platform compatibility without duplicating logic |
| 42 | + |
| 43 | +### Configuration |
| 44 | + |
| 45 | +Tasks are defined in `.mise.toml`. |
| 46 | + |
| 47 | +**Tool Version Management:** |
| 48 | +- Use idiomatic version files (e.g., `.java-version`, `.python-version`) for language runtimes to enable easy overrides in CI matrix testing |
| 49 | +- Configure `idiomatic_version_file_enable_tools` in `.mise.toml` to automatically detect these version files |
| 50 | +- This allows testing against multiple language versions without modifying the main configuration |
| 51 | + |
| 52 | +**CI Integration:** |
| 53 | +- CI workflows can override tool versions by writing to the version files before running tasks (e.g., `echo "11" > .java-version`) |
| 54 | +- Use matrix builds to test multiple versions: each matrix job writes its target version to the appropriate file |
0 commit comments