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

Init projects with pnpm when invoking hardhat from pnpx #6335

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

antico5
Copy link
Contributor

@antico5 antico5 commented Feb 18, 2025

Uses the npm_config_user_agent env variable to tell if it's been invoked by pnpm dlx or pnpx

I also tried other 2 approaches but discarded them:

  • Using process.argv: the binary is set as "node" even though initially invoked by pnpx
  • Using process._: this doesnt work on windows cmd/powershell

From what I've researched and manually tested, npm_config_user_agent is set on both type of operating systems

Closes #6321

@antico5 antico5 requested a review from galargh February 18, 2025 20:27
Copy link

changeset-bot bot commented Feb 18, 2025

⚠️ No Changeset found

Latest commit: b95330e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Feb 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 0:39am

Copy link
Member

@galargh galargh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be OK because even if process.env.npm_config_user_agent is not available, we'll just fall back to the original behaviour.

@kanej kanej added this pull request to the merge queue Feb 19, 2025
Merged via the queue into v-next with commit 49b986f Feb 19, 2025
75 checks passed
@kanej kanej deleted the use_pnpm_when_invoking_through_pnpx branch February 19, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants