mirror of
https://github.com/morluto/rea.git
synced 2026-12-02 13:11:18 -05:00
docs(contributing): select each repository's .nvmrc for Husky hooks (#15451)
* docs(contributing): select each repository's .nvmrc for Husky hooks ~/.config/husky/init.sh runs before hooks in every repository that uses Husky, so the fixed Node.js 24 path shown earlier would force that version on other projects. The example now reads the hook repository's .nvmrc and uses that nvm install when present; repositories without an installed .nvmrc version keep the default Node.js. * docs(contributing): resolve .nvmrc through nvm in the Husky hook example The example built an install path from the raw .nvmrc text, so major versions such as 22 and aliases such as lts/* never matched nvm's full-version directories and hooks kept the default Node.js. The example now sources nvm.sh without switching versions and runs nvm use, which resolves every .nvmrc form and leaves the default in place when the version is not installed.
This commit is contained in:
+18
-3
@@ -267,9 +267,24 @@ npm run check:fast
|
||||
`npm ci` installs the exact dependencies and prepares the Husky hooks without
|
||||
building the project. Git hooks use the Node.js first on `PATH` where Git
|
||||
runs, which `nvm use` in one terminal does not change for IDEs, Git clients or
|
||||
agents. If your default Node.js is outside `package.json#engines`, put the
|
||||
pinned version first for hooks in `~/.config/husky/init.sh`, for example
|
||||
`export PATH="$HOME/.nvm/versions/node/v24.22.1/bin:$PATH"`. Run `npm run build:cached` when you need the standalone
|
||||
agents. If your default Node.js is outside `package.json#engines`, Husky reads
|
||||
`~/.config/husky/init.sh` before every hook in every repository that uses it,
|
||||
so select each repository's `.nvmrc` version there rather than one fixed
|
||||
version:
|
||||
|
||||
```sh
|
||||
if [ -f .nvmrc ] && [ -s "${NVM_DIR:-$HOME/.nvm}/nvm.sh" ]; then
|
||||
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
||||
. "$NVM_DIR/nvm.sh" --no-use
|
||||
nvm use --silent >/dev/null 2>&1 || true
|
||||
fi
|
||||
```
|
||||
|
||||
`nvm use` resolves full versions, major versions and aliases such as
|
||||
`lts/*`. Repositories without an `.nvmrc`, or whose version is not installed,
|
||||
keep the default Node.js.
|
||||
|
||||
Run `npm run build:cached` when you need the standalone
|
||||
CLI or MCP server; it compiles the runtime and bundles the authored skill.
|
||||
`npm run build` forces those tasks to rerun. Neither command generates test
|
||||
catalogs, documentation projections, or managed verification evidence. Turbo
|
||||
|
||||
Reference in New Issue
Block a user