Giter Site home page Giter Site logo

femessage / update-popup Goto Github PK

View Code? Open in Web Editor NEW
24.0 5.0 11.0 208 KB

💬Display an update message at right bottom

License: MIT License

JavaScript 92.35% Shell 7.65%
zeit popup update update-checker nuxt nuxt-module vue-cli vercel qiankun webpack update-popup

update-popup's Introduction

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

popup.txt

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

You may use auto to ignore this.

popup.js

Project configurations:

// nuxt.config.js
const config = {
  modules: [
    ['@femessage/update-popup/nuxt', {auto: true}]
  ]
}
// vue.config.js 
// poi.config.js 
// .umirc.ts
const config = {
  chainWebpack: config => {
    config.plugin('femessage-update-popup').use(require('@femessage/update-popup'), [{auto: true}])
  }
}

// and remember add import in your App.js
// you may need to ignore IDE's warning
import '@femessage/update-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 UPDATE_POPUP_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 @femessage/update-popup/app/main Inject it into your code. When to set this parameter, see Notice.QianKun

envKey

  • Type: string
  • Default: 'UPDATE_POPUP_VERSION'

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

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

📖 🌍 💻 🐛

ynwshy

🐛

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

⬆ Back to Top

License

MIT

⬆ Back to Top

update-popup's People

Contributors

2nthony avatar allcontributors[bot] avatar eviiit avatar gd4ark avatar levy9527 avatar ynwshy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

update-popup's Issues

请问下vue 2.0 怎么用这个呢

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

fix: 版本号检测

目的

在不影响规划版本号的情况下,可以提醒更新

有时候,项目出现了一些意外,需要临时更新(更新依赖,紧急修复),不属于版本规划内的情况。

设计

1 ✅

支持多位数字检测; x.x.x.1 > x.x.x

2

在保持版本号 x.x.x 不变的情况下,添加 时间戳 来判断;x.x.x.1599941636530 > x.x.x

因此,在版本号相同的情况下,去对比时间戳

为什么点了刷新弹窗还在那

Describe the bug

A clear and concise description of what the bug is.

Screenshots

If applicable, add screenshots to help explain your problem.

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

environment information

  • Version [e.g. 22]
  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]

支持react吗

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

获取版本号bug

获取版本号bug

Bad
character escape sequence (61:13)

  59 | 
  60 |   function fetchVersion() {
> 61 |     fetch('\update_popup_version.txt' + '?_=' + Date.now())
     |              ^
  62 |       .then(res => res.text())
  63 |       .then(version => {
  64 |         if (compareVersion((version || '').trim(), currentVersion)) {


 ERROR  Build failed with errors.
npm ERR! missing script: version

npm ERR! A complete log of this run can be found in:

请问下支持vue 2.0吗

Describe the bug

A clear and concise description of what the bug is.

Screenshots

If applicable, add screenshots to help explain your problem.

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

environment information

  • Version [e.g. 22]
  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]

像vue这样的单页面应用,能支持到检测url地址变化,包含hash变化,来触发检测更新吗?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.