I have a simple pre-commit hook that asks the user for input and then updates the package version number. I need this pre-commit script to complete before husky finishes.
const { exec } = require('child_process');
const inquirer = require('inquirer');
const question = {
type: 'list',
name: 'version',
message: 'Semantic Version?',
choices: ['Patch', 'Minor', 'Major'],
filter(val) {
return val.toLowerCase();
},
};
const selectVersion = async () => {
const version = await inquirer.prompt(question);
exec(`npm version ${version}`);
}
selectVersion();
"scripts": {
"version:select": "node ./scripts/versionSelect.js"
},
I get prompted to input my answer but the commmit hook finishes too quickly so I am unable to interact with my question prompt as you can see here: