conventional-changelog-archived-repos / validate-commit-msg

DEPRECATED. Use https://github.com/marionebl/commitlint instead. githook to validate commit messages are up to standard
http://conventionalcommits.org/
MIT License
556 stars 101 forks source link

Fails on windows - no native binary? #111

Closed SteveALee closed 6 years ago

SteveALee commented 6 years ago

When committing code in cyclic-router which has this set up as a commit hook -

C:\projects\cyclic-router\node_modules\.bin\validate-commit-msg:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^
SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

I tried calling from gtit4windows bash but still fails as npm insists on calling cmd on Windows.

Might work around with makeintg the npm hook script something like "bash -c\"node ./node_modules/.bin/validate-commit-msg\"" but quoting can soon become a nightmare

cmalard commented 6 years ago

Hi @SteveALee ,

This is an issue with cyclic-router and the way they call validate-commit-msg. They should do :

  "config": {
    "ghooks": {
      "commit-msg": "validate-commit-msg $2"
    }
  }

Plus, not an issue here but ghooks is deprecated.

You should create the issue there, nothing we can do here.

SteveALee commented 6 years ago

Thanks for the correction. I rather assumed the usage was correct. I appreciate the heads up 're ghooks, will send cyclic-router a PR.