🐶 Migrate husky from 4 to 9.
npx husky-4-to-5
Alternatively, there's typicode/husky-4-to-8 (requires npm 7+).
Install with npm:
npm install --global husky-4-to-5
Install with yarn:
yarn global add husky-4-to-5
If the CLI is installed globally, you can execute it in the command-line:
husky-4-to-5
Otherwise, you can install and execute the CLI like so:
npx husky-4-to-5
The script:
- updates
package.json
scripts:- prepends
husky
toprepare
- prepends
- installs devDependency:
Finally, the script adds the hooks from one of the config files:
.huskyrc
.huskyrc.json
.huskyrc.js
husky.config.js
The config file will be removed and changes to the repository will be committed.
Hooks may need to be manually updated to be run via the package manager. For example:
jest → npx jest
→ yarn jest
jest && eslint → npx jest && npx eslint
→ yarn jest && yarn eslint
commitlint -E HUSKY_GIT_PARAMS → npx commitlint --edit $1
→ yarn commitlint --edit $1
Lint files:
npm run lint
Fix lint errors:
npm run lint:fix
Release and publish are automated with Release Please.