A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/orgs/pnpm/discussions/6713 below:

Allow "pnpm add" command to generate "workspace:*" when adding a workspace dependency · pnpm · Discussion #6713 · GitHub

I have been using npm for many years and have now started to move over to use pnpm. My initial feedback on pnpm is that it is indeed far superior to npm and I absolutely love it. However, I have spotted a strange issue which I have described below.

When I add a workspace dependency using pnpm add myWorkspaceLibA --workspace --filter myWorkspaceLibB, pnpm generates this in myWorkspaceLibB's package.json file:

"dependencies": {
    ...
    "myWorkspaceLibA": "workspace:^",
    ...
  },

It also generates this in the root pnpm-lock.yaml file:

  packages/myWorkspaceLibB:
    dependencies:
      'myWorkspaceLibA':
        specifier: workspace:^
        version: link:../myWorkspaceLibA

From the various articles and videos that I have seen on this, I understand that after running the pnpm add command I should change the package.json entry in myWorkspaceLibB to:

"dependencies": {
    ...
    "myWorkspaceLibA": "workspace:*",
    ...
  },

in order to ensure that it always picks up the latest version of myWorkspaceLibA in my monorepo.

However, this leaves the pnpm-lock.yaml file inconsistent with the package.json file.

I have the following questions on this:

  1. Does this matter (i.e. will this cause some unexpected behaviour in some future commands that I may run)?
  2. Should I also update the pnpm-lock.yaml file to make it consistent with the package.json file?

My gut feeling tells me that it is not a good idea for me to be manually changing the pnpm-lock.yaml file. I would therefore like to suggest that the pnpm add command be enhanced in some way so that it automagically sets workspace:* in both the package.json and pnpm-lock.yaml files.

Is this a reasonable request or have I misunderstood something here?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4