install-deps-postmerge

2.0.1 • Public • Published

install-deps-postmerge

Script for installing dependencies using npm or yarn as a postmerge git-hook.

Install

yarn add -D install-deps-postmerge

What does this module do?

This script will git a list of files by running:

git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD

It will take the results and check if package.json, package-lock.json, or yarn.lock is listed.

If any of those files is found, the script will intelligently pick the correct client (based on which lockfile changed and falling back to yarn-or-npm) to install the dependencies.

How do I use it in my project?

It can be used as part of a postmerge npm script alongside 'husky' for githook integrations:

{
  ...
  "husky": {
    "hooks": {
      "post-merge": "install-deps-postmerge"
    }
  },
  "devDependencies": {
    "husky": "latest",
    "install-deps-postmerge": "latest"
  }
}

Alternatively, if you do not want to use 'husky', the script can be added as a command in the .git/hooks/post-merge file:

# abbreviated command "idpm" 
npm run -s idpm
# or 
yarn -s idpm

Requirements

  • node: >=10

/install-deps-postmerge/

    Package Sidebar

    Install

    npm i install-deps-postmerge

    Weekly Downloads

    1,015

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    13.7 kB

    Total Files

    11

    Last publish

    Collaborators

    • camacho