Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function filterResultList(pkgList, viewOptions) {
let result = viewOptions.showAll ? pkgList.slice() : pkgList.filter(pkg => !pkg.private);
if (viewOptions.isTopological) {
// allow cycles, output needs to be usable for debugging circularity
result = QueryGraph.toposort(result);
}
return result;
}
const e2eDir = getE2EDir();
if (e2eDir) {
extraPaths.push(e2eDir);
}
const packages = fs
.readdirSync(packagesPath)
.map((fileName) => path.join(packagesPath, fileName))
.concat(extraPaths)
.filter((filePath: string) => {
if (!fs.statSync(filePath).isDirectory()) return false;
return fs.existsSync(path.join(filePath, 'package.json'));
})
.map((filePath) => readPackageInfo(filePath));
_packages = QueryGraph.toposort(packages);
return _packages;
}