-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Discussed in https://github.com/orgs/pnpm/discussions/6713
Originally posted by Mufasa June 25, 2023
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:
- Does this matter (i.e. will this cause some unexpected behaviour in some future commands that I may run)?
- Should I also update the
pnpm-lock.yamlfile to make it consistent with thepackage.jsonfile?
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?