Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await utils.withTmpDir(async (tmp) => {
try {
process.chdir(tmp);
await adapt(["new", s.dir, "."]);
for await (const pj of globby.stream("**/package.json", { absolute: true })) {
const pjDir = path.dirname(pj.toString());
await yarn([], { cwd: pjDir });
try {
await yarn([ "audit" ], { cwd: pjDir });
} catch (err) {
errors.push({
name: s.name,
file: pj.slice(tmp.length + 1),
stdout: err.stdout,
summary: utils.grep(err.stdout, /vulnerabilities found/g).join("\n"),
});
}
}
} finally {
process.chdir(origDir);