lerna-lite: PNPM workspace: protocol is not removed before publish

Describe the bug

As titled. This broke currently our release process 😱

lerna publish --conventional-commits --create-release github --allow-branch main --yes --message="chore(release): Publish [skip ci]"

Reproduction

  1. Create PNPM workspace
  2. Use a dependency with workspace: protocol
  3. Publish with lerna.
  4. workspace: is still in the manifest.

Lerna config and logs

lerna.json

<!-- Please paste your `lerna.json` here -->

lerna-debug.log

<!-- If you have a `lerna-debug.log` available, please paste it here -->
<!-- Otherwise, feel free to delete this <details> block -->

Environment Info

| Executable        | Version |
| ----------------- | ------- |
| `lerna --version` | v1.4.0 |
| `npm --version`   | VERSION |
| `yarn --version`  | VERSION |
| `node --version`  | VERSION |

---
OR simply run `npx lerna info` command

Used Package Manager

pnpm

Validations

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (22 by maintainers)

Commits related to this issue

Most upvoted comments

I gave this a try after merging the other 2 PRs and I can’t seem to reproduce, at least not in dry-run mode. The last PR helps a lot by providing more helpful details about the tarball and what versions are being published, I tried with this simple demo

"dependencies": {
    "@lerna-lite/core": "workspace:^1.4.1",
    "@lerna-lite/info": "workspace:1.4.1",
    "@lerna-lite/init": "workspace:^1.4.1",
    "@lerna-lite/publish": "workspace:*",
    "@lerna-lite/version": "workspace:^"
}

and ran the command you provided, in my use case I needed to turn off the new flags because npm isn’t too happy with workspace: protocol but once I turn off the lockfile-only thing, it seems to be working as expected

here’s the command I ran locally

"dist-roll-publish-dry-run": "node ./packages/cli/dist/cli.js publish --conventional-commits --create-release github --allow-branch main --yes --no-sync-workspace-lock --no-manually-update-root-lockfile --git-dry-run",

and here’s the tarball and publish details (again thanks to last PR you’ll see a lot more useful info in git-dry-run mode)

lerna-lite notice === Tarball Details ===
lerna-lite notice name:          @lerna-lite/cli
lerna-lite notice version:       1.4.2
lerna-lite notice filename:      lerna-lite-cli-1.4.2.tgz
lerna-lite notice package size:  14.9 kB
lerna-lite notice unpacked size: 68.2 kB
lerna-lite notice shasum:        10fa5b50f555adc46f2c651e579cda8d04037370
lerna-lite notice integrity:     sha512-0hsvQ+NI0URkX[...]8hS6KLOWh5flA==
lerna-lite notice total files:   39
lerna-lite notice --- dry-run details ---
lerna-lite notice temp location: C:\Temp\16f72185-bd88-499d-89d2-1b5756b00df1\lerna-lite-cli-1.4.2.tgz
lerna-lite notice package name: @lerna-lite/cli
lerna-lite notice dependencies:
lerna-lite notice @lerna-lite/core    | ^1.4.2 
lerna-lite notice @lerna-lite/info    | 1.4.2
lerna-lite notice @lerna-lite/init    | ^1.4.2
lerna-lite notice @lerna-lite/publish | 1.4.2
lerna-lite notice @lerna-lite/version | ^1.4.2
lerna-lite notice dedent              | ^0.7.0
lerna-lite notice dotenv              | ^16.0.1
lerna-lite notice import-local        | ^3.1.0
lerna-lite notice npmlog              | ^6.0.2
lerna-lite notice yargs               | ^17.5.1
lerna-lite notice
lerna-lite info dry-run> git checkout -- package.json packages\cli\package.json packages\core\package.json packages\exec\package.json packages\info\package.json packages\init\package.json packages\list\package.json packages\optional-cmd-common\package.json packages\publish\package.json packages\run\package.json packages\version\package.json
Successfully published:
 - @lerna-lite/cli@1.4.2

as you can see, workspace: is completely removed and so I can’t seem to replicate the issue from my side. Some things to note are that I’m in git-dry-run mode and I merged the last 2 PRS, however I don’t think any of these 2 points have any impact on the repro. Nonetheless, I would still suggest to use the 2 commands split that are lerna version and then later lerna publish, it’s easier to follow and probably more predictable.

I’m considering migrating the repo to a pnpm workspace to help with the support of workspace: protocol which is non-existent in npm. At the beginning I used npm so that anyone could contribute and also wanted to try npm workspaces but I’m not so impressed with it and now that I support workspace protocol it’s even harder to support. If we do migrate to pnpm then we could use breakpoint directly in the code