adding colors to the dep output

This commit is contained in:
Federico Builes
2022-09-26 11:35:05 +02:00
parent 0ed41eff02
commit 89f99d150a
3 changed files with 28 additions and 3 deletions
Generated Vendored
+9 -1
View File
@@ -286,6 +286,14 @@ function renderSeverity(severity) {
}[severity];
return `${ansi_styles_1.default.color[color].open}(${severity} severity)${ansi_styles_1.default.color[color].close}`;
}
function renderChangeType(change_type) {
const color = {
added: 'green',
modified: 'yellow',
removed: 'red'
}[change_type];
return `${ansi_styles_1.default.color[color].open}${change_type}${ansi_styles_1.default.color[color].close}`;
}
function printLicensesError(changes) {
if (changes.length === 0) {
return;
@@ -317,7 +325,7 @@ function printScannedDependencies(changes) {
for (const [manifestName, manifestChanges] of Object.entries(dependencies)) {
core.group(manifestName, () => __awaiter(this, void 0, void 0, function* () {
for (const change of manifestChanges) {
core.info(`${change.change_type} ${change.name}@${change.version}`);
core.info(`${renderChangeType(change.change_type)} ${change.name}@${change.version}`);
}
}));
}
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+18 -1
View File
@@ -137,6 +137,19 @@ function renderSeverity(
return `${styles.color[color].open}(${severity} severity)${styles.color[color].close}`
}
function renderChangeType(
change_type: 'added' | 'modified' | 'removed'
): string {
const color = (
{
added: 'green',
modified: 'yellow',
removed: 'red'
} as const
)[change_type]
return `${styles.color[color].open}${change_type}${styles.color[color].close}`
}
function printLicensesError(changes: Change[]): void {
if (changes.length === 0) {
return
@@ -179,7 +192,11 @@ function printScannedDependencies(changes: Change[]): void {
)) {
core.group(manifestName, async () => {
for (const change of manifestChanges) {
core.info(`${change.change_type} ${change.name}@${change.version}`)
core.info(
`${renderChangeType(change.change_type)} ${change.name}@${
change.version
}`
)
}
})
}