feat: implement runtime package manager detection#164
Draft
feat: implement runtime package manager detection#164
Conversation
Member
|
This is nice idea!
|
pi0
reviewed
Nov 22, 2024
| uninstall: remove, | ||
| un: remove, | ||
| detect, | ||
| "detect-runner": detectRunner, |
Member
There was a problem hiding this comment.
It would be nice if we simplify to have nypm detect that displays both detection results.
pi0
reviewed
Nov 22, 2024
| export type PackageManager = { | ||
| name: PackageManagerName; | ||
| command: string; | ||
| packageRunner?: string; |
Member
There was a problem hiding this comment.
We might make it an array. It is a map of known args => package runner
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #164 +/- ##
===========================================
- Coverage 82.17% 60.00% -22.18%
===========================================
Files 6 5 -1
Lines 516 530 +14
Branches 71 91 +20
===========================================
- Hits 424 318 -106
- Misses 91 209 +118
- Partials 1 3 +2 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a
detectRuntimePackageManagerapi function to detect the current package manager in runtime using thenpm-config-user-agentenvironment variable. It also adds a refactor so thatargvparsing can be a safe fallback in the event that the environment variable is not set.The possible usecases for this API include
I'm currently marking this as a draft because I'd appreciate suggestions on how to implement tests for this new API.
References