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!: refactor detection to support multi versions #42

Merged
merged 3 commits into from
Mar 29, 2023
Merged

feat!: refactor detection to support multi versions #42

merged 3 commits into from
Mar 29, 2023

Conversation

Intevel
Copy link
Contributor

@Intevel Intevel commented Feb 24, 2023

This PR is a bit of a breaking change, but one that makes sense in my eyes.

Before we had a very simple structure, the package manager name was also the command, for a lock file there was an extra type.
However, this causes problems if you want to provide support for multiple Package Manager versions, as an example yarn berry but also pnpm 6.

Because I can't just add "yarn" or "pnpm" to the package manager array again.


With this PR everything is brought together, there is an array with the Package Manager objects which contain the name, the version, the command and a lockFile.

#12

After this PR we can also solve #11, and we can add similiar situations with package Manager versions more easier in the future.

@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Merging #42 (5c7c666) into main (6db58c4) will decrease coverage by 1.46%.
The diff coverage is 93.54%.

❗ Current head 5c7c666 differs from pull request most recent head 6120ab6. Consider uploading reports for the commit 6120ab6 to get more accurate results

@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
- Coverage   97.32%   95.86%   -1.46%     
==========================================
  Files           5        5              
  Lines         112      121       +9     
  Branches       29       31       +2     
==========================================
+ Hits          109      116       +7     
- Misses          3        5       +2     
Impacted Files Coverage Δ
src/detect.ts 94.64% <88.88%> (-3.51%) ⬇️
src/api.ts 100.00% <100.00%> (ø)
src/types.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pi0
Copy link
Member

pi0 commented Mar 29, 2023

Thanks for working on this PR @Intevel and sorry for delay i needed a moment to check it locally.

I love the overall direction. Have added few refactors, to generalize idea of supporting same package manager with multiple versions. For yarn, we have two detectors for instance now.

@pi0 pi0 changed the title feat!: refactor detection & add yarn berry support feat!: refactor detection to support multi versions Mar 29, 2023
@pi0 pi0 merged commit 23dc546 into unjs:main Mar 29, 2023
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.

2 participants