@varlet/cli 2.7.5 → 2.8.0-alpha.1676455225773

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
@@ -58,6 +58,15 @@ Also refer to `@varlet/ui` [varlet.config.mjs](https://github.com/varletjs/varle
58
58
  | `copy` | Copy file options | _[CopyPath[]](https://github.com/varletjs/varlet/blob/dev/packages/varlet-vite-plugins/src/copy.ts)_ | `-` |
59
59
  | `icons` | Font icon packaging related configuration | _[VarletConfigIcons](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/src/node/config/varlet.config.ts)_ | `-` |
60
60
 
61
+ #### Menu
62
+
63
+ | 参数 | 说明 | 类型 | 默认值 |
64
+ | -- | -------------- | -------- | ---------- |
65
+ | `doc` | The document page corresponds to the matching file name, required | _string_ | `-` |
66
+ | `type` | The type of menu, when the type is `1`, it means the category menu, when the type is `2`, the doc field matches the component file under src, when the type is `3`, the doc field matches the md file under docs, required | _MenuTypes_ | `-` |
67
+ | `text` | The text displayed in the menu, English display text can be configured when internationalization is set, required | _Record<string, string>_ | `-` |
68
+ | `useMobile` | Whether to display the mobile phone preview on the right side on the current document page, if not filled, the default value is useMobile in config | _boolean_ | `-` |
69
+
61
70
  ### Custom pages
62
71
 
63
72
  If you want to insert other pages into the component library, you can create a `pages` folder in the project root directory to write a vue component to generate other pages.
package/README.zh-CN.md CHANGED
@@ -58,6 +58,16 @@ varlet-cli gen
58
58
  | `copy` | 复制文件配置 | _[CopyPath[]](https://github.com/varletjs/varlet/blob/dev/packages/varlet-vite-plugins/src/copy.ts)_ | `-` |
59
59
  | `icons` | 字体图标打包相关配置 | _[VarletConfigIcons](https://github.com/varletjs/varlet/blob/dev/packages/varlet-cli/src/node/config/varlet.config.ts)_ | `-` |
60
60
 
61
+
62
+ #### Menu
63
+
64
+ | 参数 | 说明 | 类型 | 默认值 |
65
+ | -- | -------------- | -------- | ---------- |
66
+ | `doc` | 文档页面应匹配的文件名称, 必填 | _string_ | `-` |
67
+ | `type` | menu 类型, 当 type 为 `1` 时表示分类 menu, 类型为 `2` 时 doc 字段匹配 src 下的组件文件, 类型为`3`时 doc 字段匹配 docs 下的 md 文件 | _MenuTypes_ | `-` |
68
+ | `text` | menu 所展示的文字, 当设置国际化时可配置英文展示文字 | _Record<string, string>_ | `-` |
69
+ | `useMobile` | 是否在当前文档页显示右侧手机预览, 如不填写, 默认取 config 中的 useMobile | _boolean_ | `-` |
70
+
61
71
  ### 自定义页面
62
72
 
63
73
  如果想在组件库中插入其他页面,可以在项目根目录下的创建 `pages` 文件夹编写 vue 组件, 用来生成其他的页面。
@@ -35,15 +35,15 @@ export const SITE_CONFIG = resolve(CWD, '.varlet/site.config.json');
35
35
  // template highlight
36
36
  export const HL_DIR = resolve(CWD, 'highlight');
37
37
  export const HL_COMPONENT_NAME_RE = /.*(\/|\\)(.+)(\/|\\)docs(\/|\\)/;
38
- export const HL_API_RE = /##\s*API\n+/;
39
- export const HL_EN_TITLE_ATTRIBUTES_RE = /###\s*Props\s*\n+/;
40
- export const HL_EN_TITLE_EVENTS_RE = /###\s*Events\s*\n+/;
41
- export const HL_EN_TITLE_SLOTS_RE = /###\s*Slots\s*\n+/;
38
+ export const HL_API_RE = /##\s*API(?:\r\n|\n)+/;
39
+ export const HL_EN_TITLE_ATTRIBUTES_RE = /###\s*Props(?:\r\n|\n)+/;
40
+ export const HL_EN_TITLE_EVENTS_RE = /###\s*Events(?:\r\n|\n)+/;
41
+ export const HL_EN_TITLE_SLOTS_RE = /###\s*Slots(?:\r\n|\n)+/;
42
42
  export const HL_EN_MD = 'en-US.md';
43
43
  export const HL_EN_WEB_TYPES_JSON = resolve(HL_DIR, 'web-types.en-US.json');
44
- export const HL_ZH_TITLE_ATTRIBUTES_RE = /###\s*属性\s*\n+/;
45
- export const HL_ZH_TITLE_EVENTS_RE = /###\s*事件\s*\n+/;
46
- export const HL_ZH_TITLE_SLOTS_RE = /###\s*插槽\s*\n+/;
44
+ export const HL_ZH_TITLE_ATTRIBUTES_RE = /###\s*属性(?:\r\n|\n)+/;
45
+ export const HL_ZH_TITLE_EVENTS_RE = /###\s*事件(?:\r\n|\n)+/;
46
+ export const HL_ZH_TITLE_SLOTS_RE = /###\s*插槽(?:\r\n|\n)+/;
47
47
  export const HL_ZH_MD = 'zh-CN.md';
48
48
  export const HL_ZH_WEB_TYPES_JSON = resolve(HL_DIR, 'web-types.zh-CN.json');
49
49
  // icons
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "2.7.5",
3
+ "version": "2.8.0-alpha.1676455225773",
4
4
  "type": "module",
5
5
  "description": "cli of varlet",
6
6
  "bin": {
@@ -68,8 +68,8 @@
68
68
  "vite": "4.0.4",
69
69
  "vue": "3.2.25",
70
70
  "vue-jest": "^5.0.0-alpha.8",
71
- "@varlet/vite-plugins": "2.7.5",
72
- "@varlet/shared": "2.7.5"
71
+ "@varlet/vite-plugins": "2.8.0-alpha.1676455225773",
72
+ "@varlet/shared": "2.8.0-alpha.1676455225773"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/babel__core": "^7.1.12",
@@ -82,8 +82,8 @@
82
82
  "@types/semver": "^7.3.9",
83
83
  "@types/inquirer": "^9.0.2",
84
84
  "@types/sharp": "0.31.1",
85
- "@varlet/icons": "2.7.5",
86
- "@varlet/touch-emulator": "2.7.5"
85
+ "@varlet/icons": "2.8.0-alpha.1676455225773",
86
+ "@varlet/touch-emulator": "2.8.0-alpha.1676455225773"
87
87
  },
88
88
  "peerDependencies": {
89
89
  "@vue/runtime-core": "3.2.16",
@@ -93,8 +93,8 @@
93
93
  "lodash-es": "^4.17.21",
94
94
  "vue": "3.2.25",
95
95
  "vue-router": "4.0.12",
96
- "@varlet/icons": "2.7.5",
97
- "@varlet/touch-emulator": "2.7.5"
96
+ "@varlet/icons": "2.8.0-alpha.1676455225773",
97
+ "@varlet/touch-emulator": "2.8.0-alpha.1676455225773"
98
98
  },
99
99
  "scripts": {
100
100
  "dev": "tsc --watch",
@@ -87,6 +87,7 @@ watch(
87
87
  componentName.value = getComponentNameByMenuName(_menuName)
88
88
  menuName.value = _menuName
89
89
  language.value = lang
90
+ useMobile.value = menu.value.find(item => item.doc === _menuName)?.useMobile ?? get(config, 'useMobile')
90
91
  document.title = get(config, 'pc.title')[lang] as string
91
92
  },
92
93
  { immediate: true }
package/site/utils.ts CHANGED
@@ -5,6 +5,7 @@ export interface Menu {
5
5
  doc: string
6
6
  text: Record<string, string>
7
7
  type: MenuTypes
8
+ useMobile?: boolean
8
9
  }
9
10
 
10
11
  export enum MenuTypes {