Implemented recursive calls and markdown export
This commit is contained in:
parent
8103febbb6
commit
d0e84f7391
11
exporter.js
11
exporter.js
@ -46,9 +46,20 @@ function getDependencyLicenseInfo(all_dependencies, recursive){
|
|||||||
const packageInfo = parsePackageInfo(`./package.json`);
|
const packageInfo = parsePackageInfo(`./package.json`);
|
||||||
const all = getDependencyLicenseInfo(mergeDependencies(packageInfo), args.includes("--recursive"));
|
const all = getDependencyLicenseInfo(mergeDependencies(packageInfo), args.includes("--recursive"));
|
||||||
|
|
||||||
|
if (args.includes("--json")) {
|
||||||
if (args.includes("--pretty")) {
|
if (args.includes("--pretty")) {
|
||||||
fs.writeFileSync('./licenses.json', JSON.stringify(all, null, 4));
|
fs.writeFileSync('./licenses.json', JSON.stringify(all, null, 4));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fs.writeFileSync('./licenses.json', JSON.stringify(all));
|
fs.writeFileSync('./licenses.json', JSON.stringify(all));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (args.includes("--md")) {
|
||||||
|
fs.writeFileSync('./licenses.md', "");
|
||||||
|
all.forEach((p) => {
|
||||||
|
fs.appendFileSync("./licenses.md", `# ${p.name}\n**Author**: ${p.author}\n**Repo**: ${p.repo}\n**License**: ${p.license}\n**Description**: ${p.description}\n## License Text\n${p.licensetext} \n\n`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return all;
|
||||||
|
}
|
Reference in New Issue
Block a user