( previous: PluginSummary | undefined, next: PluginSummary, )
| 502 | } |
| 503 | |
| 504 | function describeInstallAction( |
| 505 | previous: PluginSummary | undefined, |
| 506 | next: PluginSummary, |
| 507 | ): string { |
| 508 | const sourceLabel = formatPluginSourceLabel(next); |
| 509 | const versionFromTo = (prev?: string, cur?: string): string => { |
| 510 | if (prev === undefined || prev === cur) return cur === undefined ? '' : ` ${cur}`; |
| 511 | return ` ${prev} → ${cur ?? '-'}`; |
| 512 | }; |
| 513 | if (previous === undefined) { |
| 514 | return `Installed ${next.displayName}${versionFromTo(undefined, next.version)} ${sourcePhrase(sourceLabel)}`; |
| 515 | } |
| 516 | if (sourceIdentity(previous) !== sourceIdentity(next)) { |
| 517 | const prevSourceLabel = formatPluginSourceLabel(previous); |
| 518 | return `Migrated ${next.displayName}: ${prevSourceLabel} → ${sourceLabel}${versionFromTo(previous.version, next.version)}`; |
| 519 | } |
| 520 | return `Updated ${next.displayName}${versionFromTo(previous.version, next.version)} ${sourcePhrase(sourceLabel)}`; |
| 521 | } |
| 522 | |
| 523 | // formatPluginSourceLabel already prefixes zip-url hosts with "via", so adding |
| 524 | // "from" would read as "from via <host>". Only prepend "from" otherwise. |
no test coverage detected