-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: normalize packageManager
field when parsing
#184
feat: normalize packageManager
field when parsing
#184
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #184 +/- ##
===========================================
- Coverage 82.17% 64.83% -17.34%
===========================================
Files 6 5 -1
Lines 516 583 +67
Branches 71 113 +42
===========================================
- Hits 424 378 -46
- Misses 91 202 +111
- Partials 1 3 +2 ☔ View full report in Codecov by Sentry. |
I'll look into adding a simple unit test for the function |
@pi0 Warnings are now added to an optional |
@pi0
So we want the pattern to be a |
packageManager
namepackageManager
field
Thanks for the PR. worked on it a little bit more. If the name part matches the npm package name regex, we parse it as-is, otherwise, we fall back to sanitize+warn mode. I also added buildMeta with the new parser util to be exposed. |
packageManager
fieldpackageManager
field when parsing
Resolves #176
This removes the pattern
^\W+
to drop unexpected characters preceding the package manager name (and version), while still allowing unknown name patterns\w+
.If the pattern removal results in a different package name a warning will be returned and logged when used in the CLI detect command, the warning can be disabled by passing the
--warn false
.Notes
sanitizePackageManagerName
returnsany
for the sanitized name, this matches the original behavior, but gives a false sense of type safety, perhaps something to look into in a separate PR.