findPackageVersions
findPackageVersions(
project,packageName,options?):PackageVersionMatch[]
Defined in: simply-package-core/src/packageVersionLookup.ts:84
Find every place packageName is declared in a project, and the version declared with it.
A package can be declared four ways, all of which are searched:
- A dependency whose
packageis a versioned alias —test-package@0.1.0+2. - A dependency whose
packageis a bare name plus a siblingversionNumber. - A dependency whose
packageis a raw ID, wherepackageAliasesmaps a versioned alias forpackageNameonto that same ID. - A package directory that builds
packageName, i.e. the project’s own package version.
Matches are returned rather than resolved to a single answer because “the same package declared at two different versions in two directories” is a real project state, and only the caller knows whether that’s an error or a list to display.
Parameters
Section titled “Parameters”project
Section titled “project”SfdxProject
The parsed sfdx-project.json contents.
packageName
Section titled “packageName”string
The package name or alias to look up.
options?
Section titled “options?”FindPackageVersionsOptions = {}
Narrows which package directories are searched.
Returns
Section titled “Returns”Every match, in package-directory order, dependencies before the directory’s own
package. A match with no version means the package is declared but its version isn’t
knowable from the project file alone.