question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PNPM workspace: protocol is not removed before publish

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
ghiscodingcommented, Jun 7, 2022

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.

1reaction
ghiscodingcommented, Jun 4, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow to use pnpm as a publish utility · Issue #280 - GitHub
The issue is that semantic release uses npm cli tool for publishing which does not remove workspace: protocol and eventually the package is...
Read more >
Workspace | pnpm
Luckily, pnpm supports the workspace: protocol. When this protocol is used, pnpm will refuse to resolve to anything other than a local workspace...
Read more >
Setup a Monorepo with PNPM workspaces and speed it up ...
I also removed the version property since it is not used. As the technology stack I've chosen to go with React (so we...
Read more >
Advanced package manager features for npm, Yarn, and pnpm
npm workspaces; Yarn Berry workspaces; pnpm workspaces ... and no installation step is required before you start the application.
Read more >
Setup a monorepo with PNPM workspaces and add Nx for ...
Deep dive session where @juristr walks you through setting up a new monorepo with PNPM workspaces, adds a Remix app and a shared...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found