Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm link --global <pkg> turns devDependency into dependency #5478

Closed
Anoesj opened this issue Oct 11, 2022 · 2 comments · Fixed by #5512
Closed

pnpm link --global <pkg> turns devDependency into dependency #5478

Anoesj opened this issue Oct 11, 2022 · 2 comments · Fixed by #5512
Milestone

Comments

@Anoesj
Copy link

Anoesj commented Oct 11, 2022

pnpm version:

7.13.4

Code to reproduce the issue:

In my case, I was in the root of a pnpm workspace, which had some global packages installed there. I'm using shamefully-hoist=true in my root .npmrc file. I had an NPM package installed from the NPM registry (installed with pnpm i -D <pkg>), then forked that packaged to make a contribution. I linked the forked package by running pnpm link --global and then went back to my pnpm workspace and ran pnpm link --global <pkg>, in my case in the root of a pnpm workspace.

Expected behavior:

package.json is not altered, the dependency stays a devDependency, as it already was.

Actual behavior:

After running all steps described above, the package was turned into a regular dependency.

Additional information:

  • node -v prints: v16.17.0
  • Windows, macOS, or Linux?: macOS
@lvqq
Copy link
Member

lvqq commented Oct 12, 2022

pnpm link -g <pkg> uses the default config, which will always write pkg to dependencies.
Is it necessary to support option --save-prod/--save-dev here? Or add logic to read where the existing pkg locates? cc @zkochan

Refer:

@zkochan
Copy link
Member

zkochan commented Oct 15, 2022

It should not change the type of the dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants