export function getRepoInfo()

in contribs/just-repo-utils/src/repoInfo.ts [74:91]


export function getRepoInfo(options?: RepoInfoOptions): RepoInfo {
  if (_repoInfo && (!options || !options.cwd)) {
    return _repoInfo;
  }

  const [rootPath, packageLoader] = findRepoRootWithConfig(undefined, options);
  const getRushJson = getConfigLoader<RushJson>(rootPath, 'rush.json', loadCJson);
  const getLernaJson = getConfigLoader<LernaJson>(rootPath, 'lerna.json');
  const isMonoRepo = getRushJson || getLernaJson;
  _repoInfo = {
    rootPath: rootPath,
    getRushJson,
    getLernaJson,
    getPackageJson: packageLoader!,
    ...(isMonoRepo && { monorepo: getRushJson ? 'rush' : 'lerna' }),
  };
  return _repoInfo;
}