DEV Community

trycatch
trycatch

Posted on • Edited on

3 2

Top-5 handy lerna flags for your monorepo

--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

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay