Skip to content

Commit 186e4c2

Browse files
committed
Tweaks
Signed-off-by: Prabhu Subramanian <[email protected]>
1 parent 3054f62 commit 186e4c2

File tree

2 files changed

+23
-29
lines changed

2 files changed

+23
-29
lines changed

lib/helpers/display.js

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -181,45 +181,39 @@ export function printOccurrences(bomJson) {
181181
if (!bomJson || !bomJson.components) {
182182
return;
183183
}
184-
185-
const data = [["Group", "Name", "Version", "Occurrences"]];
186-
184+
const data = ["Group", "Name", "Version", "Occurrences"];
187185
const config = {
188186
columnDefault: {
189-
width: 50,
187+
width: 30,
190188
},
191189
columnCount: 4,
192-
columns: [{ width: 20 }, { width: 40 }, { width: 50 }, { width: 80 }],
190+
columns: [
191+
{ width: 30 },
192+
{ width: 30 },
193+
{ width: 25, alignment: "right" },
194+
{ width: 80 },
195+
],
193196
};
194-
195197
const stream = createStream(config); // Create stream with the config
196-
197-
const header = "Component Evidence\nGenerated with ♥ by cdxgen";
198+
const header = "Component Evidence\nGenerated with \u2665 by cdxgen";
198199
console.log(header);
199-
200+
stream.write(data);
200201
// Stream the components
201202
for (const comp of bomJson.components) {
202-
try {
203-
if (comp.evidence?.occurrences) {
204-
const row = [
205-
comp.group || "",
206-
comp.name,
207-
comp.version || "",
208-
comp.evidence.occurrences
209-
.map((l) => l.location)
210-
.sort(locationComparator)
211-
.join("\n"),
212-
];
213-
stream.write(row);
214-
}
215-
} catch (error) {
216-
console.error("Error processing component:", error);
203+
if (comp.evidence?.occurrences) {
204+
const row = [
205+
comp.group || "",
206+
comp.name,
207+
comp.version || "",
208+
comp.evidence.occurrences
209+
.map((l) => l.location)
210+
.sort(locationComparator)
211+
.join("\n"),
212+
];
213+
stream.write(row);
217214
}
218215
}
219-
220-
stream.on("error", (error) => {
221-
console.error("Stream error:", error);
222-
});
216+
console.log();
223217
}
224218

225219
export function printCallStack(bomJson) {

types/lib/helpers/display.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)