Skip to content

Commit

Permalink
Drop GitLab support
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Jul 13, 2017
1 parent 6de6f38 commit c47d1b8
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 223 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# shorten-repo-url [![Build Status](https://travis-ci.org/bfred-it/shorten-repo-url.svg?branch=master)](https://travis-ci.org/bfred-it/shorten-repo-url)

> Shorten GitHub/GitLab links like GitHub shortens Issues and Commit links. Used on [refined-github](https://github.com/sindresorhus/refined-github)
> Shorten GitHub links like GitHub shortens Issues and Commit links. Used on [refined-github](https://github.com/sindresorhus/refined-github)
![Demo](https://user-images.githubusercontent.com/1402241/27252232-8fdf8ed0-538b-11e7-8f19-12d317c9cd32.png)

Look at [the tests](https://github.com/bfred-it/shorten-repo-url/blob/master/test.js) to see what each URL is shortened to. GitLab URLs are mostly compatible. Not all are shortened. PRs welcome to add support/tests for more GitLab and BitBucket URLs, unless they just become too much.
Look at [the tests](https://github.com/bfred-it/shorten-repo-url/blob/master/test.js) to see what each URL is shortened to. GitLab URLs are mostly compatible but they're not officially supported.

It works on any domain, so Enterprise and Community Editions are supported.
It works on any domain, so GitHub Enterprise is also supported.


## Install

```
$ npm install --save shorten-repo-url
$ npm install shorten-repo-url
```


Expand Down
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const {URL} = require('url');
const reservedPaths = require('github-reserved-names/reserved-names.json');

const patchDiffRegex = /[.](patch|diff)$/;
const releaseRegex = /(?:releases[/]tag|tags)[/]([^/]+)/;
const releaseRegex = /releases[/]tag[/]([^/]+)/;
const labelRegex = /labels[/]([^/]+)/;
const releaseArchiveRegex = /archive[/](.+)([.]zip|[.]tar[.]gz)/;
const releaseDownloadRegex = /releases[/]download[/]([^/]+)[/](.+)/;
Expand Down Expand Up @@ -38,13 +38,13 @@ function shortenURL(href, currentUrl = 'https://github.com') {
origin,
pathname,
search,
hash,
hash
} = new URL(href);

const isRaw = [
'https://raw.githubusercontent.com',
'https://cdn.rawgit.com',
'https://rawgit.com',
'https://rawgit.com'
].includes(origin);

let [
Expand Down Expand Up @@ -82,7 +82,7 @@ function shortenURL(href, currentUrl = 'https://github.com') {
'tree',
'blob',
'blame',
'commits',
'commits'
].includes(type);

const repoUrl = isThisRepo ? '' : `${user}/${repo}`;
Expand Down
10 changes: 1 addition & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shorten-repo-url",
"version": "1.4.1",
"description": "Shorten GitHub/GitLab URLs like GitHub shortens Issues and Commit URLs",
"description": "Shorten GitHub URLs like GitHub shortens Issues and Commit URLs",
"license": "MIT",
"repository": "bfred-it/shorten-repo-url",
"author": "Federico Brigante <github@bfred.it> (bfred.it)",
Expand Down Expand Up @@ -32,14 +32,6 @@
"browser": {
"url": "./browser-url"
},
"xo": {
"rules": {
"comma-dangle": [
"error",
"always-multiline"
]
}
},
"dependencies": {
"github-reserved-names": "^1.0.3"
}
Expand Down

0 comments on commit c47d1b8

Please sign in to comment.