check github url from package fullname (#500)

Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
Neil 2023-04-25 14:38:45 +08:00 committed by GitHub
parent 45828b3f40
commit 7a64d6c12a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,10 +74,14 @@ To read more about this package go to [${guiPkg.homepage}](${guiPkg.homepage}).
...pkg,
readme_md: readmeMd,
synced: true,
github: pkg.github ? trimGithubSlug(pkg.github) : ""
github: pkg.github
? trimGithubSlug(pkg.github)
: pkg.full_name?.includes("github.com")
? trimGithubSlug(pkg.full_name.split("github.com/")[1])
: ""
};
if (pkg.github) {
const [owner, repo] = pkg.github.split("/");
if (updatedPackage.github) {
const [owner, repo] = updatedPackage.github.split("/");
const [readme, contributors, repoData] = await Promise.all([
getReadme(owner, repo),
getContributors(owner, repo),