当前位置:网站首页>Elegantly detect and update web applications in real time
Elegantly detect and update web applications in real time
2022-08-08 14:47:00 【InfoQ】
一、背景

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




六、项目地址
七、使用方法
安装
npm install version-rocket
开始使用
使用默认主题
import { checkVersion } from 'version-rocket'
// Recommended by default package.json 中的 version 字段, 若有自定义 version, please ignore this line
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"
...
},
...
}
Personalize popup text and themes
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',
}
)
Personalize the pop-up prompt picture
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',
}
)
Support push notification of successful deployment to 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",
// Project name label
"projectNameLabel": "Project name label",
// 项目名称
"projectName": "TEST",
// Project branch label
"branchLabel": "Branch label",
// 项目分支, Can be used to differentiate deployment environments
"branch": "Staging",
// 版本标签
"versionLabel": "Version label",
// 版本
"version": "1.1.1.0",
// Items have access to address labels
"accessUrlLabel": "Access URL label",
// Project accessible address
"accessUrl": "https://test.com",
// 是否@Everyone label
"isNotifyAllLabel": "Is notify all label",
// 是否@所有人: true / false
"isNotifyAll": true,
// Lark 机器人的 webhook 链接
"larkWebHook": "https://open.larksuite.com/open-apis/bot/v2/hook/xxxxxxxxxxxx",
// 可选: Deployment tool description
"deployToolsText": "Deploy tools text",
// 可选: The method or platform used for deployment
"deployTools": "Jenkins",
// 可选: The time zone to which the deployment time wants to be converted,默认 "Asia/Shanghai" (When your project is deployed to a target server that is different from your time zone, This field can be set to convert time zones)
"expectConvertToTimezone": "America/New_York"
// 可选: Want to show more information than templates
"remark": "Trigger by bob, fix xxx bug"
}
Supports passing in dynamically generated card copy
{
"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"
...
},
...
}
Personalize deployment message cards
// send-lark-config.json 示例
{
// Message card content
"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
边栏推荐
猜你喜欢
shell正则表达式,三剑客grep命令
什么是发饰hair accessories?
Code Casual Recording Notes_Dynamic Programming_322 Change Exchange
如何使用 Eolink 实现 API 文档自动生成
依赖传递和依赖调解
30K成功入职京东:拿到京东offer经验分享「面试经历+面试真题」
华为云弹性云服务器ECS使用【华为云至简致远】
2022-08-07 The fifth group Gu Xiangquan study notes day31-collection-Map collection
idea增加左右箭头
Mx_yolov3环境配置+模型测试训练
随机推荐
Is it safe to open an account online now?Which securities to choose for securities account opening?
2022-08-07 第五小组 顾祥全 学习笔记 day31-集合-Map集合
Code Casual Recording Notes_Dynamic Programming_322 Change Exchange
[Small Coder Study Room] ABC179-C: It is a miracle that the code does not count down
有了国产 DevOps 工具 ,还怕数字化转型成本高?
token系统讲解及过期处理
vsomeip环境搭建及helloworld测试例跑通
【系统设计】S3 对象存储
路由器——交换机——网络交换机:区别
创建二维数组
幂等性~~
H5不同屏幕大小显示不同的文字大小图片大小
并发请求如何优雅地处理重复请求
星起航跨境—当前形势下,突破思维做精细化运营才能提高转化
什么是发饰hair accessories?
【小码匠自习室】叛逆的小孩,打死也不改
优雅地实时检测和更新 Web 应用
keil5——安装教程附资源包
LeetCode 每日一题 2022/8/1-2022/8/7
浏览器跨域方案,适用于本地调试接口(超简单)