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

@studiometa/cli-test-redirection

v0.7.6

Published

> Easily test your redirection plan.

Downloads

7

Readme

Redirection test CLI

Easily test your redirection plan.

Usage

You can directly use the CLI with docker:

docker run -it --rm -v $PWD:/app studiometa/test-redirection redirects.csv 

Or with npx:

npx @studiometa/cli-test-redirection redirects.csv

Or you can install it globally:

npm install -g @studiometa/cli-test-redirection
test-redirection redirects.csv

The redirects.csv file should have 2 columns: the first one is the original URL, the second is the redirected URL.

Mock hosts to test redirects before deploying

The Docker image can configure an Apache environment to test request against a mocked environment.

# Create your .htaccess file with redirections to test
vim .htaccess

# Create a CSV fiels containing from,to URLS
vim redirects.csv

# Configure the temporary hosts referenced in your redirects, they will be configured in the Docker container
export DOMAINS='fqdn.com,www.fqdn.com'

# Run the Docker image by linking the current directy to /app
docker run -it --rm -v $PWD:/app -e DOMAINS studiometa/cli-test-redirection redirects.csv 

Parameters

--concurrecy [number]

Limit the number of tests running concurrently.

# Limit to 1 test
test-redirection --concurrency 1 path/to/redirects.csv
test-redirection -c 1 path/to/redirects.csv

--delay [number]

Add a delay in milliseconds between batch of tests.

# Wait for 1s between each batch of tests
test-redirection --delay 1000 path/to/redirects.csv
test-redirection -d 1000 path/to/redirects.csv

# Wait for 1s between each tests
test-redirection --delay 1000 --concurrency 1 path/to/redirects.csv
test-redirection -d 1000 -c 1 path/to/redirects.csv

--ignore-query-parameters

Ignore query parameters when comparing the final URL with the target URL defined in the config.

test-redirection --ignore-query-parameters path/to/config.json

--parser [json|csv]

Define how the input file should be parsed. The parser is inferred by the given file extension.

test-redirection path/to/file.csv --parser csv

--replace-host

Replace the host from the values in the configuration file to easily test against different environment.

test-redirection path/to/config.json --replace-host preprod.fqdn.com

-v, --verbose

Display verbose output.

test-redirection path/to/config.json -v

--only-errors

When in verbose mode, will only print errors to the console. Useful when you have hundreds of redirections with only a few one failing.

test-redirection path/to/config.json -v --only-errors

--user

Define basic auth user. This parameter is directly passed to the underlying curl command.

test-redirection path/to/config.json --user user:password