PrayTeam / scriptured-prayer

GNU Affero General Public License v3.0
1 stars 0 forks source link

feat: restore local husky install whilst ignoring in production workflow #84

Closed asherlloyd closed 3 months ago

asherlloyd commented 3 months ago

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 the scriptured-prayer-components directory skipping husky and the hooks that it installs for us (currently commit-msg and pre-commit).

How this has been tested

Running the below:

$ yarn install --production --ignore-scripts

successfully skips the husky postinstall step and yields the following:

warning Ignored scripts due to flag.
Done in 1.09s.

Types of changes

Screenshots

N/A

Checklist:

Soyokaze-42 commented 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.

asherlloyd commented 3 months ago

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.

Soyokaze-42 commented 3 months ago

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.

asherlloyd commented 3 months ago

@Soyokaze-42 fair point. I've opted to close this request and instead update the documentation to recommend the correct install procedure.