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

vue-cli-plugin-redis-deploy

v0.0.2

Published

A vue-cli plugin for deploying your built Vue app's index.html to Redis.

Downloads

56

Readme

redis-deploy for vue-cli

Usage

This vue-cli plugin deploys your built index.html file to Redis, making it easier to run the latest version of the Vue app from a dynamic server-side application.

Installation

npm install vue-cli-plugin-redis-deploy

Usage

After installation, invoke the plugin with vue invoke redis-deploy.

Answer the configuration prompts. This will inject a redis-deploy script command into your package.json file.

Deploy with npm run redis-deploy.

Options

Options are set in vue.config.js and overridden on a per-environment basis by .env, .env.staging, .env.production, etc.

module.exports = {
  pluginOptions: {
    redisDeploy: {
      redisUrl: "The connection string for Redis (default: redis://localhost:6379)",
      keyPrefix: "The first part of the Redis key to store your content (default: frontend)",
      assetPath: "The directory containing your built index.html file (default: dist)",
      activationSuffix: "The suffix of the Redis key containing the hash of the current index HTML (default: current)",
      activeContentSuffix: "The suffix of the Redis key that always contains the current index HTML (default: current-content)"
    }
  }
}

The plugin will update three Redis keys on each deploy:

  • keyPrefix:index:activationSuffix with the hash of your current HTML. Example key: my-app:index:current
  • keyPrefix:index:activeContentSuffix with the index HTML. Example key: my-app:index:current-content
  • keyPrefix:index:htmlHash with the index HTML. Example key: my-app:index:7f72ccb08633ba47434688c9bcb3ada1

You can therefore access the active revision either by retrieving the my-app:index:current-content key:

$ redis-cli

127.0.0.1:6379> KEYS *
1) my-app:index:7f72ccb08633ba47434688c9bcb3ada1
2) my-app:index:current
3) my-app:index:current-content

127.0.0.1:6379> GET my-app:index:current-content
"<html>...</html"

... or by retrieving the active revision first, and using that to build the Redis key containing the active HTML:

$ redis-cli

127.0.0.1:6379> GET my-app:index:current
"7f72ccb08633ba47434688c9bcb3ada1"

127.0.0.1:6379> GET my-app:index:7f72ccb08633ba47434688c9bcb3ada1
"<html>...</html"

You can of course also access older revisions.

Credits

The plugin is heavily inspired by vue-cli-plugin-s3-deploy and ember-cli-deploy-redis.