node.js - How to access flag passed to npm script -
in package json created seed script uses mocha initialize environment , run bunch of database calls:
"seed": "./node_modules/.bin/mocha seed/seed-bootstrap.js seed/seed.js" i want able pass flag specifies seed number determine how many of each object created run
npm run script --seednum=10 and have 10 of each object created.
i can't figure out how access value of seednum inside script. thought in process.argv not. process.argv seems contain contents of mocha.opts file.
like so:
npm run seed -- --seednum=4
as per
https://docs.npmjs.com/cli/run-script
apparently first -- used npm delimiter arguments intended npm , arguments thereafter intended script.
Comments
Post a Comment