{"id":19057434,"url":"https://github.com/femessage/update-popup","last_synced_at":"2025-07-08T01:14:13.502Z","repository":{"id":46213201,"uuid":"283643498","full_name":"FEMessage/update-popup","owner":"FEMessage","description":"💬Display an update message at right bottom","archived":false,"fork":false,"pushed_at":"2023-10-20T03:39:47.000Z","size":208,"stargazers_count":24,"open_issues_count":1,"forks_count":11,"subscribers_count":4,"default_branch":"dev","last_synced_at":"2025-04-23T03:04:37.714Z","etag":null,"topics":["nuxt","nuxt-module","popup","qiankun","update","update-checker","update-popup","vercel","vue-cli","webpack","zeit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FEMessage.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-30T01:51:27.000Z","updated_at":"2024-05-03T14:22:54.000Z","dependencies_parsed_at":"2022-07-23T10:34:27.340Z","dependency_job_id":null,"html_url":"https://github.com/FEMessage/update-popup","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupdate-popup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupdate-popup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupdate-popup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fupdate-popup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FEMessage","download_url":"https://codeload.github.com/FEMessage/update-popup/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250567890,"owners_count":21451517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nuxt","nuxt-module","popup","qiankun","update","update-checker","update-popup","vercel","vue-cli","webpack","zeit"],"created_at":"2024-11-08T23:57:20.744Z","updated_at":"2025-04-24T05:21:56.132Z","avatar_url":"https://github.com/FEMessage.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# update-popup\n\n[![Build Status](https://badgen.net/travis/FEMessage/update-popup/master)](https://travis-ci.com/FEMessage/update-popup)\n[![NPM Download](https://badgen.net/npm/dm/@femessage/update-popup)](https://www.npmjs.com/package/@femessage/update-popup)\n[![NPM Version](https://badge.fury.io/js/%40femessage%2Fupdate-popup.svg)](https://www.npmjs.com/package/@femessage/update-popup)\n[![NPM License](https://badgen.net/npm/license/@femessage/update-popup)](https://github.com/FEMessage/update-popup/blob/master/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/FEMessage/update-popup/pulls)\n[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)\n\n![](https://user-images.githubusercontent.com/53422750/88611099-eb654b00-d0ba-11ea-89b9-ca92afc1078c.gif)\n\n## Table of Contents\n\n- [Features](#features)\n- [Install](#install)\n- [Usage](#usage)\n- [Options](#options)\n- [Notice](#notice)\n- [Contributing](#contributing)\n- [Contributors](#contributors)\n- [License](#license)\n\n## Features\n\n检测当前运行的应用是否是最新版本，如若不是，则提醒刷新以使用新版本。\n\n[⬆ Back to Top](#table-of-contents)\n\n## Install\n\n```console\nyarn add @femessage/update-popup\n```\n\n[⬆ Back to Top](#table-of-contents)\n\n## Usage\n\n你需要通过环境变量 `UPDATE_POPUP_VERSION` 来传入版本号，后续每次迭代更新只需要修改比当前大的版本号即可。\n\n环境变量\n\n```bash\n# .env\nUPDATE_POPUP_VERSION=1.0.0 # 如果有必要，可以支持更多位数。如：1.0.0.1，1.0.0.1.1\n```\n\n也可以使用 [options.auto](#options.auto) 来实现自动更新版本。\n\n工程配置文件\n\n```js\n// nuxt.config.js\nconst config = {\n  modules: ['@femessage/update-popup/nuxt', {options}]\n}\n\n// vue.config.js 或者 poi.config.js\nconst UpdatePopup = require('@femessage/update-popup')\nconst config = {\n  chainWebpack: config =\u003e {\n    config.plugin('femessage-update-popup').use(UpdatePopup, [{options}])\n  }\n}\n```\n\n就这么简单！\n\n[⬆ Back to Top](#table-of-contents)\n\n## Options\n\n### options.publicPath\n\n- Type: `string`\n- Default: `webpackConfig.output.publicPath`\n- Reference: [webpack publicPath](https://webpack.docschina.org/configuration/output/#outputpublicpath)\n\n使用独立的 publicPath，一般情况下不需要设置此参数。\n\n[⬆ Back to Top](#table-of-contents)\n\n### options.auto\n\n- Type: `boolean`\n- Default: `false`\n\n是否需要自动更新版本，需要配合 `options.versionType` 一起使用。\n\n**注意**：开启此功能，环境变量 `UPDATE_POPUP_VERSION` 则不会再生效。\n\n### options.versionType\n\n- Type: `'timestamp' | 未来支持更多`\n- Default: `timestamp`\n\n自动生成的 version 的方式，可选值：\n\n- `timestamp`:\n\n  使用当前时间戳，它看上去是这样的：`1603184005919.0.0`，把时间戳放在版本号的第一位，是为了保证无论如何都会大于已有的版本。\n\n  **注意**：这将失去版本语义化的控制。\n\n### options.inject\n\n- Type: `boolean`\n- Default: `true`\n\n是否自动添加到 webpack 入口文件，一般情况下不需要设置此参数。  \n如果设置为 `false` 需要手动将 `@femessage/update-popup/app/main` 注入到你的代码中。  \n何时需要设置此参数请参阅 [Notice.QianKun（乾坤）](#qiankun乾坤)。\n\n### options.envKey\n\n- Type: `string`\n- Default: `'UPDATE_POPUP_VERSION'`\n\n指定获取环境变量的 key 。e.g. `process.env.UPDATE_POPUP_VERSION=1.0.0`\n\n### options.versionFileName\n\n- Type: `string`\n- Default: `'update_popup_version.txt'`\n\n版本号文件名。\n\n## Notice\n\n### QianKun（乾坤）\n\n此插件会自动生成一个普通的 js 文件并添加到 webpack 入口文件中，  \n但由于子应用的入口文件需要 **[导出生命周期钩子](https://qiankun.umijs.org/zh/guide/getting-started#1-%E5%AF%BC%E5%87%BA%E7%9B%B8%E5%BA%94%E7%9A%84%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E9%92%A9%E5%AD%90)** 的要求，  \n因此需要禁止自动添加入口文件，则做如下的调整：\n\n#### 在子应用中使用\n\n调整工程配置文件\n\n```diff\n# nuxt.config.js\nconst config = {\n-  modules: ['@femessage/update-popup/nuxt']\n+  modules: [['@femessage/update-popup/nuxt'], { inject: false }]\n}\n\n# vue.config.js 或者 poi.config.js\nconst config = {\n  chainWebpack: config =\u003e {\n    config.plugin('update-popup').use(UpdatePopup, [{\n+     inject: false\n    }])\n  }\n}\n```\n\n最后在你的**子应用**入口文件添加\n\n```diff\n+ import '@femessage/update-popup/app/main'\n```\n\n[⬆ Back to Top](#table-of-contents)\n\n## Contributing\n\nFor those who are interested in contributing to this project, such as:\n\n- report a bug\n- request new feature\n- fix a bug\n- implement a new feature\n\nPlease refer to our [contributing guide](https://github.com/FEMessage/.github/blob/master/CONTRIBUTING.md).\n\n[⬆ Back to Top](#table-of-contents)\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://evila.me/\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/19513289?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eEVILLT\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/update-popup/commits?author=evillt\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/FEMessage/update-popup/commits?author=evillt\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#ideas-evillt\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e \u003ca href=\"https://github.com/FEMessage/update-popup/commits?author=evillt\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#maintenance-evillt\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n[⬆ Back to Top](#table-of-contents)\n\n## License\n\n[MIT](./LICENSE)\n\n[⬆ Back to Top](#table-of-contents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemessage%2Fupdate-popup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffemessage%2Fupdate-popup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemessage%2Fupdate-popup/lists"}