Skip to content

fix: guard husky prepare script for non-dev installs#26

Closed
dstude wants to merge 1 commit intojrenaldi79:mainfrom
dstude:fix/husky-prepare-nondev
Closed

fix: guard husky prepare script for non-dev installs#26
dstude wants to merge 1 commit intojrenaldi79:mainfrom
dstude:fix/husky-prepare-nondev

Conversation

@dstude
Copy link
Copy Markdown
Contributor

@dstude dstude commented Apr 3, 2026

Problem

When users install sidecar globally via:

npm install -g https://github.com/jrenaldi79/sidecar

npm runs the prepare script as part of installation. Since husky is a devDependency, it isn't present in a global install context — causing the install to fail immediately with a missing module error, before sidecar is usable at all.

Fix

Guard the prepare script so husky only runs when inside a git checkout:

"prepare": "[ -d .git ] && husky || true"

This means:

  • Dev installs (cloned repo): husky installs normally
  • Global installs (no .git dir): the script exits cleanly

This is the standard pattern recommended for projects that support both development and end-user installs. No behavior change for contributors.

@jrenaldi79
Copy link
Copy Markdown
Owner

Recreated as same-repo PR #28 to enable CI workflows (fork PRs don't get secret access). See #28.

@jrenaldi79 jrenaldi79 closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants