# gh-short-url

> A command line tool that use github pages to convert short url

Latest version **0.1.3** (published 2021-01-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install gh-short-url
pnpm add gh-short-url
yarn add gh-short-url
bun add gh-short-url
```

Provides the commands `surl`, `shorten`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2021-01-01 |
| First published | 2020-12-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | phillzou |
| Maintainers | mayandev |
| Keywords | gh-pages, github, pages, shorten, url |

## Links

- npm: https://www.npmjs.com/package/gh-short-url
- Repository: https://github.com/Mayandev/gh-short-url
- Homepage: https://github.com/Mayandev/gh-short-url#readme
- Issues: https://github.com/Mayandev/gh-short-url/issues
- npm.io page: https://npm.io/package/gh-short-url

## Dependencies (5)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [execa](https://npm.io/package/execa.md) ^5.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.5
- [commander](https://npm.io/package/commander.md) ^6.2.1
- [command-exists](https://npm.io/package/command-exists.md) ^1.2.9

## Recent versions

- 0.1.3 (latest) — 2021-01-01
- 0.1.2 — 2020-12-25
- 0.1.1 — 2020-12-25
- 0.1.0 — 2020-12-20
- 0.0.6 — 2020-12-20
- 0.0.5 — 2020-12-19
- 0.0.3 — 2020-12-19

## README

# gh-short-url

A command line tool that use github pages to convert short url.

## Before Use


1. Fork the [gh-pages-url-shortener](https://github.com/nelsontky/gh-pages-url-shortener), if you don't have your own domain name, I recommend you fork this [link repository](https://github.com/Mayandev/link) I created.


2. Fork the [gh-pages-url-shortener-db](https://github.com/Mayandev/gh-pages-url-shortener-db), it's an empty repository, you can also just create a repository like this, the name doesn't have to be the same.

3. Open the repository you forked in step 1, and modify the 404.html file.

```diff
- var GITHUB_ISSUES_LINK = "https://api.github.com/repos/nelsontky/gh-pages-url-shortener-db/issues/";
+ var GITHUB_ISSUES_LINK = "https://api.github.com/repos/${your name}/${your db repo}/issues/";
```

4. Now, try to open an issue in the repository you created in step 2. The issue title should be a valid url, the body can be empty. Then you can use `${username}.github.io/${link repo}/1` to access the url you entered in the issue title. Mabye the link is still too long and you should use your own domain name.

More Detail: [gh-pages-url-shortener](https://github.com/nelsontky/gh-pages-url-shortener#-this-is-so-cool-how-can-i-use-this-with-my-own-domain)

## How to use

Almost forgot, you need to install the [GitHub CLI](https://cli.github.com/) before you use this command line tool.

Let do it!

```bash
# install package
npm install gh-short-url -g
# config your url database repository and github user name and github pages domain
# example: shorten config --database="gh-pages-url-shortener-db" --user="mayandev" --pages="mayandev.github.io/link/"
shorten config --database=${db-repo-name} --user=${username} --pages=${domain/url-repo/}
# shorten it
shorten https://en.wikipedia.org/wiki/Kobe_Bryant#Basketball_legacy/
# you can also use surl
surl https://en.wikipedia.org/wiki/Kobe_Bryant#Basketball_legacy
```

![image](https://user-images.githubusercontent.com/28648715/102714280-719f5980-4308-11eb-9996-7e39e91ce712.png)



## How does this work

Thank to [gh-pages-url-shortener](https://github.com/Mayandev/gh-pages-url-shortener#-how-does-this-work) for the  ideas.

---
_Source: https://npm.io/package/gh-short-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
