Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate:version 希望能动态添加更多参数 #22

Closed
Seven777Z opened this issue Feb 3, 2023 · 2 comments
Closed

generate:version 希望能动态添加更多参数 #22

Seven777Z opened this issue Feb 3, 2023 · 2 comments

Comments

@Seven777Z
Copy link

已经使用onVersionUpdate自定义UI,但希望回调的参数里能自定义更多的内容,比如此次更新的内容

所以在写入version.json文件时能自定义更多的参数

@guMcrey
Copy link
Owner

guMcrey commented Feb 3, 2023

你好呀, 感谢关注

是个很不错的建议, 我会尽快把功能加上哈, 加好通知你~

感谢反馈 ❤️

@guMcrey
Copy link
Owner

guMcrey commented Feb 4, 2023

你好,generate:version 新增了 EXTERNALEXTERNAL_PATH 环境变量,可以传入更多希望在弹窗中展示的内容。安装 v1.6.1 即可使用,示例如下

  • 安装 v1.6.1
npm install version-rocket@1.6.1
  • 配置 EXTERNALEXTERNAL_PATH 参数

    • EXTERNAL (参数可选):希望将更多信息存到 version.json 中时设置,如当前版本的修改内容或其他需要展示在提示弹窗上时 (用于 onVersionUpdate 自定义 UI 时)
    • EXTERNAL_PATH (参数可选):接收一个文件路径, 推荐在需要将大量额外信息写入 version.json 中时使用. 当同时设置了 EXTERNALEXTERNAL_PATH 时,优先级低于 EXTERNAL
// package.json

{
  ...
  "scripts": {
    ...
     // Mac 或 Linux 系统 (简单文本)
    "generate:version": "EXTERNAL='some text' generate-version-file dist public"
    // Mac 或 Linux 系统 (JSON 文本)
    "generate:version": "EXTERNAL='{\"update\":\"fix bugs\",\"content\":\"some tips\"}' generate-version-file dist public"
    // Mac 或 Linux 系统 (JSON 文件, 如 version-external.json)
    "generate:version": "EXTERNAL_PATH=version-external.json generate-version-file dist public"
    // Windows 系统 (简单文本)
    "generate:version": "set EXTERNAL=some text && generate-version-file dist public"
    // Windows 系统 (JSON 文本)
    "generate:version": "set EXTERNAL={\"update\":\"fix bugs\",\"content\":\"some tips\"} && generate-version-file dist public"
    // Windows 系统 (JSON 文件, 如 version-external.json)
    "generate:version": "set EXTERNAL_PATH=version-external.json && generate-version-file dist public"
    ...
  },
  ...
}
// version-external.json 示例

{
    "update": [
        "fix some bugs",
        "improve home page",
        "update docs"
    ],
    "content": "please update to latest version"
}
  • version.json 文件中 external 即为所传值

JSON 格式可以通过 这里 转义后再使用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants