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

Set npm_config_user_agent when running pnpx and pnpm create #3985

Closed
1 task done
cyco130 opened this issue Nov 13, 2021 · 6 comments · Fixed by #4317
Closed
1 task done

Set npm_config_user_agent when running pnpx and pnpm create #3985

cyco130 opened this issue Nov 13, 2021 · 6 comments · Fixed by #4317

Comments

@cyco130
Copy link

cyco130 commented Nov 13, 2021

Describe the user story

In create-* packages one often wants to install npm dependencies at the end of project initialization. But this requires determining the preferred package manager of the user. Most packages add a CLI option or prompt for this purpose. But the user has already expressed their choice buy running npm init, yarn create, or pnpm create (or init, or pnpx create-* etc.). We could determine the package manager choice if there was a way to determine the package manager that launched the create-* script.

Describe the solution you'd like

npm and yarn set the npm_config_user_agent environment variable under these circumstances but pnpm doesn't. The problem would be solved if it did. The inconsistency with the other package managers even suggests that it may simply be a bug and not a missing feature.

Describe the drawbacks of your solution

None I can think of.

Describe alternatives you've considered

There are no alternatives I can think of but asking the user explicitly for their package manager preference.

@bestickley
Copy link

Thank you @cyco130 for raising this.
Here is a relevant SO post for others who are curious: https://stackoverflow.com/questions/68133683/is-there-a-cross-platform-way-to-get-the-name-of-the-parent-process-in-node-js

@cyco130
Copy link
Author

cyco130 commented Dec 6, 2021

@bestickley Heh, that's also me 😁

@bestickley
Copy link

😆 well, thank you again!

@zkochan
Copy link
Member

zkochan commented Dec 6, 2021

Not sure why it is not set when pnpm init runs. We set it for sure in pnpm run and pnpm install. We should fix this.

@vhscom
Copy link

vhscom commented Feb 10, 2022

tauri users desiring to use pnpm could get a better dx when this is fixed. not exactly a game-changer but it's a rough edge affecting some external integrations which could help increase traction if fixed.

@vhscom
Copy link

vhscom commented Feb 11, 2022

damn that was quick work. nice job. 👌

@zkochan zkochan added this to the v6.31 milestone Feb 14, 2022
virtuoushub added a commit to virtuoushub/create-t3-app that referenced this issue Aug 27, 2022
virtuoushub added a commit to virtuoushub/create-t3-app that referenced this issue Aug 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Status
in progress
Development

Successfully merging a pull request may close this issue.

4 participants