–scope <package_name | name_pattern>
This filter limits the command execution scope only to packages that meet the condition. For example:
# starts a package with the name 'server'
lerna run --scope server start
# starts all packages end up on '-server'
lerna run --scope *-server start
# you can select multiple scopes at the same time
# executes either '-server's and '-client's 'start' command
lerna run --scope *-server --scope *-client start
Wait, what is this lerna?
Lerna is a monorepo tool, that makes you having all packages at hand. It significantly simplifies your git and versioning routine. Read more about lerna.
–ignore <package_name | name_pattern>
This one works as the previous, but in the opposite way. Basically, it excludes everything that matches the pattern or name.
# Runs 'npm audit' everywhere, but in ui-library
lerna exec --ignore ui-library npm audit
# Runs 'npm audit' everywhere, but in dev-server and dev-client packages
lerna exec --ignore dev-{server,client} npm audit
–stream/–parallel
Changes how the script is run accross the packages and streams app’s output to your terminal
# runs scripts accordingly to the packages topology
# streams interleaved output
# all messages are separated of each other by package name
lerna run --stream dev-* test
# runs all scrips immediately
# streams whatever comes from the apps
# all messages are separated of each other by package name
# use it wisely, as it might be really (!) slow with multiple scripts run in parallel
lerna run --parallel dev-* start
–concurrency <number_of_threads>
By default lerna tries to utilize all available CPU cores, running multiple apps simultaneously.
–concurrency 1 limits threads to one, eventually making step by step tasks execution
lerna run --concurrency 1 test // tests apps' one by one
–since <branch | tag>
The flag applies commands to changed packages only
# Builds packages that are changed from the previous git tag
lerna run --since build
# Tests packages that are different from master branch
lerna run --since master test