(left, right)
| 76 | } |
| 77 | |
| 78 | function pluginsMatch(left, right) { |
| 79 | const leftName = normalizeValue(left?.name); |
| 80 | const rightName = normalizeValue(right?.name); |
| 81 | const leftRepo = normalizeValue(left?.source?.repo); |
| 82 | const rightRepo = normalizeValue(right?.source?.repo); |
| 83 | const leftPath = normalizePathValue(left?.source?.path); |
| 84 | const rightPath = normalizePathValue(right?.source?.path); |
| 85 | const leftRepository = normalizeRepositoryUrl(left?.repository); |
| 86 | const rightRepository = normalizeRepositoryUrl(right?.repository); |
| 87 | |
| 88 | if (leftName && rightName && leftName === rightName) { |
| 89 | return true; |
| 90 | } |
| 91 | |
| 92 | const repoMatches = leftRepo && rightRepo && leftRepo === rightRepo; |
| 93 | const repositoryMatches = leftRepository && rightRepository && leftRepository === rightRepository; |
| 94 | const pathKnown = Boolean(leftPath || rightPath); |
| 95 | const pathMatches = leftPath === rightPath; |
| 96 | |
| 97 | if ((repoMatches || repositoryMatches) && pathKnown && pathMatches) { |
| 98 | return true; |
| 99 | } |
| 100 | |
| 101 | return false; |
| 102 | } |
| 103 | |
| 104 | export function upsertExternalPlugin(plugin, { filePath = EXTERNAL_PLUGINS_FILE } = {}) { |
| 105 | const { plugins, errors } = readExternalPlugins({ |
no test coverage detected