As recommended by JavaScript Playground.
add:
{
"preferGlobal":true,
"bin":{
"<cli-command>":"index.js"
}
}
remove (optional):
{ "main":"index.js" }
#!/usr/bin/env node
const args = process.argv.slice(2);
npm link
You will need to add the globals to the path:
export PATH="$(yarn global bin):$PATH"
And link:
yarn link