lib/get-files.js
async function discoverPackageFiles ({ installationId, fullName, defaultBranch, log }) {
  const ghqueue = githubQueue(installationId)
  const relevantPackageFilePaths = await discoverPackageFilePaths({ installationId, fullName, defaultBranch, log })
  const [owner, repo] = fullName.split('/')
  // Fetch the content for each relevant package.json file
  const packageFiles = await Promise.all(
    relevantPackageFilePaths.map((path) => getGithubFile(ghqueue, { path, owner, repo }))
  )

  log.info(`got ${packageFiles.length} package.json files`)
  return packageFiles
}
async function discoverPackageFiles ({ installationId, fullName, defaultBranch, log }) {
  const ghqueue = githubQueue(installationId)
  const relevantPackageFilePaths = await discoverPackageFilePaths({ installationId, fullName, defaultBranch, log })
  const [owner, repo] = fullName.split('/')
  // Fetch the content for each relevant package.json file
  const packageFiles = await Promise.all(
    relevantPackageFilePaths.map((path) => getGithubFile(ghqueue, { path, owner, repo }))
  )

  log.info(`got ${packageFiles.length} package.json files`)
  return packageFiles
}
async function discoverPackageFiles ( { installationId , fullName , defaultBranch , log } ) { const ghqueue = githubQueue ( installationId ) const relevantPackageFilePaths = await discoverPackageFilePaths ( { installationId , fullName , defaultBranch , log } ) const [ owner , repo ] = fullName . split ( '/' ) // Fetch the content for each relevant package.json file const packageFiles = await Promise . all ( relevantPackageFilePaths . map ( ( path ) => getGithubFile ( ghqueue , { path , owner , repo } ) ) ) log . info ( ` ${ packageFiles . length } ` ) return packageFiles }
Returns an array of objects, where each object describes a `package.json`: [{"content": "eyJuYW1lIjoidGVzdCJ9", "name": "package.json", "path": "frontend/package.json", "type": "file"}]
Returns an array of objects where each object describes a package . json : [ { content : eyJuYW1lIjoidGVzdCJ9 name : package . json path : frontend / package . json type : file } ]