I have a package.json that looks similar to this:
"scripts": { "dev": "cross-env BABEL_ENV=client webpack --config webpack/client.development.js && yarn dev:stub-server | cross-env BABEL_ENV=server babel-node src/server/server.js", "dev:stub-server": "./node_modules/.bin/robohydra ./stubs/robohydra-config.json -p 3100" }
I added some logic in the code to change the way the dev:stub-server
is configured depending on a command line argument. So, whenever I run the following I get what I expect:
yarn dev:stub-server --results=4 $ ./node_modules/.bin/robohydra ./stubs/robohydra-config.json -p 3100 -- --results=4
As you can see, the options are forwarded to the underlying script and everything works as expected.
My problem is that I cannot have the --results
propagated from the yarn dev
command to dev:stub-server
in the correct position. The parent script runs dev:stub-server
but the argument is forwarded to the underlying script at the end as follows:
yarn dev --results=2 $ cross-env BABEL_ENV=client webpack --config webpack/client.development.js && yarn dev:stub-server | cross-env BABEL_ENV=server babel-node src/server/server.js --results=2
Is there a way to make the above work as follows instead?
yarn dev --results=2 $ cross-env BABEL_ENV=client webpack --config webpack/client.development.js && yarn dev:stub-server --results=2 | cross-env BABEL_ENV=server babel-node src/server/server.js
Thanks in advance!
yarn run [script] [<args>] json . You can pass additional arguments to your script by passing them after the script name. Running this command will execute jest -o --watch . [script] can also be any locally installed executable that is inside node_modules/.
To set a environment variable you need to use the set command. The result should look like this: set PORT=1234 && yarn start:dev . Save this answer.
YARN commands are invoked by the bin/yarn script. Running the yarn script without any arguments prints the description for all commands. YARN has an option parsing framework that employs parsing generic options as well as running classes.
On mac I am using:
"scripts": { "benchmark": "sh -c 'ng run ${0}:benchmark'", }
Which I then call yarn benchmark editor
where editor
is my parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With