br-dionysus 1.6.18 → 1.6.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1273,7 +1273,6 @@ const tableTitle = [
1273
1273
 
1274
1274
 
1275
1275
 
1276
-
1277
1276
  ```html
1278
1277
 
1279
1278
  <template>
@@ -1318,20 +1317,21 @@ const tableConfig = ref({
1318
1317
 
1319
1318
  ### 2) Attributes
1320
1319
 
1321
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
1322
- |-----------------------| ---------------------------------------------------- | ---------------------------------------- | ------ |-------|
1323
- | model-value / v-model | 绑定值 | { [propName: string]: TableConfigItem } | - | {} |
1324
- | link | 是否为链接按钮 | boolean | - | false |
1325
- | foldMode | 是否开启折叠 开启的话需要父级元素为flex布局/grid布局 | boolean | - | false |
1326
-
1327
-
1328
- ### 3) TableConfigItem
1329
- | 参数 | 说明 | 类型 |
1330
- | ----------- | ------------------------------------------------- | -------------------------- |
1331
- | minWidth | 最小列宽 | number,string |
1332
- | show | 是否显示 | boolean |
1333
- | sort | 排序 | number |
1334
- | label | 列名 | string |
1320
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
1321
+ |-----------------------|---------------------------------|------------------------------------------|-----|-------|
1322
+ | model-value / v-model | 绑定值 | { [propName: string]: TableConfigItem } | - | {} |
1323
+ | link | 是否为链接按钮 | boolean | - | false |
1324
+ | foldMode | 是否开启折叠 开启的话需要父级元素为flex布局/grid布局 | boolean | - | false |
1325
+ | moreSetPath | 更多设置按钮的path | string | - | '' |
1326
+
1327
+ ### 3) TableConfigItem
1328
+
1329
+ | 参数 | 说明 | 类型 |
1330
+ |-------------|---------------------------|----------------------------|
1331
+ | minWidth | 最小列宽 | number,string |
1332
+ | show | 是否显示 | boolean |
1333
+ | sort | 排序 | number |
1334
+ | label | 列名 | string |
1335
1335
  | headerAlign | 表头对齐方式, 若不设置该项,则使用表格的对齐方式 | 'left' ,'center' , 'right' |
1336
1336
 
1337
1337
 
@@ -3446,7 +3446,6 @@ const tableTitle = [
3446
3446
 
3447
3447
 
3448
3448
 
3449
-
3450
3449
  ```html
3451
3450
 
3452
3451
  <template>
@@ -3491,20 +3490,21 @@ const tableConfig = ref({
3491
3490
 
3492
3491
  ### 2) Attributes
3493
3492
 
3494
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
3495
- |-----------------------| ---------------------------------------------------- | ---------------------------------------- | ------ |-------|
3496
- | model-value / v-model | 绑定值 | { [propName: string]: TableConfigItem } | - | {} |
3497
- | link | 是否为链接按钮 | boolean | - | false |
3498
- | foldMode | 是否开启折叠 开启的话需要父级元素为flex布局/grid布局 | boolean | - | false |
3499
-
3500
-
3501
- ### 3) TableConfigItem
3502
- | 参数 | 说明 | 类型 |
3503
- | ----------- | ------------------------------------------------- | -------------------------- |
3504
- | minWidth | 最小列宽 | number,string |
3505
- | show | 是否显示 | boolean |
3506
- | sort | 排序 | number |
3507
- | label | 列名 | string |
3493
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
3494
+ |-----------------------|---------------------------------|------------------------------------------|-----|-------|
3495
+ | model-value / v-model | 绑定值 | { [propName: string]: TableConfigItem } | - | {} |
3496
+ | link | 是否为链接按钮 | boolean | - | false |
3497
+ | foldMode | 是否开启折叠 开启的话需要父级元素为flex布局/grid布局 | boolean | - | false |
3498
+ | moreSetPath | 更多设置按钮的path | string | - | '' |
3499
+
3500
+ ### 3) TableConfigItem
3501
+
3502
+ | 参数 | 说明 | 类型 |
3503
+ |-------------|---------------------------|----------------------------|
3504
+ | minWidth | 最小列宽 | number,string |
3505
+ | show | 是否显示 | boolean |
3506
+ | sort | 排序 | number |
3507
+ | label | 列名 | string |
3508
3508
  | headerAlign | 表头对齐方式, 若不设置该项,则使用表格的对齐方式 | 'left' ,'center' , 'right' |
3509
3509
 
3510
3510
 
package/attributes.json CHANGED
@@ -1 +1 @@
1
- {"m-dialog/modelValue":{"type":"boolean","description":""},"m-dialog/width":{"type":"string | number","description":"对话框的宽度,默认值为 50%"},"m-dialog/insideHeight":{"type":"number | null","description":"对话框内部空间的高度,默认为null"},"m-dialog/minInsideHeight":{"type":"number","description":"对话框内部空间的最小高度,默认为0(当同时存在maxHeight和minInsideHeight时,以maxHeight为准)"},"m-dialog/maxInsideHeight":{"type":"number","description":"对话框内部空间的最大高度,默认为Infinity"},"m-dialog/resize":{"type":"boolean","description":"是否开启拖拽改变大小"},"m-dialog/draggable":{"type":"boolean","description":"是否可拖动"},"m-dialog/insideClassName":{"type":"string","description":"对话框内部空间的className"},"m-dialog/resized":{"type":"[contentsSize: { width: number, height: number }]","description":"窗口大小改变完成事件"},"m-dialog/update:insideHeight":{"type":"[number]","description":"更新内部容器高度"},"m-dialog/update:modelValue":{"type":"[boolean]","description":""},"m-inline/minWidth":{"type":"number","description":"列最小宽度"},"m-inline/maxWidth":{"type":"number","description":"列最大宽度"},"m-inline/size":{"type":"Size","description":"组件尺寸"},"m-inline/switch":{"type":"[status: boolean]","description":"切换折叠展开事件"},"m-input-number/modelValue":{"type":"string | number","description":""},"m-input-number/placeholder":{"type":"string","description":""},"m-input-number/disabled":{"type":"boolean","description":"是否禁用数值输入框"},"m-input-number/size":{"type":"string","description":"数值输入框尺寸"},"m-input-number/min":{"type":"number","description":"设置数值输入框允许的最小值"},"m-input-number/max":{"type":"number","description":"设置数值输入框允许的最大值"},"m-input-number/step":{"type":"number","description":"数值输入框步长"},"m-input-number/stepStrictly":{"type":"boolean","description":"是否只能输入 step 的倍数"},"m-input-number/thousandthPlace":{"type":"boolean","description":"输入框是否显示千分位"},"m-input-number/noBorder":{"type":"boolean","description":"是否不要边框"},"m-input-number/noSpacing":{"type":"boolean","description":"不要边距"},"m-input-number/update:modelValue":{"type":"any","description":""},"m-input-number/change":{"type":"any","description":""},"m-input-number/focus":{"type":"any","description":""},"m-input-number/blur":{"type":"any","description":""},"m-select/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select/multiple":{"type":"boolean","description":"多选"},"m-select-table/modelValue":{"type":"string | number | Array<number | string>","description":""},"m-select-table/name":{"type":"string | number | Array<number | string>","description":"显示值"},"m-select-table/placeholder":{"type":"string","description":""},"m-select-table/disabled":{"type":"boolean","description":""},"m-select-table/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table/total":{"type":"number | null","description":"总数据量,当有值时,出现分页器"},"m-select-table/filterMethod":{"type":"Function | null","description":"自定义搜索"},"m-select-table/filterable":{"type":"boolean","description":"是否使用搜索"},"m-select-table/remote":{"type":"boolean","description":"是否使用 远程搜索"},"m-select-table/remoteMethod":{"type":"Function","description":"自定义远程搜索"},"m-select-table/options":{"type":"Option[]","description":""},"m-select-table/tableTitle":{"type":"TableTitle[]","description":""},"m-select-table/multiple":{"type":"boolean","description":"是否多选"},"m-select-table/keywords":{"type":"Option","description":"定义默认的 label 和value"},"m-select-table/reserveSelection":{"type":"boolean","description":"是否开启翻页多选"},"m-select-table/tableHeight":{"type":"string | number","description":""},"m-select-table/isAffirmBtn":{"type":"boolean","description":"是否有确认按钮"},"m-select-table/scrollbarAlwaysOn":{"type":"boolean","description":"是否常态显示滚动条"},"m-select-table/allowCreate":{"type":"boolean","description":"是否能够创建条目"},"m-select-table/border":{"type":"boolean","description":"表格边框"},"m-select-table/popupWidth":{"type":"number | string","description":"弹窗的宽度"},"m-select-table/selected":{"type":"[values: string | number | Array<string | number>, rows: Option[] | Option]","description":"单选或多选之后的回调"},"m-select-table/selectMultiple":{"type":"[values: Array<string | number>, rows: Option[]]","description":"多选确认按钮时的回调 配合isAffirmBtn使用"},"m-select-table/toPage":{"type":"[page: Page, query?: string]","description":"当没有使用filterMethod时候才会有回调否则没有"},"m-select-table/update:modelValue":{"type":"[value: string | number | Array<string | number>]","description":""},"m-select-table/clear":{"type":"[]","description":"用户点击清空按钮时触发"},"m-select-table/removeTag":{"type":"[tag: any]","description":"多选模式下移除tag时触发"},"m-select-table-v1/modelValue":{"type":"string | number","description":""},"m-select-table-v1/placeholder":{"type":"string","description":""},"m-select-table-v1/disabled":{"type":"boolean","description":""},"m-select-table-v1/options":{"type":"Option[]","description":""},"m-select-table-v1/tableTitle":{"type":"any[]","description":""},"m-select-table-v1/remoteMethod":{"type":"Function","description":""},"m-select-table-v1/allowCreate":{"type":"boolean","description":""},"m-select-table-v1/focusShow":{"type":"boolean","description":""},"m-select-table-v1/isSelect":{"type":"boolean","description":""},"m-select-table-v1/clearable":{"type":"boolean","description":""},"m-select-table-v1/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table-v1/labelKey":{"type":"string","description":""},"m-select-table-v1/scrollbarAlwaysOn":{"type":"boolean","description":""},"m-select-table-v1/total":{"type":"number | null","description":""},"m-select-table-v1/update:modelValue":{"type":"any","description":""},"m-select-table-v1/selectMultiple":{"type":"any","description":""},"m-select-table-v1/change":{"type":"any","description":""},"m-select-table-v1/selected":{"type":"any","description":""},"m-select-table-v1/clear":{"type":"any","description":""},"m-select-v2/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select-v2/multiple":{"type":"boolean","description":"多选"},"m-select-v2/showAll":{"type":"boolean","description":"是否显示全选"},"m-select-v2/options":{"type":"Option[]","description":"选项"},"m-select-v2/update:modelValue":{"type":"[data: any]","description":""},"m-table/size":{"type":"'small' | 'large' | ''","description":""},"m-table/sole":{"type":"string","description":""},"m-table/data":{"type":"Array<{\n [key: string]: any\n }>","description":""},"m-table/filtersValue":{"type":"FilterValue","description":""},"m-table/tableConfig":{"type":"TableConfig | null","description":"表格配置"},"m-table/expandProp":{"type":"string","description":"展开图标列(如使用这个属性则必须存在rowKey属性,并且expand列必须为第一列) (标记,约束条件后面解决)"},"m-table/expandRowKeys":{"type":"any[]","description":"可以通过该属性设置 Table 目前的展开行,需要设置 row-key 属性才能使用,该属性为展开行的 keys 数组。"},"m-table/rowKey":{"type":"Function | string","description":"行数据的 Key,用来优化 Table 的渲染; 在使用reserve-selection功能与显示树形数据时,该属性是必填的。 类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function。"},"m-table/pasteData":{"type":"[data: {\n /** 粘贴行的行数据 */\n editRow: { [key: string]: any },\n /** 粘贴列的列名 */\n editColumn: string,\n /** 粘贴的数据 */\n arr: Array<string | number>,\n /** 起始行 */\n rowIndex: number,\n },\n /** 粘贴完成后的表格数据 */\n tableData: Array<{ [key: string]: any\n }>]","description":""},"m-table/update:tableConfig":{"type":"[tableConfig: TableConfig]","description":""},"m-table-column/filtersValue":{"type":"FilterValue","description":"过滤值"},"m-table-column/filters":{"type":"Array<{ text: string | number, value: string | number }>","description":"过滤选项"},"m-table-column/filterMethod":{"type":"Function | null","description":"过滤方法"},"m-table-column/children":{"type":"Array<PropChildren>","description":""},"m-table-column/update:filtersValue":{"type":"any","description":""},"m-table-column-set/modelValue":{"type":"TableConfig","description":"配置"},"m-table-column-set/foldMode":{"type":"boolean","description":"是否为折叠模式"},"m-table-column-set/link":{"type":"boolean","description":"是否为链接按钮"},"m-table-column-set/update:modelValue":{"type":"any","description":""},"m-table-column-set/change":{"type":"any","description":""},"skin-config/change":{"type":"any","description":""},"tab-page/modelValue":{"type":"MenuItem[]","description":""},"tab-page/activeKey":{"type":"string","description":""},"tab-page/showRightClickMenu":{"type":"boolean","description":""},"tab-page/primaryColor":{"type":"string","description":""},"tab-page/primaryBackgroundColor":{"type":"string | null","description":""},"tab-page/close":{"type":"any","description":""},"tab-page/click":{"type":"any","description":""}}
1
+ {"m-dialog/modelValue":{"type":"boolean","description":""},"m-dialog/width":{"type":"string | number","description":"对话框的宽度,默认值为 50%"},"m-dialog/insideHeight":{"type":"number | null","description":"对话框内部空间的高度,默认为null"},"m-dialog/minInsideHeight":{"type":"number","description":"对话框内部空间的最小高度,默认为0(当同时存在maxHeight和minInsideHeight时,以maxHeight为准)"},"m-dialog/maxInsideHeight":{"type":"number","description":"对话框内部空间的最大高度,默认为Infinity"},"m-dialog/resize":{"type":"boolean","description":"是否开启拖拽改变大小"},"m-dialog/draggable":{"type":"boolean","description":"是否可拖动"},"m-dialog/insideClassName":{"type":"string","description":"对话框内部空间的className"},"m-dialog/resized":{"type":"[contentsSize: { width: number, height: number }]","description":"窗口大小改变完成事件"},"m-dialog/update:insideHeight":{"type":"[number]","description":"更新内部容器高度"},"m-dialog/update:modelValue":{"type":"[boolean]","description":""},"m-inline/minWidth":{"type":"number","description":"列最小宽度"},"m-inline/maxWidth":{"type":"number","description":"列最大宽度"},"m-inline/size":{"type":"Size","description":"组件尺寸"},"m-inline/switch":{"type":"[status: boolean]","description":"切换折叠展开事件"},"m-input-number/modelValue":{"type":"string | number","description":""},"m-input-number/placeholder":{"type":"string","description":""},"m-input-number/disabled":{"type":"boolean","description":"是否禁用数值输入框"},"m-input-number/size":{"type":"string","description":"数值输入框尺寸"},"m-input-number/min":{"type":"number","description":"设置数值输入框允许的最小值"},"m-input-number/max":{"type":"number","description":"设置数值输入框允许的最大值"},"m-input-number/step":{"type":"number","description":"数值输入框步长"},"m-input-number/stepStrictly":{"type":"boolean","description":"是否只能输入 step 的倍数"},"m-input-number/thousandthPlace":{"type":"boolean","description":"输入框是否显示千分位"},"m-input-number/noBorder":{"type":"boolean","description":"是否不要边框"},"m-input-number/noSpacing":{"type":"boolean","description":"不要边距"},"m-input-number/update:modelValue":{"type":"any","description":""},"m-input-number/change":{"type":"any","description":""},"m-input-number/focus":{"type":"any","description":""},"m-input-number/blur":{"type":"any","description":""},"m-select/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select/multiple":{"type":"boolean","description":"多选"},"m-select-table/modelValue":{"type":"string | number | Array<number | string>","description":""},"m-select-table/name":{"type":"string | number | Array<number | string>","description":"显示值"},"m-select-table/placeholder":{"type":"string","description":""},"m-select-table/disabled":{"type":"boolean","description":""},"m-select-table/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table/total":{"type":"number | null","description":"总数据量,当有值时,出现分页器"},"m-select-table/filterMethod":{"type":"Function | null","description":"自定义搜索"},"m-select-table/filterable":{"type":"boolean","description":"是否使用搜索"},"m-select-table/remote":{"type":"boolean","description":"是否使用 远程搜索"},"m-select-table/remoteMethod":{"type":"Function","description":"自定义远程搜索"},"m-select-table/options":{"type":"Option[]","description":""},"m-select-table/tableTitle":{"type":"TableTitle[]","description":""},"m-select-table/multiple":{"type":"boolean","description":"是否多选"},"m-select-table/keywords":{"type":"Option","description":"定义默认的 label 和value"},"m-select-table/reserveSelection":{"type":"boolean","description":"是否开启翻页多选"},"m-select-table/tableHeight":{"type":"string | number","description":""},"m-select-table/isAffirmBtn":{"type":"boolean","description":"是否有确认按钮"},"m-select-table/scrollbarAlwaysOn":{"type":"boolean","description":"是否常态显示滚动条"},"m-select-table/allowCreate":{"type":"boolean","description":"是否能够创建条目"},"m-select-table/border":{"type":"boolean","description":"表格边框"},"m-select-table/popupWidth":{"type":"number | string","description":"弹窗的宽度"},"m-select-table/selected":{"type":"[values: string | number | Array<string | number>, rows: Option[] | Option]","description":"单选或多选之后的回调"},"m-select-table/selectMultiple":{"type":"[values: Array<string | number>, rows: Option[]]","description":"多选确认按钮时的回调 配合isAffirmBtn使用"},"m-select-table/toPage":{"type":"[page: Page, query?: string]","description":"当没有使用filterMethod时候才会有回调否则没有"},"m-select-table/update:modelValue":{"type":"[value: string | number | Array<string | number>]","description":""},"m-select-table/clear":{"type":"[]","description":"用户点击清空按钮时触发"},"m-select-table/removeTag":{"type":"[tag: any]","description":"多选模式下移除tag时触发"},"m-select-table-v1/modelValue":{"type":"string | number","description":""},"m-select-table-v1/placeholder":{"type":"string","description":""},"m-select-table-v1/disabled":{"type":"boolean","description":""},"m-select-table-v1/options":{"type":"Option[]","description":""},"m-select-table-v1/tableTitle":{"type":"any[]","description":""},"m-select-table-v1/remoteMethod":{"type":"Function","description":""},"m-select-table-v1/allowCreate":{"type":"boolean","description":""},"m-select-table-v1/focusShow":{"type":"boolean","description":""},"m-select-table-v1/isSelect":{"type":"boolean","description":""},"m-select-table-v1/clearable":{"type":"boolean","description":""},"m-select-table-v1/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table-v1/labelKey":{"type":"string","description":""},"m-select-table-v1/scrollbarAlwaysOn":{"type":"boolean","description":""},"m-select-table-v1/total":{"type":"number | null","description":""},"m-select-table-v1/update:modelValue":{"type":"any","description":""},"m-select-table-v1/selectMultiple":{"type":"any","description":""},"m-select-table-v1/change":{"type":"any","description":""},"m-select-table-v1/selected":{"type":"any","description":""},"m-select-table-v1/clear":{"type":"any","description":""},"m-select-v2/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select-v2/multiple":{"type":"boolean","description":"多选"},"m-select-v2/showAll":{"type":"boolean","description":"是否显示全选"},"m-select-v2/options":{"type":"Option[]","description":"选项"},"m-select-v2/update:modelValue":{"type":"[data: any]","description":""},"m-table/size":{"type":"'small' | 'large' | ''","description":""},"m-table/sole":{"type":"string","description":""},"m-table/data":{"type":"Array<{\n [key: string]: any\n }>","description":""},"m-table/filtersValue":{"type":"FilterValue","description":""},"m-table/tableConfig":{"type":"TableConfig | null","description":"表格配置"},"m-table/expandProp":{"type":"string","description":"展开图标列(如使用这个属性则必须存在rowKey属性,并且expand列必须为第一列) (标记,约束条件后面解决)"},"m-table/expandRowKeys":{"type":"any[]","description":"可以通过该属性设置 Table 目前的展开行,需要设置 row-key 属性才能使用,该属性为展开行的 keys 数组。"},"m-table/rowKey":{"type":"Function | string","description":"行数据的 Key,用来优化 Table 的渲染; 在使用reserve-selection功能与显示树形数据时,该属性是必填的。 类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function。"},"m-table/pasteData":{"type":"[data: {\n /** 粘贴行的行数据 */\n editRow: { [key: string]: any },\n /** 粘贴列的列名 */\n editColumn: string,\n /** 粘贴的数据 */\n arr: Array<string | number>,\n /** 起始行 */\n rowIndex: number,\n },\n /** 粘贴完成后的表格数据 */\n tableData: Array<{ [key: string]: any\n }>]","description":""},"m-table/update:tableConfig":{"type":"[tableConfig: TableConfig]","description":""},"m-table-column/filtersValue":{"type":"FilterValue","description":"过滤值"},"m-table-column/filters":{"type":"Array<{ text: string | number, value: string | number }>","description":"过滤选项"},"m-table-column/filterMethod":{"type":"Function | null","description":"过滤方法"},"m-table-column/children":{"type":"Array<PropChildren>","description":""},"m-table-column/update:filtersValue":{"type":"any","description":""},"m-table-column-set/modelValue":{"type":"TableConfig","description":"配置"},"m-table-column-set/foldMode":{"type":"boolean","description":"是否为折叠模式"},"m-table-column-set/link":{"type":"boolean","description":"是否为链接按钮"},"m-table-column-set/moreSetPath":{"type":"''","description":"更多设置按钮的path"},"m-table-column-set/update:modelValue":{"type":"any","description":""},"m-table-column-set/change":{"type":"any","description":""},"skin-config/change":{"type":"any","description":""},"tab-page/modelValue":{"type":"MenuItem[]","description":""},"tab-page/activeKey":{"type":"string","description":""},"tab-page/showRightClickMenu":{"type":"boolean","description":""},"tab-page/primaryColor":{"type":"string","description":""},"tab-page/primaryBackgroundColor":{"type":"string | null","description":""},"tab-page/close":{"type":"any","description":""},"tab-page/click":{"type":"any","description":""}}
@@ -4,6 +4,7 @@ import { defineConfig } from 'vite'
4
4
  import vue from '@vitejs/plugin-vue'
5
5
  import Markdown from 'vite-plugin-md'
6
6
  import VueDevTools from 'vite-plugin-vue-devtools'
7
+ import compressedFiles from '../compressedFiles'
7
8
 
8
9
  export default defineConfig({
9
10
  resolve: {
@@ -18,7 +19,13 @@ export default defineConfig({
18
19
  }),
19
20
  // eslint(),
20
21
  Markdown(),
21
- VueDevTools()
22
+ VueDevTools(),
23
+ {
24
+ name: 'build-complete',
25
+ async writeBundle () {
26
+ // compressedFiles()
27
+ }
28
+ }
22
29
  ],
23
30
  server: {
24
31
  port: 5177
@@ -0,0 +1,63 @@
1
+ import fs from 'fs'// 文件服务
2
+ import archiver from 'archiver'
3
+ import dayjs from 'dayjs'
4
+
5
+ const disDir = 'docs' // 打包之后的dist 目录
6
+ const pJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'))
7
+ let mode: string = '' // 当前打包的模式
8
+ let zipFilePath: string = '' // 压缩文件保存路径
9
+
10
+ // //定义压缩方法
11
+ function files () {
12
+ // 创建输出流
13
+ const output = fs.createWriteStream(zipFilePath)
14
+ // 创建 zip 归档器
15
+ const archive = archiver('zip', {
16
+ zlib: { level: 9 } // 设置压缩级别
17
+ })
18
+ // 将输出流绑定到归档器上
19
+ archive.pipe(output)
20
+ // 添加要归档的 dist 文件夹
21
+ archive.directory(disDir, 'dist')
22
+ // 完成归档操作
23
+ archive.finalize()
24
+
25
+ archive.on('end', function () {
26
+ console.log(`[${mode}] 压缩完成`)
27
+ remoaveFiles()
28
+ fs.rmdirSync(disDir, { recursive: true })
29
+ })
30
+ }
31
+
32
+ function remoaveFiles () {
33
+ fs.rmdir(disDir, { recursive: true }, (err) => {
34
+ if (err) return console.error(err)
35
+ console.log('dist目录删除成功')
36
+ })
37
+ }
38
+
39
+ function addVersion () {
40
+ const data = {
41
+ version: new Date().getTime(),
42
+ build: mode
43
+ }
44
+ const json = JSON.stringify(data)
45
+ // 在这里更新版本号信息
46
+ fs.writeFile('./dist/ver.json', json, err => {
47
+ if (err) throw err
48
+ console.log(`版本号已更新为:${data.version}`)
49
+ console.log(`打包指令为${mode}`)
50
+ files()
51
+ })
52
+ }
53
+
54
+ const compressedFiles = (data: { mode: string } = { mode: 'default' }) => {
55
+ mode = data.mode || 'default' // 当前打包的模式
56
+ zipFilePath = `${pJson.name}-${mode}.zip` // 压缩文件保存路径
57
+ setTimeout(() => {
58
+ addVersion()
59
+ console.log('开始压缩', dayjs().unix())
60
+ }, 1000 * 5.5)
61
+ }
62
+
63
+ export default compressedFiles