Skip to content

Commit

Permalink
fix URL lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
derwehr committed Nov 24, 2023
1 parent d1e06e1 commit 7e4ce19
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@ async function run() {
if (!url) {
if (license.children[key].children.url) {
url = license.children[key].children.url
.split('git+')[1]
.split('.git')[0]
if (url.startsWith('git+')) {
url = url.split('git+')[1]
}
if (url.endsWith('.git')) {
url = url.split('.git')[0]
}
} else {
url = undefined
}
}

const packageLink = url !== undefined ? `<a href="${url}">${packageName}</a>` : packageName
const packageLink =
url !== undefined && url !== '.'
? `<a href="${url}">${packageName}</a>`
: packageName

return packageLink
})
Expand Down

0 comments on commit 7e4ce19

Please sign in to comment.