1.0.1 • Published 21 days ago
@simple-libs/hosted-git-info v1.0.1
@simple-libs/hosted-git-info
A small library to parse hosted git info.
Install
# pnpm
pnpm add @simple-libs/hosted-git-info
# yarn
yarn add @simple-libs/hosted-git-info
# npm
npm i @simple-libs/hosted-git-info
Usage
import { parseHostedGitUrl } from '@simple-libs/hosted-git-info'
parseHostedGitUrl('github:foo/bar')
/* {
type: 'github',
url: 'https://github.com/foo/bar',
host: 'https://github.com',
owner: 'foo',
project: 'bar'
} */
parseHostedGitUrl('git+ssh://bitbucket.org:foo/bar.git')
/* {
type: 'bitbucket',
url: 'https://bitbucket.org/foo/bar',
host: 'https://bitbucket.org',
owner: 'foo',
project: 'bar'
} */
parseHostedGitUrl('https://user@gitlab.com/foo/bar.git#branch')
/* {
type: 'gitlab',
url: 'https://gitlab.com/foo/bar/tree/branch',
host: 'https://gitlab.com',
owner: 'foo',
project: 'bar'
} */