File: /home/f/r/e/frenchy/www/french-american.org/current/node_modules/snyk/dist/lib/print-deps.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// This option is still experimental and might be deprecated.
// It might be a better idea to convert it to a command (i.e. do not perform test/monitor).
function maybePrintDeps(options, rootPackage) {
if (options['print-deps']) {
if (options.json) {
// Will produce 2 JSON outputs, one for the deps, one for the vuln scan.
console.log(JSON.stringify(rootPackage, null, 2));
}
else {
printDeps({ [rootPackage.name]: rootPackage });
}
}
}
exports.maybePrintDeps = maybePrintDeps;
function printDeps(depDict, prefix = '') {
let counter = 0;
const keys = Object.keys(depDict);
for (const name of keys) {
const dep = depDict[name];
let branch = '├─ ';
const last = counter === keys.length - 1;
if (last) {
branch = '└─ ';
}
console.log(prefix + (prefix ? branch : '') + dep.name + ' @ ' + dep.version);
if (dep.dependencies) {
printDeps(dep.dependencies, prefix + (last ? ' ' : '│ '));
}
counter++;
}
}
//# sourceMappingURL=print-deps.js.map