Skip to content

💬Display an update message at right bottom

License

Notifications You must be signed in to change notification settings

gd4Ark/update-popup

 
 

Repository files navigation

update-popup

Build Status 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 @femessage/update-popup

⬆ Back to Top

Usage

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

Environment variables

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

Project configuration file

// nuxt.config.js
const config = {
  modules: ['@femessage/update-popup/nuxt', {options}],
}

// vue.config.js or poi.config.js
const UpdatePopup = require('@femessage/update-popup')
const config = {
  chainWebpack: (config) => {
    config.plugin('femessage-update-popup').use(UpdatePopup, [{options}])
  },
}

It's so easy.

⬆ Back to Top

Options

options.publicPath

Use publicPath setting

⬆ Back to Top

options.inject

  • Type: boolean
  • Default: true

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

options.envKey

  • Type: string
  • Default: 'UPDATE_POPUP_VERSION'

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

options.versionFileName

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

Version filename.

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: ['@femessage/update-popup/nuxt']
+  modules: [['@femessage/update-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 '@femessage/update-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

Please refer to our contributing guide.

⬆ Back to Top

Contributors

Thanks goes to these wonderful people (emoji key):


EVILLT

💻 ⚠️ 🤔 📖 🚧

4Ark

📖 🌍

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

⬆ Back to Top

License

MIT

⬆ Back to Top

Packages

No packages published

Languages

  • JavaScript 91.7%
  • Shell 8.3%