npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vercel-redirects

v2.0.0

Published

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

Downloads

11

Readme

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

My own URL shortener project, r.codfi.sh is a public project I built as a part of a General Assembly course that allows anyone to shorten a url, a la bit.ly. For a number of reasons, this project was kind of a pain to maintain for me over the years.

So when I stumbled upon Kent C. Dodd's netlify-shortner & his url shortener app tutorial, I was motivated to create my own and migrate my short url domain, codfi.sh to use that instead. The ruby app is still up at r.codfi.sh.

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