fix(install): make prek optional in prepare script (fixes #731)#746
fix(install): make prek optional in prepare script (fixes #731)#746cv merged 2 commits intoNVIDIA:mainfrom
Conversation
The prepare script runs 'prek install' to set up git hooks, but prek is a devDependency. When end users install NemoClaw from a git checkout without --include=dev (or when the installer runs 'npm install --ignore-scripts' then later triggers prepare), prek is not available and npm exits with code 127. Fix: Guard the prek invocation with 'command -v prek' so it only runs when the binary is actually installed (i.e., in a dev environment). End-user installs skip hook setup gracefully.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Thanks for submitting this PR, it makes prek optional in the prepare script, which could improve the CI/CD pipeline and user experience by providing more flexibility and preventing potential issues. |
cv
left a comment
There was a problem hiding this comment.
Fixes the right problem, but as-is this silently skips hook setup even for developers where prek should be available (e.g. devDeps installed but binary somehow broken). Consider distinguishing "prek intentionally absent" (deploy/CI) from "prek should be here but isn't" (dev) — see inline suggestion.
Fixes #731
Problem
The
preparescript inpackage.jsonunconditionally runsprek installto set up git hooks. Sinceprekis a devDependency (@j178/prek), it's not installed when:npm installwithout--include=devnpm install --ignore-scriptsthen later triggersprepareThis causes
npm error code 127(sh: 1: prek: not found) and blocks installation.Solution
Guard the
prekinvocation withcommand -v prekso the prepare hook only runs when prek is actually available:Developers with devDependencies installed get hooks as before. End-user installs skip hook setup gracefully.
One-line change
Only
package.jsonis modified.Summary by CodeRabbit