Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Dec 24, 2024
1 parent 50a2d4f commit 59e97b7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
43 changes: 24 additions & 19 deletions lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2539,26 +2539,31 @@ export async function createNodejsBom(path, options) {
const dlist = parsedList.pkgList;
let tmpParentComponent = dlist.splice(0, 1)[0] || {};
if (!Object.keys(parentComponent).length) {
const basePath = dirname(f);
const packageJsonF = join(basePath, "package.json");
if (existsSync(packageJsonF)) {
const pcs = await parsePkgJson(packageJsonF, true);
if (pcs.length) {
tmpParentComponent = pcs[0];
tmpParentComponent.type = "application";
tmpParentComponent.name = "project-name" in options ? options.projectName : tmpParentComponent.name;
ppurl = new PackageURL(
"npm",
options.projectGroup || tmpParentComponent.group,
"project-name" in options ? options.projectName : tmpParentComponent.name,
options.projectVersion || tmpParentComponent.version,
null,
null,
).toString();
tmpParentComponent["bom-ref"] = decodeURIComponent(ppurl);
tmpParentComponent["purl"] = ppurl;
}
const basePath = dirname(f);
const packageJsonF = join(basePath, "package.json");
if (existsSync(packageJsonF)) {
const pcs = await parsePkgJson(packageJsonF, true);
if (pcs.length) {
tmpParentComponent = pcs[0];
tmpParentComponent.type = "application";
tmpParentComponent.name =
"project-name" in options
? options.projectName
: tmpParentComponent.name;
ppurl = new PackageURL(
"npm",
options.projectGroup || tmpParentComponent.group,
"project-name" in options
? options.projectName
: tmpParentComponent.name,
options.projectVersion || tmpParentComponent.version,
null,
null,
).toString();
tmpParentComponent["bom-ref"] = decodeURIComponent(ppurl);
tmpParentComponent["purl"] = ppurl;
}
}
parentComponent = tmpParentComponent;
} else {
parentSubComponents.push(tmpParentComponent);
Expand Down
2 changes: 1 addition & 1 deletion types/lib/cli/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 59e97b7

Please sign in to comment.