hlxsites / vg-macktrucks-com

Franklin site for https://www.macktrucks.com
Apache License 2.0
1 stars 27 forks source link

Fix husky config #760

Open cogniSyb opened 1 week ago

cogniSyb commented 1 week ago

Test URLs:

This PR solves a couple of things:

Add a warning for a branch name that’s too long

All developers have run into this issue at least once: not being able to continue with a PR or develop locally due to a too long branch name. There’s a limit of 63 characters. In the CLI this is being handled, but it’s not clear enough. We should be warned elsewhere as well about invalid domains due to a too long branch name. This script counts the maximum available characters for a branch by taking the repository name, which is variable in our case. When does the new message show?

  1. When switching to a branch created on github.com, with git checkout [branch-name]
  2. When pushing a branch that’s created locally, with git push --set-upstream origin [branch-name]

Execute linting only on staged files

lint-staged was meant to let you lint only what was about to be committed. The change makes sure that linting only happens on the right files; allowing you to do a partial commit, have untracked files, or have temporary changes for during development. Below a screenshot of such a situation.

Screenshot 2024-06-20 at 07 16 42

Ignore version change for package.json

With a new release, we’ll create a tag. Then, a Github Action creates a commit changing the version of our package.json. This change would trigger husky to run npm install when you checkout the updated code. This slows you down and is unnecessary. I’ve added an exception for this.

Markup for messages

For clarification, some of the messages printed by husky will have a color, so you can notice them faster.

Upgrade packages

I’ve considered upgrading the package husky, but because of some issues with v9 I’ve decided against that. We can upgrade packages later

How to test

aem-code-sync[bot] commented 1 week ago

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed. In case there are problems, just click a checkbox below to rerun the respective action.

Commits * [7bba0e0](https://github.com/hlxsites/vg-macktrucks-com/commit/7bba0e0c70cff3cb15c7074fbce749386758cddf) :white_check_mark: (latest) * [de176ea](https://github.com/hlxsites/vg-macktrucks-com/commit/de176eae9dae7991ea3522e66ada963b3b151e48) :white_check_mark: * [8ba6a3d](https://github.com/hlxsites/vg-macktrucks-com/commit/8ba6a3dd839be656d0614507b62c14e1cb6600fd) :white_check_mark: * [bdb6130](https://github.com/hlxsites/vg-macktrucks-com/commit/bdb6130e547f9d932e9cb82612457ddc3e9e0081) :white_check_mark: * [8bda6b3](https://github.com/hlxsites/vg-macktrucks-com/commit/8bda6b3ca80d78ea79bc734b0b58ab9944c1c712) :white_check_mark:
aem-code-sync[bot] commented 1 week ago
Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI