I have a large Node repo with many npm scripts to manage the project. I created an interactive script with Inquirer.js to act as an entry point to help developers to navigate. The script outputs the result in JSON.
To pick the selected npm script, and run it, I tried the following:
{
"scripts": {
"dev": "node dev.js | jq .project | xargs yarn run"
}
}
But instead of seeing the Inquirer script, this command stalls with an error message coming from jq
.
What's the right way to wait for the result before piping to the next program?