- 
                Notifications
    
You must be signed in to change notification settings  - Fork 327
 
TinyVue 构建发布指南
        ajaxzheng edited this page May 18, 2023 
        ·
        4 revisions
      
    整体步骤:
- 构建和发布 
@opentiny/vue-renderless - 构建和发布 
@opentiny/vue-theme - 构建和发布 
@opentiny/vue-theme-mobile - 构建  
@opentiny/vue的 Vue2 和 Vue3 版本 - 发布 
@opentiny/vue@2 - 发布 
@opentiny/vue@3 
步骤如下:
- 进入 packages/renderless 子包目录 
cd packages/renderless - 在 package.json 中修改版本号
 - 执行构建命令 
pnpm build - 执行release命令 
pnpm release - 进入 dist 目录
 - 执行发布命令 
npm publish 
发布 @opentiny/vue-theme 和 @opentiny/vue-theme-mobile 的步骤和 renderless 的类似,不再赘述。
- 同时构建 Vue2 和 Vue3 版本
 
pnpm build:ui -t 6.1
这个命令会默认指定 renderless / theme / theme-mobile 的版本和 @opentiny/vue 的一样,即为 2.6.1/3.6.1
Vue2 产物在 packages/dist2,Vue3 产物在 packages/dist3
- 指定 renderless / theme / theme-mobile 版本
 
这个场景用于只需要发布 @opentiny/vue,而不需要重新发布 renderless / theme / theme-mobile 的时候。
pnpm build:ui -t 6.1 -tv 6.0
发布运行时runtime包
pnpm build:runtime
- 构建单个组件
 
用于给单个组件发补丁包,而不需要重新发布 @opentiny/vue 的时候。
pnpm build:ui grid -t 6.2
构建完需要执行以下步骤:
- 进入目录 packages/dist2/@opentiny/grid
 - 修改依赖的版本号 2.6.2 -> 2.6.1 / 3.6.2 -> 3.6.1
 - 执行命令 
npm publish - 进入目录 packages/dist3/@opentiny/grid
 - 修改依赖的版本号 3.6.2 -> 3.6.1
 - 执行命令 
npm publish 
由于 @opentiny/vue 的依赖组件包版本使用波浪线语法 "@opentiny/vue-grid": "~3.6.0",因此用户只需要重新 npm i 即可更新 TinyVue 补丁版本。
"dependencies": {
  "@opentiny/vue-grid": "~3.6.0",
}
- 只构建单个组件的 Vue2 版本
 
用于单个组件在 Vue2 中有 bug,需要修复和发包的时候。
pnpm build:ui grid -t 6.2 -v 2
该命令只会重新构建 grid 组件的 Vue2 版本,产物在 packages/dist2/@opentiny/grid 目录。
构建完需要执行以下步骤:
- 进入目录 packages/dist2/@opentiny/grid
 - 修改依赖的版本号 2.6.2 -> 2.6.1 / 3.6.2 -> 3.6.1
 - 执行命令 
npm publish 
pnpm pub2
这个命令会将 dist2 中的产物包一个一个按序发布,中间如果有包发布失败,导致发布流程中止,可重新执行该命令,会从上一个发布失败的子包开始继续发包。
pnpm pub3