You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Workspaces are one of the most popular feature of yarn.
With the builtin shell, it is now very simple to write scripts which will run regardless of the platform.
However, working with the CLI can be overwhelming in development due to the verbosity of the commands, for example
yarn workspace @myscope/myworskpace run lint
yarn workspace @myscope/myworskpace run build --some option
yarn workspace @myscope/myworskpace run start --some option --other option
Having a lot of workspaces in a monorepo with a similar set of scripts, one can make shortcuts in the root package.json using bash positional parameters:
And it still has the benefits of providing you the list of workspaces in case you mistype something ❤️
yarn start wrongworkspace
Usage Error: Workspace '@myscope/wrongworkspace' not found. Did you mean any of the following:
- @myscope/myworskpace
What about supporting positional parameters (the ${@:2} part which means "all arguments starting from the second one") in the builtin shell so this becomes possible without the use of bash -c?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Workspaces are one of the most popular feature of yarn.
With the builtin shell, it is now very simple to write scripts which will run regardless of the platform.
However, working with the CLI can be overwhelming in development due to the verbosity of the commands, for example
Having a lot of workspaces in a monorepo with a similar set of scripts, one can make shortcuts in the root
package.json
using bash positional parameters:So it becomes super easy to run a script on any workspace:
And it still has the benefits of providing you the list of workspaces in case you mistype something ❤️
What about supporting positional parameters (the
${@:2}
part which means "all arguments starting from the second one") in the builtin shell so this becomes possible without the use ofbash -c
?Regards
Beta Was this translation helpful? Give feedback.
All reactions