remarkablemark / husky-4-to-5

:dog: Migrate husky from 4 to 9.

Home Page:https://npmjs.com/package/husky-4-to-5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

husky-4-to-5

NPM

NPM version build

🐢 Migrate husky from 4 to 9.

npx husky-4-to-5

Alternatively, there's typicode/husky-4-to-8 (requires npm 7+).

Install

Global

Install with npm:

npm install --global husky-4-to-5

Install with yarn:

yarn global add husky-4-to-5

Usage

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

Explanation

The script:

  • updates package.json scripts:
    • prepends husky to prepare
  • 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

Lint files:

npm run lint

Fix lint errors:

npm run lint:fix

Release

Release and publish are automated with Release Please.

License

MIT

About

:dog: Migrate husky from 4 to 9.

https://npmjs.com/package/husky-4-to-5

License:MIT License


Languages

Language:TypeScript 51.5%Language:JavaScript 48.5%