vue-cli-plugin-pre-merge-commit

1.0.4 • Public • Published

pre-merge-commit

Git hooks made easy

This is a fork of husky with a few changes:

  • Prioritizes package.json located next to .git directory, instead of hard-coded upward search. This avoids the problem when a root package in a lerna monorepo and a sub package both depends on husky, it gets confused and double-updates the root git hooks with wrong paths.

  • Changed where hooks are read from in package.json:

    {
      "gitHooks": {
        "pre-merge-commit": "node script.js"
      }
    }
  • newly increased script.js:

      const GIT_REFLOG_ACTION = process.env.GIT_REFLOG_ACTION
      const targetBranch = GIT_REFLOG_ACTION.split(" ")[1];
    
      const stopMergeBranch = ["test", "pre"];
    
      if (stopMergeBranch.includes(targetBranch)) {  
        console.error(' 大哥你不能反向合并操作,赶快撤回合并吧!!');
        process.exit(1);
      }

Dependencies (5)

Dev Dependencies (5)

Package Sidebar

Install

npm i vue-cli-plugin-pre-merge-commit

Weekly Downloads

17

Version

1.0.4

License

MIT

Unpacked Size

18.6 kB

Total Files

15

Last publish

Collaborators

  • aaroc