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

feat: detect running package manager #120

Merged
merged 2 commits into from
Apr 25, 2023
Merged

feat: detect running package manager #120

merged 2 commits into from
Apr 25, 2023

Conversation

nhedger
Copy link
Contributor

@nhedger nhedger commented Apr 23, 2023

Description

This PR adds support for detecting the package manager that started the preset.

Closes #119.

How it works

The current detection strategy has been updated to take into account the npm_config_user_agent environment variable that major package managers set when running.

Important

  • This detection strategy takes precedence over the existing lockfile-based detection strategy.
  • If the npm_config_user_agent variable is undefined, the detection falls back to the lockfile-based detection strategy.

Notes

I have added tests and have added --ignore-workspace to commands running in tests with pnpm, to prevent updating the root pnpm-lock.yaml file in the repository when running tests.

@netlify
Copy link

netlify bot commented Apr 23, 2023

Deploy Preview for usepreset ready!

Name Link
🔨 Latest commit d9e6f0b
🔍 Latest deploy log https://app.netlify.com/sites/usepreset/deploys/64452f89b5dbd4000856321e
😎 Deploy Preview https://deploy-preview-120--usepreset.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@nhedger
Copy link
Contributor Author

nhedger commented Apr 23, 2023

Unless a different order for the detection strategy is desired, this PR is ready for review.

@nhedger nhedger marked this pull request as ready for review April 23, 2023 13:16
@innocenzi
Copy link
Member

Neat, thanks a lot! At first glance this looks good, I'll double-check, merge and release tomorrow when I get back home

@innocenzi innocenzi merged commit bf79010 into preset:main Apr 25, 2023
5 checks passed
@innocenzi
Copy link
Member

Thank you!

@nhedger
Copy link
Contributor Author

nhedger commented Apr 25, 2023

Thank you @innocenzi !

@nhedger nhedger deleted the feat/detect-running-package-manager branch April 25, 2023 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to detect which package manager was used to run the preset
2 participants