2

I have the following script in my package.json.

{ "scripts": { "fetcher": "node server/processes/transport.js | bunyan" } }

I try to pass command line arguments to transport.js script like this:

npm run fetcher -- --days=10

But no arguments get passed, npm dumbly passes arguments to the end of the command.

VuesomeDev
  • 4,095
  • 2
  • 34
  • 44
  • Possible duplicate: http://stackoverflow.com/questions/35221098/passing-arguments-to-npm-script-in-package-json – aleung Oct 22 '16 at 04:25

1 Answers1

0

A dirty hack will be like

{
  "scripts": {
    "fetcher": "bunyan $(node server/processes/transport.js"
  }
}

then run the command

npm run fetcher -- --days=10)

Notice, with the hack, npm run fetcher will not work, it should be npm run fetcher -- )

hankchiutw
  • 1,546
  • 1
  • 12
  • 15