-
-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Running npm run dev -- --foo=bar will result in concurrently --raw "npm run start" "gulp watch" "--foo=bar" which doesn't properly add the parameter to any of the commands.
The double dash -- parameter passing is part of npm run so "you can use custom arguments when executing scripts", https://docs.npmjs.com/cli/run-script
{
"scripts": {
"dev": "concurrently --raw --parameter-passthrough \"npm run start\" \"gulp watch\""
}
}We could add an--parameter-passthrough option to concurrently that would add the last command chunk onto each command piece. The last chunk that would be considered parameters could even be separated by --.
So running npm run dev -- -- --foo=bar would result in the following after npm, concurrently --raw "npm run start" "gulp watch" "--" "--foo=bar" and then finally npm run start --foo=bar && gulp watch --foo=bar
An issue is adding the extra -- for npm run arg passing. As you can see above, for it to be effective, it would actually need to be npm run start -- --foo=bar && gulp watch --foo=bar. Perhaps the npm script should be updated to include the extra -- though: "dev": "concurrently --raw --parameter-passthrough \"npm run start --\" \"gulp watch\""
If we wanted to get fancier could even add separation with --0, --1 which would go to each indexed command chunk respectively, npm run dev -- --0 --foo=bar --1 --qux=dorf which would finally end up at npm run start -- --foo=bar && gulp watch --qux=dorf