Skip to content

Commit

Permalink
fetching license info from github repo - if none in npm metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Jacek Puchta <[email protected]>
  • Loading branch information
puchta committed Oct 26, 2023
1 parent 50ebdd7 commit 57d3750
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,11 @@ export const getNpmMetadata = async function (pkgList) {
}
p.description =
body.versions?.[p.version]?.description ||

Check failure on line 334 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Replace `··body.versions?.[p.version]?.description·||⏎·········` with `body.versions?.[p.version]?.description·||`

Check failure on line 334 in utils.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `··body.versions?.[p.version]?.description·||⏎·········` with `body.versions?.[p.version]?.description·||`

Check failure on line 334 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `··body.versions?.[p.version]?.description·||⏎·········` with `body.versions?.[p.version]?.description·||`

Check failure on line 334 in utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `··body.versions?.[p.version]?.description·||⏎·········` with `body.versions?.[p.version]?.description·||`
body.description
body.description;
p.license =
body.versions?.[p.version]?.license ||

Check failure on line 337 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Delete `··`

Check failure on line 337 in utils.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Delete `··`

Check failure on line 337 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Delete `··`

Check failure on line 337 in utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Delete `··`
body.license
body.license ||

Check failure on line 338 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Replace `··········` with `········`

Check failure on line 338 in utils.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `··········` with `········`

Check failure on line 338 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `··········` with `········`

Check failure on line 338 in utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `··········` with `········`
await getRepoLicense(body.repository?.url, undefined);

Check failure on line 339 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Replace `··await·getRepoLicense(body.repository?.url,·undefined` with `(await·getRepoLicense(body.repository?.url,·undefined)`

Check failure on line 339 in utils.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `··await·getRepoLicense(body.repository?.url,·undefined` with `(await·getRepoLicense(body.repository?.url,·undefined)`

Check failure on line 339 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `··await·getRepoLicense(body.repository?.url,·undefined` with `(await·getRepoLicense(body.repository?.url,·undefined)`

Check failure on line 339 in utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `··await·getRepoLicense(body.repository?.url,·undefined` with `(await·getRepoLicense(body.repository?.url,·undefined)`
if (body.repository && body.repository.url) {
p.repository = { url: body.repository.url };
}
Expand Down Expand Up @@ -3099,6 +3100,9 @@ export const getRepoLicense = async function (repoUrl, repoMetadata) {
if (!repoUrl) {
repoUrl = toGitHubUrl(repoMetadata);
}
if (repoUrl.startsWith('git://') && repoUrl.endsWith('.git')) {

Check failure on line 3103 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Replace `'git://')·&&·repoUrl.endsWith('.git'` with `"git://")·&&·repoUrl.endsWith(".git"`

Check failure on line 3103 in utils.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `'git://')·&&·repoUrl.endsWith('.git'` with `"git://")·&&·repoUrl.endsWith(".git"`

Check failure on line 3103 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `'git://')·&&·repoUrl.endsWith('.git'` with `"git://")·&&·repoUrl.endsWith(".git"`

Check failure on line 3103 in utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `'git://')·&&·repoUrl.endsWith('.git'` with `"git://")·&&·repoUrl.endsWith(".git"`
repoUrl = repoUrl.replace('git://', 'https://').slice(0, -4);

Check failure on line 3104 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

Replace `'git://',·'https://'` with `"git://",·"https://"`

Check failure on line 3104 in utils.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Replace `'git://',·'https://'` with `"git://",·"https://"`

Check failure on line 3104 in utils.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Replace `'git://',·'https://'` with `"git://",·"https://"`

Check failure on line 3104 in utils.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Replace `'git://',·'https://'` with `"git://",·"https://"`
}
// Perform github lookups
if (repoUrl.indexOf("github.com") > -1) {
let apiUrl = repoUrl.replace(
Expand Down

0 comments on commit 57d3750

Please sign in to comment.