Skip to content
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: ensurePackageInstalled utility #62

Closed
wants to merge 1 commit into from

Conversation

dnldsht
Copy link

@dnldsht dnldsht commented Apr 16, 2023

Proposal for #53

I've done something similar as shown in the references by @antfu
I've called addDependency. Should I make it more complex?

@antfu
Copy link
Member

antfu commented Apr 17, 2023

I think for ensurePackageInstalled we should minimalize the overhead to shortcircuit the CLI executing when the package is installed.

@dnldsht
Copy link
Author

dnldsht commented Apr 17, 2023

@antfu I'm willing to shortcircuit the CLI executing when the package is installed, but I'm not sure how to proceed, these are my ideas:

  • use yarn list, pnpm list or npm list
  • check package.json

Should it also check the version of the package e.g. ensurePackageInstalled('nuxt@^3.0.0') must trigger addDependency if a lower version of nuxt is installed.

@antfu
Copy link
Member

antfu commented Apr 18, 2023

As you see in Vitest, we checked it using local-pkg. According to @pi0, I think here we plan to also port the functionality in local-pkg to be self-included.

@pi0
Copy link
Member

pi0 commented Aug 16, 2023

Thanks for the PR dear @dnldsht. A different implementation of ensureDependencyInstalled is merged via (rather big) #75 PR.

I would appreciate your review and feedback to improve that one ❤️

@pi0 pi0 closed this Aug 16, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants