"Lerna List" and "Lerna Changed" Returns 0 Packages
Asked Answered
B

1

11

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.

Bihari answered 7/11, 2019 at 16:52 Comment(0)
B
46

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
Bihari answered 7/11, 2019 at 17:6 Comment(1)
Thanks for sharing this. What is considered a "release" if all of the packages are private? I am in the same boat, have all my packages marked as private. Now, for the next deployment, I need to know the changed packages. How do we go about it? How do we mark a release here?Rosewater

© 2022 - 2024 — McMap. All rights reserved.