From 5685aa17a9016dde5ed7633cae2b50199e97cf3a Mon Sep 17 00:00:00 2001 From: Aaron <7063649+ahcodedev@users.noreply.github.com> Date: Sat, 7 Nov 2026 12:48:19 -0800 Subject: [PATCH] Update update commands --- README.md | 4 ++-- justfile | 2 +- template/.devcontainer/devcontainer.json | 4 ++-- template/CLAUDE.md | 4 ++-- template/README.md.jinja | 8 +++++--- template/justfile | 6 +++++- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 36549e8..a7955cd 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ Rust project template for [Copier](https://copier.readthedocs.io/). ## Usage - Create a new project - `copier copy gh:/rust-template path/to/new-project` -- Pull in template updates from inside a generated project - `copier update` +- Pull in template updates from inside a generated project - `just update-template` (runs `copier update`) ## Development - Install `just` - `brew install just` - Install Copier, rustup, tombi, actionlint, zizmor, prek and gitleaks with Homebrew, then cargo-binstall and the pinned Rust tools (cargo-deny, cargo-nextest, cargo-shear, cargo-llvm-cov, typos) with cargo - `just setup` - Change tool versions in `cargo_tools` at the top of the `justfile`; reinstall with `just install-tools` - - Bump them all to the latest releases and install them - `just update` + - Bump them all to the latest releases and install them - `just update-cargo-tools` - Enable the Git hooks in `prek.toml` - `prek install` - Before each commit they run `just lint` and scan the staged changes for secrets with gitleaks diff --git a/justfile b/justfile index 75cef9a..b104877 100644 --- a/justfile +++ b/justfile @@ -25,7 +25,7 @@ install-tools: cargo binstall --no-confirm {{cargo_tools}} # Bump `binstall_version` and the `cargo_tools` versions in this justfile to their latest releases, then install them -update: +update-cargo-tools: #!/usr/bin/env bash set -euo pipefail latest() { diff --git a/template/.devcontainer/devcontainer.json b/template/.devcontainer/devcontainer.json index 87b83de..2c6d399 100644 --- a/template/.devcontainer/devcontainer.json +++ b/template/.devcontainer/devcontainer.json @@ -10,9 +10,9 @@ // Install the toolchain pinned in rust-toolchain.toml, the `just` command runner, the zizmor workflow linter, the Rust tools in the justfile's // `cargo_tools` (cargo-deny, cargo-nextest, cargo-shear, cargo-llvm-cov, typos) with cargo-binstall via `just install-tools`, - // uv, actionlint and the tombi TOML formatter (from PyPI, since Debian doesn't package them), the prek Git hook manager and the gitleaks secret scanner (a checksum-verified GitHub + // uv, then actionlint, the tombi TOML formatter and Copier from PyPI with uv, the prek Git hook manager and the gitleaks secret scanner (a checksum-verified GitHub // release, since Debian's package is too old), then install the hooks if the workspace is a Git repository - "postCreateCommand": "rustup toolchain install && sudo apt-get update && sudo apt-get install -y --no-install-recommends just && cargo install --locked zizmor prek uv && just install-tools && uv tool install actionlint-py==1.7.12.25 && uv tool install tombi && uv tool update-shell && v=8.30.1 && a=$(dpkg --print-architecture | sed s/amd64/x64/) && cd /tmp && curl -fsSLO https://github.com/gitleaks/gitleaks/releases/download/v$v/gitleaks_${v}_linux_$a.tar.gz && curl -fsSL https://github.com/gitleaks/gitleaks/releases/download/v$v/gitleaks_${v}_checksums.txt | sha256sum --check --ignore-missing && sudo tar -xzf gitleaks_${v}_linux_$a.tar.gz -C /usr/local/bin gitleaks && rm gitleaks_${v}_linux_$a.tar.gz && cd - && if [ -e .git ]; then prek install; fi", + "postCreateCommand": "rustup toolchain install && sudo apt-get update && sudo apt-get install -y --no-install-recommends just && cargo install --locked zizmor prek uv && just install-tools && uv tool install actionlint-py==1.7.12.25 && uv tool install tombi && uv tool install copier && uv tool update-shell && v=8.30.1 && a=$(dpkg --print-architecture | sed s/amd64/x64/) && cd /tmp && curl -fsSLO https://github.com/gitleaks/gitleaks/releases/download/v$v/gitleaks_${v}_linux_$a.tar.gz && curl -fsSL https://github.com/gitleaks/gitleaks/releases/download/v$v/gitleaks_${v}_checksums.txt | sha256sum --check --ignore-missing && sudo tar -xzf gitleaks_${v}_linux_$a.tar.gz -C /usr/local/bin gitleaks && rm gitleaks_${v}_linux_$a.tar.gz && cd - && if [ -e .git ]; then prek install; fi", "customizations": { "vscode": { diff --git a/template/CLAUDE.md b/template/CLAUDE.md index 1d1d3bc..39273b7 100644 --- a/template/CLAUDE.md +++ b/template/CLAUDE.md @@ -8,7 +8,7 @@ Run project tasks through `just` (see `justfile`) rather than calling `cargo` di - `just setup` - install Homebrew dependencies, the pinned toolchain, the Rust tools (via `just install-tools`) and the prek Git hooks (`prek.toml`), which run `just lint` before each commit - `just install-tools` - install the Rust tools pinned in `cargo_tools` at the top of the `justfile` with cargo-binstall; bump versions there -- `just update` - bump `binstall_version` and `cargo_tools` in the `justfile` to the latest releases, then install them +- `just update-cargo-tools` - bump `binstall_version` and `cargo_tools` in the `justfile` to the latest releases, then install them - `just build` - build (pass extra flags, e.g. `just build --release`) - `just test` - run tests with cargo-nextest, then doc tests with `cargo test --doc` (pass a filter, e.g. `just test greeting`) - `just coverage` - run tests with coverage; fails below `coverage_threshold`% line coverage (set at the top of the `justfile`; `src/main.rs` excluded) @@ -47,4 +47,4 @@ prek (`prek.toml`) runs `just lint` and a gitleaks scan of the staged changes be ## Template -This project was generated from a Copier template. `.copier-answers.yml` is managed by Copier; don't edit it by hand. Template updates are pulled in with `copier update`. +This project was generated from a Copier template. `.copier-answers.yml` is managed by Copier; don't edit it by hand. Template updates are pulled in with `just update-template` (runs `copier update`; needs a clean Git working tree). diff --git a/template/README.md.jinja b/template/README.md.jinja index 32a8e96..b34209a 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -25,7 +25,7 @@ export PATH="$HOME/.cargo/bin:$(brew --prefix rustup)/bin:$PATH" ### Dev Container - Open the repo in VS Code and run **Dev Containers: Reopen in Container** - - Rust, `just`, cargo-deny, cargo-nextest, cargo-shear, cargo-llvm-cov, typos, tombi, actionlint, zizmor, prek, gitleaks and the recommended extensions are installed automatically + - Rust, `just`, cargo-deny, cargo-nextest, cargo-shear, cargo-llvm-cov, typos, tombi, actionlint, zizmor, prek, gitleaks, Copier and the recommended extensions are installed automatically - The Git hooks are installed if the workspace is a Git repository ## Project Commands @@ -35,7 +35,7 @@ Commands are defined in the `justfile` and run with [just](https://github.com/ca - List available commands - `just` - Install Homebrew dependencies, the pinned toolchain, the Rust tools and the Git hooks - `just setup` - Install or update the pinned Rust tools (`cargo_tools` in the `justfile`) - `just install-tools` -- Bump the pinned Rust tools to their latest releases in the `justfile`, then install them - `just update` +- Bump the pinned Rust tools to their latest releases in the `justfile`, then install them - `just update-cargo-tools` - Build the project - `just build` - Pass extra flags - `just build --release` - Run tests with [nextest](https://nexte.st), then doc tests - `just test` @@ -80,5 +80,7 @@ Optional: re-run the tests each time you save with [bacon](https://dystroy.org/b This project was generated from a [Copier](https://copier.readthedocs.io/) template. -- Pull in template updates - `copier update` +- Pull in template updates - `just update-template` + - Runs `copier update`; commit or stash your changes first, since Copier needs a clean Git working tree + - Pass extra flags, e.g. only ask new questions - `just update-template --skip-answered` - Don't edit `.copier-answers.yml` by hand; Copier uses it to apply updates diff --git a/template/justfile b/template/justfile index d61eb37..ff7632d 100644 --- a/template/justfile +++ b/template/justfile @@ -32,7 +32,7 @@ install-tools: cargo binstall --no-confirm {{cargo_tools}} # Bump `binstall_version` and the `cargo_tools` versions in this justfile to their latest releases, then install them -update: +update-cargo-tools: #!/usr/bin/env bash set -euo pipefail latest() { @@ -54,6 +54,10 @@ update: echo "cargo_tools := \"$tools\"" just install-tools +# Pull in template updates with Copier; needs a clean Git working tree (pass extra flags, e.g. `just update-template --skip-answered`) +update-template *args: + copier update {{args}} + # Build the project (pass extra flags, e.g. `just build --release`) build *args: cargo build {{args}}