DEV Community

loading...

Top-5 handy lerna flags for your monorepo

try_catch
I know some code
Updated on ・1 min read

--scope

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
Enter fullscreen mode Exit fullscreen mode

--ignore

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
Enter fullscreen mode Exit fullscreen mode

--stream/--parallel

Find more about my personal monorepo experience on my blog

Discussion (0)