Closed joeykilpatrick closed 1 year ago
This is already available: cli.pkg
@sindresorhus I think it could be worth adding something like a cli.pkgVersion
. Thereās been a few discussions about moving away from read-pkg-up
or lazy parsing package.json
when cli.pkg
is first accessed for performance; having a quick access for the version number could be beneficial.
How is cli.pkgVersion
better than just cli.pkg.version
when cli.pkg
is lazy?
Youāre right, didnāt fully consider that.
Would be nice if there was access to the package version like so:
I know
cli.showVersion()
is available, but it prints the string instead of returning it. Without this feature, thepackage.json
must be parsed separately, which this package is already doing internally.Alternatively, this package could expose the entire parsed
package.json
.Would be more than happy to submit a PR.