Use git hooks to prevent push if yarn build was not run

Created on 25 May 2022, over 2 years ago
Updated 19 September 2024, 2 months ago

Problem/Motivation

Right now, we have to make sure to run `yarn build` before we commit anything. Especially if we're running with `yarn dev` to do our development. The `build` process is actually minifying CSS, ex.g. so those two do not produce the same output. DrupalCI protects us by rejecting if the build isn't the same as what was pushed, but it would be nice to catch this earlier.

Proposed resolution

We can use a git pre-push hook to replicate the code DrupalCI is doing, which is compiling and checking for a dirty worktree. This keeps it from even getting to DrupalCI, saving Association resources, and developer frustration.

Example pseudo-code from DrupalCI:

yarn run rollup -c
git diff --quiet; NOCHANGES=$?
if [ "$NOCHANGES" -ne 0 ]; then
...
else
...
fi

Remaining tasks

  • ✅ File an issue about this project
  • ☐ Addition/Change/Update/Fix to this project
  • ☐ Testing to ensure no regression
  • ☐ Automated unit/functional testing coverage
  • ☐ Developer Documentation support on feature change/addition
  • ☐ User Guide Documentation support on feature change/addition
  • ☐ Code review from 1 Drupal core team member
  • ☐ Full testing and approval
  • ☐ Credit contributors
  • ☐ Review with the product owner
  • ☐ Release
Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States chrisfromredfin Portland, Maine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024