Giter Site home page Giter Site logo

commanderx25 / vercel-redirects-vnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codfish/vercel-redirects

0.0 0.0 1.0 31 KB

Command-line utility to manage your Vercel project redirects. Doubles as a url shortener.

Home Page: vercel-redirects-two.vercel.app

License: MIT License

Shell 3.42% JavaScript 91.61% HTML 4.97%

vercel-redirects-vnn's Introduction

vercel-redirects

Command-line utility to manage your Vercel project redirects. Doubles as a url shortener.

version downloads GitHub Workflow Status MIT License PRs Welcome Semantic Release Commitizen friendly

vercel-redirects example usage

Table of Contents

Installation

This module is distributed via npm which is bundled with node. It can be installed as one of your project's devDependencies and used via an npm script.

npm install --save-dev vercel-redirects
{
  "scripts": {
    "shorten": "vercel-redirects"
  }
}

You can then then run npm run shorten <destination-url>.

You can also install and run this globally.

npm install -g vercel-redirects

Or run it through npx.

npx vercel-redirects https://url.to.redirect.to.com

Usage

Use the cli directly from your command line or as an npm script.

Usage: vercel-redirects [options] [command]

Options:
  -v, --version                         Output the current version.
  -h, --help                            display help for command

Commands:
  add [options] <destination> [source]  Add a new redirect. Short url is created for you if you dont provide a source.
  help [command]                        display help for command

Add

Usage: vercel-redirects add [options] <destination> [source]

Add a new redirect. Short url is created for you if you dont provide a source.

Options:
  -c, --status-code <code>  HTTP 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

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

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.
  2. A .vercelredirectsrc.json file to the root of your project.
  3. A .vercelredirectsrc file to the root of your project.

package.json example:

{
  "vercel-redirects": {
    "autoPush": true
  }
}

.vercelredirectsrc.json and .vercelredirectsrc example:

{
  "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 & his url shortener app tutorial, 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

vercel-redirects-vnn's People

Contributors

codfish avatar

Forkers

teamglobal2023

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.