diff options
author | Gar <gar+gh@danger.computer> | 2022-01-07 01:07:47 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 01:07:47 +0300 |
commit | da80d579d1f1db61894c54f7b9b3623394882c16 (patch) | |
tree | 0fbfbf0591430d49479c8b093b2a7eeb06d51dd8 /node_modules/hosted-git-info | |
parent | 2ac540b0ccd016a14676ad891758e8d9e903a12c (diff) |
deps: hosted-git-info@4.1.0 (#4211)
* feat: Support Sourcehut
Diffstat (limited to 'node_modules/hosted-git-info')
-rw-r--r-- | node_modules/hosted-git-info/git-host-info.js | 30 | ||||
-rw-r--r-- | node_modules/hosted-git-info/package.json | 7 |
2 files changed, 33 insertions, 4 deletions
diff --git a/node_modules/hosted-git-info/git-host-info.js b/node_modules/hosted-git-info/git-host-info.js index d4919344c..ba55248e7 100644 --- a/node_modules/hosted-git-info/git-host-info.js +++ b/node_modules/hosted-git-info/git-host-info.js @@ -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 = {} diff --git a/node_modules/hosted-git-info/package.json b/node_modules/hosted-git-info/package.json index b7e2ee28e..b145e6224 100644 --- a/node_modules/hosted-git-info/package.json +++ b/node_modules/hosted-git-info/package.json @@ -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": { @@ -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", @@ -46,7 +46,6 @@ }, "tap": { "color": 1, - "coverage": true, - "esm": false + "coverage": true } } |