Skip to content

Commit

Permalink
fix: resolve plugin tool correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
janbiasi committed Feb 24, 2024
1 parent 35de1c0 commit b2bf712
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/builder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolve, dirname } from "node:path";
import { dirname } from "node:path";
import { createRequire } from "node:module";

import { type Builders, type Models, type Factories } from "@cyclonedx/cyclonedx-library";
Expand All @@ -18,7 +18,7 @@ export function registerPackageUrlOnComponent(

export async function registerTools(bom: Models.Bom, builder: Builders.FromNodePackageJson.ToolBuilder) {
// register rollup-plugin-sbom (for vite and rollup)
const pkg = await getPackageJson(resolve(".."));
const pkg = await getPackageJson(dirname(require.resolve("rollup-plugin-sbom")));
if (pkg) {
const tool = builder.makeTool(pkg);
tool && bom.metadata.tools.add(tool);
Expand Down

0 comments on commit b2bf712

Please sign in to comment.