Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Lerna List" and "Lerna Changed" Returns 0 Packages

Gist

I have a monorepo and I am using yarn workspaces and lerna to manage it. I had no issues with it until now. I need to know all the changed packages since the last release.

Issue

So I run lerna changed (docs), but this is what it returns:

info cli using local version of lerna
lerna notice cli v3.16.4
lerna info Looking for changed packages since v0.3.0
lerna info No changed packages found

Similarly, lerna doesn't find any packages when running lerna list (docs):

info cli using local version of lerna
lerna notice cli v3.16.4
lerna success found 0 packages

It seems like something is broken. But I can't find any issues in my setup.

Setup

File tree

├── lerna.json
├── package.json
├── packages
│   ├── enums
│   ├── event-sourcing
│   ├── models
│   └── utils
└── services
    ├── consumer
    ├── frontend
    ├── gateway
    └── ideas

lerna.json

{
  "packages": [
    "packages/*",
    "services/*"
  ],
  "version": "0.3.0",
  "useWorkspaces": "true"
}

package.json

{
  "name": "cents-ideas",
  "version": "0.0.0",
  "workspaces": [
    "packages/*",
    "services/*"
  ],
  "private": true,
  "devDependencies": {
    "lerna": "^3.16.4",
    "npm-run-all": "^4.1.5",
    "rimraf": "^3.0.0",
    "typescript": "^3.6.2"
  }
}

The entire repository is on GitHub, if you want to take a closer look at it.

like image 664
Flo Avatar asked Nov 07 '19 16:11

Flo


1 Answers

The solution is very simple. As all my packages have a "private": true in their package.json files, I need to add the --all flag.

lerna changed --all
lerna list -all
like image 164
Flo Avatar answered Oct 10 '22 21:10

Flo