Skip to content

Commit 3ce95a8

Browse files
authored
feat(hosted-git-info): a small library to parse hosted git info (#90)
1 parent a8c7693 commit 3ce95a8

File tree

14 files changed

+4658
-143
lines changed

14 files changed

+4658
-143
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": [
3+
"@trigen/eslint-config/typescript",
4+
"@trigen/eslint-config/typescript-requiring-type-checking",
5+
"@trigen/eslint-config/jest"
6+
],
7+
"parserOptions": {
8+
"tsconfigRootDir": "./packages/hosted-git-info",
9+
"project": ["./tsconfig.json"]
10+
}
11+
}

packages/hosted-git-info/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# @simple-release/hosted-git-info
2+
3+
[![ESM-only package][package]][package-url]
4+
[![NPM version][npm]][npm-url]
5+
[![Node version][node]][node-url]
6+
[![Dependencies status][deps]][deps-url]
7+
[![Install size][size]][size-url]
8+
[![Build status][build]][build-url]
9+
[![Coverage status][coverage]][coverage-url]
10+
11+
[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
12+
[package-url]: https://nodejs.org/api/esm.html
13+
14+
[npm]: https://img.shields.io/npm/v/@simple-release/hosted-git-info.svg
15+
[npm-url]: https://www.npmjs.com/package/@simple-release/hosted-git-info
16+
17+
[node]: https://img.shields.io/node/v/@simple-release/hosted-git-info.svg
18+
[node-url]: https://nodejs.org
19+
20+
[deps]: https://img.shields.io/librariesio/release/npm/@simple-release/hosted-git-info
21+
[deps-url]: https://libraries.io/npm/@simple-release%2Fhosted-git-info/tree
22+
23+
[size]: https://packagephobia.com/badge?p=@simple-release/hosted-git-info
24+
[size-url]: https://packagephobia.com/result?p=@simple-release/hosted-git-info
25+
26+
[build]: https://img.shields.io/github/actions/workflow/status/TrigenSoftware/simple-release-tools/tests.yml?branch=main
27+
[build-url]: https://github.com/TrigenSoftware/simple-release-tools/actions
28+
29+
[coverage]: https://img.shields.io/codecov/c/github/TrigenSoftware/simple-release-tools.svg?flag=@simple-release/hosted-git-info
30+
[coverage-url]: https://app.codecov.io/gh/TrigenSoftware/simple-release-tools/tree/main/packages%2Fhosted-git-info
31+
32+
A small library to parse hosted git info.
33+
34+
## Install
35+
36+
```bash
37+
# pnpm
38+
pnpm add @simple-release/hosted-git-info
39+
# yarn
40+
yarn add @simple-release/hosted-git-info
41+
# npm
42+
npm i @simple-release/hosted-git-info
43+
```
44+
45+
## Usage
46+
47+
```ts
48+
import { parseHostedGitUrl } from '@simple-release/hosted-git-info'
49+
50+
parseHostedGitUrl('github:foo/bar')
51+
/* {
52+
type: 'github',
53+
url: 'https://github.com/foo/bar',
54+
host: 'https://github.com',
55+
owner: 'foo',
56+
project: 'bar'
57+
} */
58+
parseHostedGitUrl('git+ssh://bitbucket.org:foo/bar.git')
59+
/* {
60+
type: 'bitbucket',
61+
url: 'https://bitbucket.org/foo/bar',
62+
host: 'https://bitbucket.org',
63+
owner: 'foo',
64+
project: 'bar'
65+
} */
66+
parseHostedGitUrl('https://[email protected]/foo/bar.git#branch')
67+
/* {
68+
type: 'gitlab',
69+
url: 'https://gitlab.com/foo/bar/tree/branch',
70+
host: 'https://gitlab.com',
71+
owner: 'foo',
72+
project: 'bar'
73+
} */
74+
```

packages/hosted-git-info/package.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "@simple-release/hosted-git-info",
3+
"type": "module",
4+
"version": "1.0.0",
5+
"description": "A small library to parse hosted git info.",
6+
"author": {
7+
"name": "Dan Onoshko",
8+
"email": "[email protected]",
9+
"url": "https://github.com/dangreen"
10+
},
11+
"license": "MIT",
12+
"homepage": "https://github.com/TrigenSoftware/simple-release-tools/tree/master/packages/hosted-git-info#readme",
13+
"funding": "https://ko-fi.com/dangreen",
14+
"repository": {
15+
"type": "git",
16+
"url": "https://github.com/TrigenSoftware/simple-release-tools.git",
17+
"directory": "packages/hosted-git-info"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/TrigenSoftware/simple-release-tools/issues"
21+
},
22+
"keywords": [
23+
"git",
24+
"github",
25+
"bitbucket",
26+
"gitlab",
27+
"hosted-git-info"
28+
],
29+
"engines": {
30+
"node": ">=18"
31+
},
32+
"exports": "./src/index.ts",
33+
"publishConfig": {
34+
"exports": {
35+
"types": "./dist/index.d.ts",
36+
"import": "./dist/index.js"
37+
},
38+
"directory": "package",
39+
"linkDirectory": false
40+
},
41+
"files": [
42+
"dist"
43+
],
44+
"scripts": {
45+
"clear:package": "del ./package",
46+
"clear:dist": "del ./dist",
47+
"clear": "del ./package ./dist ./coverage",
48+
"prepublishOnly": "run build clear:package clean-publish",
49+
"postpublish": "pnpm clear:package",
50+
"build": "tsc -p tsconfig.build.json",
51+
"lint": "eslint --parser-options tsconfigRootDir:. '**/*.{js,ts}'",
52+
"test:unit": "vitest run --coverage",
53+
"test:types": "tsc --noEmit",
54+
"test": "run -p lint test:unit test:types"
55+
}
56+
}

0 commit comments

Comments
 (0)