function generateDependencyInfo()

in dev-utils/dep-info.js [53:91]


function generateDependencyInfo(deps, modulesPath, pkgNames) {
  var allLicenses = []
  deps.forEach(d => {
    const depModulesPath = join(modulesPath, d)
    const rootModulesPath = join(ROOT_NODE_MODULES, d)

    const dep = { name: d }

    let license
    /**
     * If dependency is one of the internal package itself,
     * we use the root level license info instead of package level
     */
    if (pkgNames.includes(d)) {
      license = getFileContent(ROOT_DIR, 'LICENSE')
    } else {
      /**
       * Search for both dep/node_modules and root/node_modules
       * since dep node modules might be hoisted
       */
      license =
        getFileContent(rootModulesPath, 'LICENSE') ||
        getFileContent(depModulesPath, 'LICENSE')
    }

    if (license) {
      dep.license = license
    }

    const notice =
      getFileContent(rootModulesPath, 'NOTICE') ||
      getFileContent(depModulesPath, 'NOTICE')
    if (notice) {
      dep.notice = notice
    }
    allLicenses.push(dep)
  })
  return allLicenses
}