Skip to content

Commit 1fdc668

Browse files
committed
build(just): add an install recipe covering the nix/tools deps
CONTRIBUTING tells contributors to run `just typecheck`, and moving @types/node into nix/tools/models-dev-gen broke that on a fresh checkout: oxlint resolves that directory's types out of its own node_modules, which nothing created. `pnpm install` does not cover it, since the tool directories sit outside the pnpm workspace. Consolidate setup into `just install`: the workspace install plus a `bun install --frozen-lockfile` for every tool directory carrying a tsconfig. Nix builds each tool's dependencies itself, so the ones with no TypeScript in them need nothing locally and are skipped. `git wt`'s hook now calls the recipe instead of running pnpm directly, so new worktrees stay usable without a manual step, and CONTRIBUTING lists it ahead of the checks it is a prerequisite for.
1 parent 1697e0f commit 1fdc668

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ Do not open a PR unless you have already been approved with `lgtm`.
4444
Before submitting a PR, run:
4545

4646
```bash
47+
just install
4748
just fmt
4849
just typecheck
4950
just test
5051
```
5152

53+
`just install` is only needed once per checkout (and after a lockfile change);
54+
`git wt` runs it for you when it creates a worktree.
55+
5256
Use the canonical `ccusage` command in docs and tests. Standalone wrapper packages such as `ccusage-codex`, `ccusage-opencode`, `ccusage-amp`, and `ccusage-pi` have been removed and should not be reintroduced.
5357

5458
Do not proactively create documentation files unless the change requires user-facing documentation.

‎justfile‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ mod rust
1919
default:
2020
@just --list
2121

22+
# Install the JS dependencies needed to work in this repository
23+
install:
24+
#!/usr/bin/env bash
25+
set -euo pipefail
26+
pnpm install --frozen-lockfile
27+
# Tool directories under nix/tools are outside the pnpm workspace. Nix builds
28+
# their dependencies itself, so only the ones carrying a tsconfig need a local
29+
# node_modules — `just typecheck` resolves their types out of it.
30+
for tsconfig in nix/tools/*/tsconfig.json; do
31+
toolDir="$(dirname "$tsconfig")"
32+
(cd "$toolDir" && bun install --frozen-lockfile)
33+
done
34+
2235
# Build every workspace package
2336
build: ccusage::build docs::build
2437

‎nix/dev-shell.nix‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ in
8080
8181
# Set up direnv and JS dependencies whenever `git wt` creates a new
8282
# worktree, so worktrees are usable without a manual step.
83-
git config --replace-all wt.hook "direnv allow || true; pnpm install --frozen-lockfile || true"
83+
git config --replace-all wt.hook "direnv allow || true; just install || true"
8484
8585
# Move deleted worktree directories to the trash instead of `rm -rf`,
8686
# which is noticeably slower on large node_modules and target trees.

0 commit comments

Comments
 (0)