Socket
Socket
Sign inDemoInstall

@geut/git-url-parse

Package Overview
Dependencies
35
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.0.3

4

package.json
{
"name": "@geut/git-url-parse",
"version": "3.0.2",
"version": "3.0.3",
"description": "Function to parse a git url and generates template url for the git compare preview.",

@@ -36,3 +36,3 @@ "type": "module",

},
"gitHead": "af64612aa7afc8f5fe735a9d46f18727998d23a9"
"gitHead": "401a8bfc1f4cfbe0df0e63df9dec43b11ae6dfef"
}

@@ -10,16 +10,20 @@ import { promisify } from 'util'

github: {
template: 'https://github.com/[full_name]/compare/[prev]...[next]',
releaseTemplate: 'https://github.com/[full_name]/releases/tags/[next]',
compareTemplate: 'https://github.com/[full_name]/compare/[prev]...[next]',
branch: 'HEAD'
},
bitbucket: {
template: 'https://bitbucket.org/[full_name]/branches/compare/[prev]%0D[next]#diff',
releaseTemplate: 'https://github.com/[full_name]/commits/tag/[next]',
compareTemplate: 'https://bitbucket.org/[full_name]/branches/compare/[prev]%0D[next]#diff',
branch: 'HEAD'
},
gitlab: {
template: 'https://gitlab.com/[full_name]/compare?from=[prev]&to=[next]',
branch: 'master'
releaseTemplate: 'https://github.com/[full_name]/-/tags/[next]',
compareTemplate: 'https://gitlab.com/[full_name]/compare?from=[prev]&to=[next]',
branch: 'main'
}
}
export async function gitUrlParse ({ url }) {
export async function gitUrlParse ({ url, cwd }) {
let result

@@ -30,3 +34,3 @@

} else {
const path = findUp.sync('.git', { type: 'directory', cwd: process.cwd() })
const path = findUp.sync('.git', { type: 'directory', cwd: cwd || process.cwd() })

@@ -46,9 +50,12 @@ if (!path) {

let { template, branch } = providers[Object.keys(providers).find(p => result.source.includes(p))]
template = template.replace('[full_name]', result.full_name)
const { releaseTemplate, compareTemplate, branch } = providers[Object.keys(providers).find(p => result.source.includes(p))]
result.template = template
result.branch = branch
return result
return Object.assign(
result,
{
branch,
releaseTemplate: releaseTemplate.replace('[full_name]', result.full_name),
compareTemplate: compareTemplate.replace('[full_name]', result.full_name)
}
)
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc