in contribs/just-repo-utils/src/packageInfo.ts [18:36]
export function getPackageInfo(options?: PackageInfoOptions): PackageInfo {
options = validateOptions(options);
const { retrievePackageInfo, cachePackageInfo } = require('./internal/packageInfoCache');
const { infoFromEntries, buildPackageInfoFromGlobs, buildPackageInfoFromRushProjects } = require('./internal/packageInfoHelpers');
const { strategy = 'normal' } = options;
let repoPackageInfo = strategy === 'normal' && retrievePackageInfo();
if (!repoPackageInfo) {
const repo = getRepoInfo(options);
if (repo.getLernaJson) {
repoPackageInfo = buildPackageInfoFromGlobs(repo.rootPath, repo.getLernaJson().packages);
} else if (repo.getRushJson) {
repoPackageInfo = buildPackageInfoFromRushProjects(repo.rootPath, repo.getRushJson().projects);
}
if (strategy !== 'no-cache' && repoPackageInfo) {
cachePackageInfo(repoPackageInfo);
}
}
return infoFromEntries(repoPackageInfo || {});
}