Skip to content

Commit

Permalink
deps: hosted-git-info@4.1.0 (#4211)
Browse files Browse the repository at this point in the history
* feat: Support Sourcehut
  • Loading branch information
wraithgar committed Jan 6, 2022
1 parent 2ac540b commit da80d57
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 12 deletions.
30 changes: 30 additions & 0 deletions node_modules/hosted-git-info/git-host-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,36 @@ gitHosts.gist = Object.assign({}, defaults, {
}
})

gitHosts.sourcehut = Object.assign({}, defaults, {
protocols: ['git+ssh:', 'https:'],
domain: 'git.sr.ht',
treepath: 'tree',
browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,
filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`,
httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`,
bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`,
docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,
extract: (url) => {
let [, user, project, aux] = url.pathname.split('/', 4)

// tarball url
if (['archive'].includes(aux)) {
return
}

if (project && project.endsWith('.git')) {
project = project.slice(0, -4)
}

if (!user || !project) {
return
}

return { user, project, committish: url.hash.slice(1) }
}
})

const names = Object.keys(gitHosts)
gitHosts.byShortcut = {}
gitHosts.byDomain = {}
Expand Down
7 changes: 3 additions & 4 deletions node_modules/hosted-git-info/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hosted-git-info",
"version": "4.0.2",
"version": "4.1.0",
"description": "Provides metadata and conversions from repository urls for GitHub, Bitbucket and GitLab",
"main": "index.js",
"repository": {
Expand Down Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"standard": "^16.0.3",
"standard-version": "^9.1.0",
"tap": "^14.11.0"
"tap": "^15.1.6"
},
"files": [
"index.js",
Expand All @@ -46,7 +46,6 @@
},
"tap": {
"color": 1,
"coverage": true,
"esm": false
"coverage": true
}
}
14 changes: 7 additions & 7 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"fastest-levenshtein": "^1.0.12",
"glob": "^7.2.0",
"graceful-fs": "^4.2.8",
"hosted-git-info": "^4.0.2",
"hosted-git-info": "^4.1.0",
"ini": "^2.0.0",
"init-package-json": "^2.0.5",
"is-cidr": "^4.0.2",
Expand Down Expand Up @@ -3792,9 +3792,9 @@
}
},
"node_modules/hosted-git-info": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz",
"integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz",
"integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==",
"inBundle": true,
"dependencies": {
"lru-cache": "^6.0.0"
Expand Down Expand Up @@ -13623,9 +13623,9 @@
}
},
"hosted-git-info": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.0.2.tgz",
"integrity": "sha512-c9OGXbZ3guC/xOlCg1Ci/VgWlwsqDv1yMQL1CWqXDL0hDjXuNcq0zuR4xqPSuasI3kqFDhqSyTjREz5gzq0fXg==",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz",
"integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==",
"requires": {
"lru-cache": "^6.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"fastest-levenshtein": "^1.0.12",
"glob": "^7.2.0",
"graceful-fs": "^4.2.8",
"hosted-git-info": "^4.0.2",
"hosted-git-info": "^4.1.0",
"ini": "^2.0.0",
"init-package-json": "^2.0.5",
"is-cidr": "^4.0.2",
Expand Down

0 comments on commit da80d57

Please sign in to comment.