We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi all,
I'm working on a commit-msg hook, but I'm writing it in Node.
Problem is that then process.argv is empty in such scripts.
My file begins with:
#!/usr/bin/env node
And it only contains console.log(process.argv).
console.log(process.argv)
Husky hook in package.json is "commit-msg": "scripts/commit-msg.js -E HUSKY_GIT_PARAMS". (file has been chmod +x)
"commit-msg": "scripts/commit-msg.js -E HUSKY_GIT_PARAMS"
Console.log only has array of:
[ '/usr/local/Cellar/node/11.12.0/bin/node', '/path/to/scripts/commit-msg.js', '-E', 'HUSKY_GIT_PARAMS']
So my question is how to pass git params (a commit message) to node scripts?
The text was updated successfully, but these errors were encountered:
I'm reading commit message from
const msg = fs.readFileSync(path.join(__dirname, '../.git/COMMIT_EDITMSG'), { encoding: 'utf8' })
Sorry, something went wrong.
If anyone finds this issue, here's how I got it to work in a node script: "commit-msg": "scripts/commit-msg.js -E HUSKY_GIT_PARAMS"
scripts/commit-msg.js:
#!/usr/bin/env node const fs = require('fs'); const { HUSKY_GIT_PARAMS: gitMessagePath, } = process.env; const message = fs.readFileSync(gitMessagePath, { encoding: 'utf8' });
No branches or pull requests
Hi all,
I'm working on a commit-msg hook, but I'm writing it in Node.
Problem is that then process.argv is empty in such scripts.
My file begins with:
And it only contains
console.log(process.argv)
.Husky hook in package.json is
"commit-msg": "scripts/commit-msg.js -E HUSKY_GIT_PARAMS"
. (file has been chmod +x)Console.log only has array of:
So my question is how to pass git params (a commit message) to node scripts?
The text was updated successfully, but these errors were encountered: