husky-4-to-5

    1.2.1 • Public • Published

    husky-4-to-5

    NPM

    NPM version build

    Migrates husky 4 to 7.

    npx husky-4-to-5

    Alternatively, there's typicode/husky-4-to-6 (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 install to postinstall
    • installs devDependency:

    If the package is not private, the script also:

    • updates package.json scripts:
      • prepends pinst --enable to postpublish
      • prepends pinst --disable to prepublishOnly
    • 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 is automated with Release Please.

    License

    MIT

    Install

    npm i husky-4-to-5

    DownloadsWeekly Downloads

    4

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    4.6 kB

    Total Files

    3

    Last publish

    Collaborators

    • remarkablemark