-
Notifications
You must be signed in to change notification settings - Fork 83
Include user agent sniffing #6783
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
base: main
Are you sure you want to change the base?
Conversation
| installCommand: 'pnpm install', | ||
| runCommand: 'pnpm run', | ||
| localPackageCommand: 'pnpm', | ||
| remotePackageCommand: ['pnpm', 'dlx'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about pnpx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpx was deprecated in pnpm v6, I believe, although it still seems to work as an alias
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it was un-deprecated. It's no longer documented as such. I guess it's safer to keep as this.
packages/build-info/src/package-managers/detect-package-manager.ts
Outdated
Show resolved
Hide resolved
…r.ts Co-authored-by: Matt Kane <m@mk.gg>
1b495d9 to
a0dd37d
Compare
| * 3. a lock file that is present in this directory or up in the tree for workspaces | ||
| */ | ||
| export const detectPackageManager = async (project: Project): Promise<PkgManagerFields | null> => { | ||
| const sniffedPkgManager = sniffUserAgent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of our usage is done on user behalf and in this case sniffing is not desirable, because it would detect what we use and not what user does and might lead to unexpected results.
Given this is new capability - this should be some kind of opt-in, so it doesn't accidentally affect our existing flows while still allowing to opt into it when integrating detection in user initiated flows
Summary
This adds npm user agent sniffing to the package manager detection logic. Previously, package manager detection logic relied on lockfiles, which requires the project to already have been created. Another use case for package manager detection logic is figuring out which package manager ran a creation flow. In that case (e.g.
npm create cloudflarevspnpm create cloudflare) there's no lockfile to go off, and so we need to rely on the user agent.This copies over logic from Wrangler with the intention of removing it in Wrangler entirely and relying on
@netlify/build-info.For us to review and ship your PR efficiently, please perform the following steps:
we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
something that`s on fire 🔥 (e.g. incident related), you can skip this step.
your code follows our style guide and passes our tests.
A picture of a cute animal (not mandatory, but encouraged)