I have an npm package that has a cli:
"bin": {
"myprogram": "./cli.js"
}
It is executable by running myprogram --param value with no problem.
I couldn't find it in npm's docs but I wonder if there is an approach to set an environment variable before running cli.js
I've tried:
"bin": {
"myprogram": "TZ=utc ./cli.js"
}
but looks like npm doesn't handle it:
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/@myprogram/myprogram/TZ=utc ./cli.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/@myprogram/myprogram/TZ=utc ./cli.js'
I don't want to do this by TZ=utc myprogram.