Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codfish/vercel-redirects
Command-line utility to manage your Vercel project redirects. Doubles as a url shortener.
https://github.com/codfish/vercel-redirects
redirects url-shortener vercel
Last synced: 3 months ago
JSON representation
Command-line utility to manage your Vercel project redirects. Doubles as a url shortener.
- Host: GitHub
- URL: https://github.com/codfish/vercel-redirects
- Owner: codfish
- License: mit
- Created: 2020-04-26T14:55:31.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-16T21:06:59.000Z (about 2 years ago)
- Last Synced: 2024-10-08T13:31:48.893Z (4 months ago)
- Topics: redirects, url-shortener, vercel
- Language: JavaScript
- Homepage: vercel-redirects-two.vercel.app
- Size: 30.3 KB
- Stars: 17
- Watchers: 2
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# vercel-redirects
> Command-line utility to manage your Vercel project redirects. Doubles as a url shortener.
[![version][version-badge]][package] [![downloads][downloads-badge]][npmcharts]
[![GitHub Workflow Status][actions-badge]][actions-badge] [![MIT License][license-badge]][license]
[![PRs Welcome][prs-badge]][prs] [![Semantic Release][semantic-release-badge]][semantic-release]
[![Commitizen friendly][commitizen-badge]][commitizen]![vercel-redirects example usage](https://cl.ly/56dc56e87ac2/Screen%2520Recording%25202020-04-26%2520at%252008.59%2520AM.gif 'Example Usage')
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Add](#add)
- [Configuration](#configuration)
- [Inspiration](#inspiration)
- [LICENSE](#license)## Installation
This module is distributed via [npm](https://www.npmjs.com) which is bundled with
[node](https://nodejs.org/en/). It can be installed as one of your project's `devDependencies` and
used via an npm script.```sh
npm install --save-dev vercel-redirects
``````json
{
"scripts": {
"shorten": "vercel-redirects"
}
}
```You can then then run `npm run shorten `.
You can also install and run this globally.
```sh
npm install -g vercel-redirects
```Or run it through `npx`.
```sh
npx vercel-redirects https://url.to.redirect.to.com
```## Usage
Use the cli directly from your command line or as an npm script.
```txt
Usage: vercel-redirects [options] [command]Options:
-v, --version Output the current version.
-h, --help display help for commandCommands:
add [options] [source] Add a new redirect. Short url is created for you if you dont provide a source.
help [command] display help for command
```### Add
```txt
Usage: vercel-redirects add [options] [source]Add a new redirect. Short url is created for you if you dont provide a source.
Options:
-c, --status-codeHTTP status code. Must be a value between 301-308.
-h, --help display help for command
```**Note**: This is the default command, so it can be left out if you prefer.
#### Simple
```sh
vercel-redirects add /destination-url /source-url
vercel-redirects /destination-url /source-url
vercel-redirects -c 302 /destination-url /source-url
vercel-redirects --status-code 302 /destination-url /source-url
vercel-redirects https://codfish.io /source-url
```#### Url Shortener
```sh
vercel-redirects add /destination-url
vercel-redirects /destination-url
vercel-redirects https://codfish.io
vercel-redirects -c 302 https://codfish.io
vercel-redirects --status-code 302 https://codfish.io
```## Configuration
Add configuration in the following ways (in order of precedence):
1. A `vercel-redirects` object in your `package.json`.
1. A `.vercelredirectsrc.json` file to the root of your project.
1. A `.vercelredirectsrc` file to the root of your project.**package.json example:**
```json
{
"vercel-redirects": {
"autoPush": true
}
}
```**.vercelredirectsrc.json and .vercelredirectsrc example:**
```json
{
"autoPush": true
}
```| Variable | Type | Default | Description |
| ---------- | ------- | ------- | ------------------------------------------------------------------------------- |
| `autoPush` | boolean | `false` | Automatically commit and push, effectively deploying whenever changes are made. |## Inspiration
I had originally created a URL shortener, `codfi.sh`, for a project I built as a part
of a General Assembly course. For a number of reasons, this project was kind of a pain to
maintain for me over the years.I stumbled upon Kent C. Dodd's
[netlify-shortner](https://github.com/kentcdodds/netlify-shortener) & his url shortener
[app tutorial](https://www.youtube.com/watch?v=HL6paXyx6hM), and was motivated to create my own and
migrate my short url domain, `codfi.sh` to use that instead.However, I'm a huge fan of Vercel (formally Now) and that's what I personally use for all my
serverless apps. This cli utility was built to help facilitate the creation of redirects & short
urls for Vercel projects, very much in the same vein as `netlify-shortener`.## LICENSE
MIT
[npm]: https://www.npmjs.com/
[node]: https://nodejs.org
[semantic-release]: https://github.com/semantic-release/semantic-release
[semantic-release-badge]:
https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square
[prs]: http://makeapullrequest.com
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[commitizen]: http://commitizen.github.io/cz-cli/
[commitizen-badge]:
https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square
[npmcharts]: http://npmcharts.com/compare/vercel-redirects
[version-badge]: https://img.shields.io/npm/v/vercel-redirects.svg?style=flat-square
[package]: https://www.npmjs.com/package/vercel-redirects
[downloads-badge]: https://img.shields.io/npm/dm/vercel-redirects.svg?style=flat-square
[license-badge]: https://img.shields.io/npm/l/vercel-redirects.svg?style=flat-square
[license]: https://github.com/codfish/vercel-redirects/blob/main/LICENSE
[actions]: https://github.com/codfish/vercel-redirects/actions
[actions-badge]:
https://img.shields.io/github/workflow/status/codfish/vercel-redirects/Release/main?style=flat-square