Closed asherlloyd closed 3 months ago
This was one of the options I considered while looking at this issue. The problem I had with it was the --ignore-scripts flag skips all the dependency scripts, too, so we could get into a situation where we have a script that needs to run for a dependency that will run in dev but not in prod. It also skips more than just the postinstall script.
Why do we need to install husky in /package.json and in /scriptured-prayer-components/package.json? When I deleted the line, I figured we would run yarn install in the root anyway, so the postinstall script contents are unnecessary in scriptured-prayer-components.
Turns out it was the --production
flag that was causing the dependency install to fail :) I have removed that and the build succeeds now.
Think of it as a guardrail. Without this - if a developer happens to run a Yarn install in the React directory (as opposed to the root directory) the husky install will not take place and therefore the commit hooks that we have in place to ensure clean, readable commits would be ignored. In an ideal situation, we would just enforce installing in the root directory, but I like to have this as a local-only fallback to avoid troubleshooting install problems.
So it is a guardrail for a developer not following install instructions for a guardrail to make sure developers follow the semantic commit message requirements before they commit locally. But it also prevents us from including any dependencies that have scripts.
@Soyokaze-42 fair point. I've opted to close this request and instead update the documentation to recommend the correct install procedure.
Description
Effectively reverts #82 for local installs, with the caveat explained below.
Reason
Husky is an important piece of the local development workflow; the
postinstall
script is for the purpose of preventing accidental Yarn installs from thescriptured-prayer-components
directory skipping husky and the hooks that it installs for us (currentlycommit-msg
andpre-commit
).How this has been tested
Running the below:
successfully skips the husky postinstall step and yields the following:
Types of changes
Screenshots
N/A
Checklist: