Escape-Technologies / mookme

A pre-commit tool designed for monorepos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

post-commit hook has no effect

lstrojny opened this issue · comments

Totally possible that I am missing something but I've configured a global post-commit.json:

{
  "steps": [
    {
      "name": "Example",
      "command": "echo example"
    }
  ]
}

inspect shows it, so that's good news. When I do commit though, the hook is never executed.

It looks like the hooks are filtered out in https://github.com/Escape-Technologies/mookme/blob/beta/packages/mookme/src/loaders/hooks-resolver.ts#L244, which filters hooks against uses https://github.com/Escape-Technologies/mookme/blob/beta/packages/mookme/src/utils/git.ts#L46. Since we are in post-commit mode though, there will be no staged (or unstaged) files anymore, since they have been committed. In fact I think filterWithVCS can only work with pre-commit.

@lstrojny I implemented a fix for this part, using the new filter strategy pattern I added last week. Could you please tell me if it suits your needs ? I tested locally and I could run a post-commit hook using the files I recently commited