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

web-version-popup

v1.1.4

Published

Display an update message at right bottom

Downloads

8

Readme

update-popup

NPM Download NPM Version NPM License PRs Welcome Automated Release Notes by gren

Table of Contents

Features

Check if the current application is the latest version. If not, it reminds you to reload the current page.

⬆ Back to Top

Install

yarn add web-version-popup

⬆ Back to Top

Usage

popup.txt

You need to set environment variables WEB_VERSION, when iteratively updating, modify the variables greater than current value.

Environment variables

# .env
WEB_VERSION=1.0.0 # Support more. e.g.: 1.0.0.1, 1.0.0.1.1

You may use auto to ignore this.

popup.js

Project configurations:

// nuxt.config.js
const config = {
  modules: [['web-version-popup/nuxt', {auto: true}]]
}
// vite.config.js
import versionPopup from 'web-version-popup/vite'
export default defineConfig({
  plugins: [versionPopup.default()]
})

// icejs build.config.ts
import versionPopup from 'web-version-popup/vite';
export default {
  vite: true,
  vitePlugins: [
    versionPopup.default(),
  ],
};
// vue.config.js
// poi.config.js
// .umirc.ts
const config = {
  chainWebpack: config => {
    config
      .plugin('web-version-popup')
      .use(require('web-version-popup'), [{auto: true}])
  }
}

// and remember add import in your App.js
// you may need to ignore IDE's warning
import 'web-version-popup/app/main'

It's so easy.

⬆ Back to Top

Options

publicPath

Use publicPath setting

⬆ Back to Top

auto

  • Type: boolean
  • Default: false

to make updated version code automaticly

Note:If true,the environment variable WEB_VERSION doesn't work.

versionType

  • Type: 'timestamp' | Support more...
  • Default: timestamp

The way of automatically generated version,values:

  • timestamp:

    Using the current timestamp,it looks like this: 1603184005919.0.0. it was put in the first place to ensure that it would always be bigger than the previous version.

    Note:this will lose the control of version semantics.

inject

  • Type: boolean
  • Default: true

Does it need to be automatically added to the webpack entry file? If set false Need to manually web-version-popup/app/main Inject it into your code. When to set this parameter, see Notice.QianKun

envKey

  • Type: string
  • Default: 'WEB_VERSION'

Key of the environment variable. e.g. process.env.WEB_VERSION=1.0.0

versionFileName

  • Type: string
  • Default: 'web_version.txt'

Version filename.

options.message

  • Type: string
  • Default: '发现新版本可用'

popup message

Notice

QianKun

This plugin automatically generates a common js file and adds it to the webpack entry file, however, due to the requirement to export lifecycle hooks for the sub-application's entry file.
It is necessary to disable the automatic addition of entry files, with the following adjustments:

Use in sub-applications

Adjust the project configuration file

# nuxt.config.js
const config = {
-  modules: ['web-version-popup/nuxt']
+  modules: [['web-version-popup/nuxt'], { inject: false }]
}

# vue.config.js or poi.config.js
const config = {
  chainWebpack: config => {
    config.plugin('update-popup').use(UpdatePopup, [{
+     inject: false
    }])
  }
}

Add an entry file in your Sub-application at last

+ import 'web-version-popup/app/main'

⬆ Back to Top

Contributing

For those who are interested in contributing to this project, such as:

  • report a bug
  • request new feature
  • fix a bug
  • implement a new feature

⬆ Back to Top

This project follows the all-contributors specification. Contributions of any kind welcome!

⬆ Back to Top

License

MIT

⬆ Back to Top