Closed dnldsht closed 10 months ago
I think for ensurePackageInstalled
we should minimalize the overhead to shortcircuit the CLI executing when the package is installed.
@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:
yarn list
, pnpm list
or npm list
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.
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.
Thanks for the PR dear @dnldsht. A different implementation of ensureDependencyInstalled
is merged via (rather big) https://github.com/unjs/nypm/pull/75 PR.
I would appreciate your review and feedback to improve that one ❤️
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?