当前位置:网站首页>优雅地实时检测和更新 Web 应用
优雅地实时检测和更新 Web 应用
2022-08-08 14:26:00 【InfoQ】
一、背景

二、应用场景
三、功能简介
四、功能特点
五、效果截图




六、项目地址
七、使用方法
安装
npm install version-rocket
开始使用
使用默认主题
import { checkVersion } from 'version-rocket'
// 默认建议使用 package.json 中的 version 字段, 若有自定义 version, 请忽略此行
import { version } from '../package.json'
checkVersion({
localPackageVersion: version,
originVersionFileUrl: `${location.origin}/version.json`,
})
{
"name": "test",
"description": "test",
"private": true,
"version": "0.0.1",
"scripts": {
...
"generate:version": "generate-version-file dist public"
...
},
...
}
个性化设置弹窗文案和主题
import { checkVersion } from 'version-rocket'
import { version } from '../package.json'
checkVersion(
{
localPackageVersion: version,
originVersionFileUrl: `${location.origin}/version.json`,
},
{
title: 'Title',
description: 'Description',
primaryColor: '#758bfd',
rocketColor: '#ff8600',
buttonText: 'Button Text',
}
)
个性化设置弹窗提示图片
import { checkVersion } from 'version-rocket'
import { version } from '../package.json'
checkVersion(
{
localPackageVersion: version,
originVersionFileUrl: `${location.origin}/version.json`,
},
{
imageUrl: 'https://avatars.githubusercontent.com/u/26329117',
}
)
支持推送部署成功的通知到 Lark 群聊
{
"name": "test",
"description": "test",
"private": true,
"version": "0.0.1",
"scripts": {
...
"send-lark-message:test": "MESSAGE_PATH=./lark-message-staging-config.json PACKAGE_JSON_PATH=./packages/test/package.json send-lark-message"
...
},
...
}
{
// 消息卡片标题
"title": "TEST FE Deployed Successfully",
// 项目名称标签
"projectNameLabel": "Project name label",
// 项目名称
"projectName": "TEST",
// 项目分支标签
"branchLabel": "Branch label",
// 项目分支, 可用于区别部署环境
"branch": "Staging",
// 版本标签
"versionLabel": "Version label",
// 版本
"version": "1.1.1.0",
// 项目可访问地址标签
"accessUrlLabel": "Access URL label",
// 项目可访问地址
"accessUrl": "https://test.com",
// 是否@所有人标签
"isNotifyAllLabel": "Is notify all label",
// 是否@所有人: true / false
"isNotifyAll": true,
// Lark 机器人的 webhook 链接
"larkWebHook": "https://open.larksuite.com/open-apis/bot/v2/hook/xxxxxxxxxxxx",
// 可选: 部署工具描述
"deployToolsText": "Deploy tools text",
// 可选: 部署所使用的方式或平台
"deployTools": "Jenkins",
// 可选: 部署时间想要转换成的时区,默认 "Asia/Shanghai" (当你的项目要部署的目标服务器与你所在时区不同, 可以设置此字段来转换时区)
"expectConvertToTimezone": "America/New_York"
// 可选: 想要展示除模版之外的更多信息
"remark": "Trigger by bob, fix xxx bug"
}
支持传入动态生成的卡片文案
{
"name": "test",
"description": "test",
"private": true,
"version": "0.0.1",
"scripts": {
...
"send-lark-message:test": "MESSAGE_JSON='{\"title\":\"This is a dynamically generated title\",\"version\":\"1.1.0-beta\",\"accessUrl\":\"http://test.example.com\",\"isNotifyAll\":true}' send-lark-message"
...
},
...
}
个性化设置部署消息卡片
// send-lark-config.json 示例
{
// 消息卡片内容
"message": {
"msg_type": "text",
"content": {
"text": "New message reminder"
}
},
// Lark 机器人的 webhook 链接
"larkWebHook": "https://open.larksuite.com/open-apis/bot/v2/hook/xxxxxxxxxxxx"
}
八、属性/参数
checkVersion(config, options) 函数参数列表
九、相关链接
关于领创集团(Advance Intelligence Group)
往期回顾 BREAK AWAY
边栏推荐
- LeetCode Daily Question 2022/8/1-2022/8/7
- 用 Antlr 重构脚本解释器
- QtWebassembly遇到的一些报错问题及解决方案
- 2022-08-07 The fifth group Gu Xiangquan study notes day31-collection-Map collection
- serialize serialize native method
- 医学图像数据增强-归一化
- 开源一夏 | 自己画一块ESP32-C3 的开发板(PCB到手)
- 华为云会议初体验【华为云至简致远】
- 【低代码】1405- 浅谈低代码平台远程组件加载方案
- 2022-08-07 第五小组 顾祥全 学习笔记 day31-集合-Map集合
猜你喜欢
【Personal Summary】2022.8.7 Week End
shell regular expression, Three Musketeers grep command
HackTheBox | Previse
Harvard University smashes the field: DALL-E 2 is just a "glue monster", and the generation accuracy rate is only 22%
今日睡眠质量记录83分
kali换源详细步骤
shell正则表达式,三剑客grep命令
【控制】动力学建模简介 --> 牛顿-欧拉 (Newton-Euler) 法和拉格朗日 (Lagrange) 法
idea中项目呈现树形结构
浅谈 Redis 的底层数据结构
随机推荐
【电路基础2】电容
什么样的程序员在35岁依然被公司抢着要?打破程序员“中年危机”
星起航跨境—当前形势下,突破思维做精细化运营才能提高转化
Make mistakes small yards artisan study room 】 【 the ladder of the progress of children
Harvard University smashes the field: DALL-E 2 is just a "glue monster", and the generation accuracy rate is only 22%
医学图像数据增强-重采样itk
Full of dry goods, Yu Jingxin class of the Institute of Information Technology, Chinese Academy of Sciences will help you get academic research and thesis writing skills
Brief description of the state of the thread
shell三剑客-----sed命令
更改C盘用户目录下的用户名(亲测有效)
LeetCode Daily Question 2022/8/1-2022/8/7
【Personal Summary】2022.8.7 Week End
qtwebapp库的编译及简单使用
IT故障快速解决就用行云管家!快速安全!
Fast DDS 共享内存测试例修改栈空间大小的方式-如改为30M
HackTheBox | Previse
接口测试,
【索引】图神经论文之GCN(持更)
基于QWebassembly的一个数据库监测工具
KMP Media Group South Africa implemented a DMS (Document Management System) to digitize the process, employees can again focus on their actual tasks, providing efficiency