Update manifest formatting in output.
This commit is contained in:
+19
-12
@@ -137,17 +137,28 @@ function renderSeverity(
|
|||||||
return `${styles.color[color].open}(${severity} severity)${styles.color[color].close}`
|
return `${styles.color[color].open}(${severity} severity)${styles.color[color].close}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderChangeType(
|
function renderScannedDependency(change: Change): string {
|
||||||
change_type: 'added' | 'modified' | 'removed'
|
const changeType: string = change.change_type
|
||||||
): string {
|
|
||||||
|
if (changeType !== 'added' && changeType !== 'removed') {
|
||||||
|
throw new Error(`Unexpected change type: ${changeType}`)
|
||||||
|
}
|
||||||
|
|
||||||
const color = (
|
const color = (
|
||||||
{
|
{
|
||||||
added: 'green',
|
added: 'green',
|
||||||
modified: 'yellow',
|
|
||||||
removed: 'red'
|
removed: 'red'
|
||||||
} as const
|
} as const
|
||||||
)[change_type]
|
)[changeType]
|
||||||
return `${styles.color[color].open}${change_type}${styles.color[color].close}`
|
|
||||||
|
const icon = (
|
||||||
|
{
|
||||||
|
added: '+',
|
||||||
|
removed: '-'
|
||||||
|
} as const
|
||||||
|
)[changeType]
|
||||||
|
|
||||||
|
return `${styles.color[color].open}${icon} ${change.manifest}@${change.version}${styles.color[color].close}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function printLicensesError(changes: Change[]): void {
|
function printLicensesError(changes: Change[]): void {
|
||||||
@@ -190,13 +201,9 @@ function printScannedDependencies(changes: Change[]): void {
|
|||||||
for (const [manifestName, manifestChanges] of Object.entries(
|
for (const [manifestName, manifestChanges] of Object.entries(
|
||||||
dependencies
|
dependencies
|
||||||
)) {
|
)) {
|
||||||
core.info(`${styles.bold.open}${manifestName}`)
|
core.info(`File: ${styles.bold.open}${manifestName}${styles.bold.close}`)
|
||||||
for (const change of manifestChanges) {
|
for (const change of manifestChanges) {
|
||||||
core.info(
|
core.info(`${renderScannedDependency(change)}`)
|
||||||
`${renderChangeType(change.change_type)}\t ${change.name}@${
|
|
||||||
change.version
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user