2

I would like to have in the scripts of package.json for yarn something like: "start": "concurrently yarn:start:*".

Using npm, one could call concurrently with wildcards like this:

"start": "concurrently npm:start:*",
"start:cmd1": "one_cmd.sh",
"start:cmd2": "other_cmd.sh",
"start:cmd3": "another_one.sh"

Switching to yarn it would work to call yarn run explicitly each time:

"start": "concurrently \"yarn run start:cmd1\" \"yarn run start:cmd2\" \"yarn run start:cmd3\""

Is there a shorter way and especially one that would use wildcards to automatically start all scripts matching the name pattern?

Update: Was unintentionally using yarn 3.0.2 instead of 1.11.22, where it works as intended. Would still like to know about concurrently in yarn/berry.

1 Answer 1

0

Yes, you can do it, you just need to wrap your pattern script into double quotes. Also you need to add run before start as yarn does not recognize more complex script as basic. I believe what you need is something like this:

start: "concurrently \"yarn run start:*\""
// or ...
start: "concurrently \"yarn run start:cmd*\""

You can check more complex examples of concurrently patterns in docs if you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.