Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,9 @@ Scan a given sbom for EOL data

```
USAGE
$ hd scan eol [--json] [-f <value>] [-p <value>] [-d <value>] [-s] [-a] [-t]
$ hd scan eol [--json] [-f <value>] [-p <value>] [-d <value>] [-s]

FLAGS
-a, --all Show all components (default is EOL and SUPPORTED only)
-d, --dir=<value> The directory to scan in order to create a cyclonedx sbom
-f, --file=<value> The file path of an existing cyclonedx sbom to scan for EOL
-p, --purls=<value> The file path of a list of purls to scan for EOL
Expand All @@ -166,8 +165,6 @@ EXAMPLES
$ hd scan eol --file=path/to/sbom.json

$ hd scan eol --purls=path/to/purls.json

$ hd scan eol -a --dir=./my-project
```

_See code: [src/commands/scan/eol.ts](https://github.com/herodevs/cli/blob/v2.0.0-beta.3/src/commands/scan/eol.ts)_
Expand Down
2 changes: 1 addition & 1 deletion src/api/types/nes.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ export interface ScanWarning {
}

export type ComponentStatus = (typeof VALID_STATUSES)[number];
export const VALID_STATUSES = ['UNKNOWN', 'OK', 'EOL', 'SUPPORTED'] as const;
export const VALID_STATUSES = ['UNKNOWN', 'OK', 'EOL', 'EOL_UPCOMING'] as const;
15 changes: 9 additions & 6 deletions src/commands/scan/eol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ export default class ScanEol extends Command {
this.log(ux.colorize('bold', '-'.repeat(40)));
const id = scanId.split(SCAN_ID_KEY)[1];
const reportCardUrl = config.eolReportUrl;
const url = ux.colorize('blue', terminalLink(new URL(reportCardUrl).hostname, `${reportCardUrl}/${id}`));
const url = ux.colorize(
'blue',
terminalLink(new URL(reportCardUrl).hostname, `${reportCardUrl}/${id}`, { fallback: (url) => url }),
);
this.log(`🌐 View your full EOL report at: ${url}\n`);
}

Expand Down Expand Up @@ -136,9 +139,9 @@ export default class ScanEol extends Command {
}

private displayResults(components: InsightsEolScanComponent[]) {
const { UNKNOWN, OK, SUPPORTED, EOL, NES_AVAILABLE } = countComponentsByStatus(components);
const { UNKNOWN, OK, EOL_UPCOMING, EOL, NES_AVAILABLE } = countComponentsByStatus(components);

if (!UNKNOWN && !OK && !SUPPORTED && !EOL) {
if (!UNKNOWN && !OK && !EOL_UPCOMING && !EOL) {
this.log(ux.colorize('yellow', 'No components found in scan.'));
return;
}
Expand All @@ -149,8 +152,8 @@ export default class ScanEol extends Command {
this.log(ux.colorize(STATUS_COLORS.EOL, `${INDICATORS.EOL} ${EOL.toLocaleString().padEnd(5)} End-of-Life (EOL)`));
this.log(
ux.colorize(
STATUS_COLORS.SUPPORTED,
`${INDICATORS.SUPPORTED}${SUPPORTED.toLocaleString().padEnd(5)} Scheduled EOL`,
STATUS_COLORS.EOL_UPCOMING,
`${INDICATORS.EOL_UPCOMING}${EOL_UPCOMING.toLocaleString().padEnd(5)} EOL Upcoming`,
),
);
this.log(ux.colorize(STATUS_COLORS.OK, `${INDICATORS.OK} ${OK.toLocaleString().padEnd(5)} OK`));
Expand All @@ -172,7 +175,7 @@ export function countComponentsByStatus(
const grouped: Record<ComponentStatus | 'NES_AVAILABLE', number> = {
UNKNOWN: 0,
OK: 0,
SUPPORTED: 0,
EOL_UPCOMING: 0,
EOL: 0,
NES_AVAILABLE: 0,
};
Expand Down
4 changes: 2 additions & 2 deletions src/ui/shared.ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ export const STATUS_COLORS: Record<ComponentStatus, string> = {
EOL: 'red',
UNKNOWN: 'default',
OK: 'green',
SUPPORTED: 'yellow',
EOL_UPCOMING: 'yellow',
};

export const INDICATORS: Record<ComponentStatus, string> = {
EOL: ux.colorize(STATUS_COLORS.EOL, '✗'),
UNKNOWN: ux.colorize(STATUS_COLORS.UNKNOWN, '•'),
OK: ux.colorize(STATUS_COLORS.OK, '✔'),
SUPPORTED: ux.colorize(STATUS_COLORS.SUPPORTED, '⚡'),
EOL_UPCOMING: ux.colorize(STATUS_COLORS.EOL_UPCOMING, '⚡'),
};

export const SCAN_ID_KEY = 'eol-scan-v1-';