So I'm struggling with passing command line option arguments from npm to a node script. I can pass options themselves, but not as key value pairs.
For my package.json I have:
"scripts": {
"test": ". ./.env; node app.js --"
},
(my understanding is that for npm you need to include and extra "--" to pass arguments) and in my app.js I have:
const { argv, options } = require('yargs');
console.log(argv._);
When I run
$ npm run test FOO BAR
I get:
[ 'FOO', 'BAR' ]
great, that worked, but if I try
$ npm run test FOO --BAR 99RedBalloons
I get:
[ 'FOO', '99RedBallons' ]
and
$ npm run test FOO --BAR=99RedBallons gives me:
[ 'FOO' ]
Wha? So, my question really is, using "run npm <>" and I assume yargs (since I believe that is the most popular package), how can I arrive with a arg._ of ["FOO", "Bar" : "99RedBalloons"].
Thanks!