cmpt-huitu-cli 1.0.0 → 1.0.2
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 +14 -4
- package/package.json +1 -1
- package/src/create.js +9 -1
- package/templates/.DS_Store +0 -0
- package/templates/default/.lingma/rules/project-rules.md +711 -0
- package/templates/default/.qoder/rules/project-rules.md +715 -0
- package/templates/default/.trae/rules/project-rules.md +711 -0
- package/templates/default/README.md +6 -6
- package/templates/default/src/components.d.ts +3 -3
- package/templates/default/src/main.js +1 -1
- package/templates/default/src/routers/base.js +4 -4
- package/templates/default/src/styles/index.scss +6 -6
- package/templates/default/src/styles/theme/README.md +5 -5
- package/templates/default/src/utils/auth.js +1 -1
- package/templates/default/src/utils/requestAxios.js +1 -1
- package/templates/default/src/utils/theme.js +1 -1
- package/templates/default/src/views/{Home.vue → home.vue} +5 -20
- package/templates/default/vite.config.js +18 -4
- /package/templates/default/src/{App.vue → app.vue} +0 -0
- /package/templates/default/src/components/error/{Error.vue → error.vue} +0 -0
- /package/templates/default/src/views/{About.vue → about.vue} +0 -0
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
- ✅ **Element Plus**:企业级 UI 组件库
|
|
12
12
|
- ✅ **Pinia**:Vue 3 官方状态管理
|
|
13
13
|
- ✅ **Vue Router**:官方路由管理器
|
|
14
|
-
- ✅
|
|
15
|
-
- ✅
|
|
14
|
+
- ✅ **cmpt-huitu-ui**:共享 UI 组件库
|
|
15
|
+
- ✅ **cmpt-huitu-utils**:共享工具函数库
|
|
16
16
|
|
|
17
17
|
## 🚀 快速开始
|
|
18
18
|
|
|
@@ -81,16 +81,16 @@ template/
|
|
|
81
81
|
|
|
82
82
|
## 📦 共享包使用
|
|
83
83
|
|
|
84
|
-
### 使用
|
|
84
|
+
### 使用 cmpt-huitu-ui 组件
|
|
85
85
|
|
|
86
86
|
```javascript
|
|
87
|
-
import { HTable,
|
|
87
|
+
import { HTable, VexTable, HtDialog } from 'cmpt-huitu-ui'
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
### 使用
|
|
90
|
+
### 使用 cmpt-huitu-utils 工具
|
|
91
91
|
|
|
92
92
|
```javascript
|
|
93
|
-
import { parseTime, cache, modal } from '
|
|
93
|
+
import { parseTime, cache, modal } from 'cmpt-huitu-utils'
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
## 🔧 开发命令
|
|
@@ -8,9 +8,9 @@ export {}
|
|
|
8
8
|
/* prettier-ignore */
|
|
9
9
|
declare module 'vue' {
|
|
10
10
|
export interface GlobalComponents {
|
|
11
|
-
About: typeof import('./views/
|
|
12
|
-
Error: typeof import('./components/error/
|
|
13
|
-
Home: typeof import('./views/
|
|
11
|
+
About: typeof import('./views/about.vue')['default']
|
|
12
|
+
Error: typeof import('./components/error/error.vue')['default']
|
|
13
|
+
Home: typeof import('./views/home.vue')['default']
|
|
14
14
|
Login: typeof import('./views/login/index.vue')['default']
|
|
15
15
|
RouterLink: typeof import('vue-router')['RouterLink']
|
|
16
16
|
RouterView: typeof import('vue-router')['RouterView']
|
|
@@ -3,12 +3,12 @@ export const constantRoutes = [
|
|
|
3
3
|
{
|
|
4
4
|
path: '/401',
|
|
5
5
|
name: '401',
|
|
6
|
-
component: () => import('@components/error/
|
|
6
|
+
component: () => import('@components/error/error.vue'),
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
path: '/404',
|
|
10
10
|
name: '404',
|
|
11
|
-
component: () => import('@components/error/
|
|
11
|
+
component: () => import('@components/error/error.vue'),
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
path: '/login',
|
|
@@ -21,7 +21,7 @@ export const constantRoutes = [
|
|
|
21
21
|
{
|
|
22
22
|
path: '/',
|
|
23
23
|
name: 'index',
|
|
24
|
-
component: () => import('@views/
|
|
24
|
+
component: () => import('@views/home.vue'),
|
|
25
25
|
meta: {
|
|
26
26
|
title: '首页',
|
|
27
27
|
keepAlive: true,
|
|
@@ -30,7 +30,7 @@ export const constantRoutes = [
|
|
|
30
30
|
{
|
|
31
31
|
path: '/about',
|
|
32
32
|
name: 'about',
|
|
33
|
-
component: () => import('@views/
|
|
33
|
+
component: () => import('@views/about.vue'),
|
|
34
34
|
},
|
|
35
35
|
]
|
|
36
36
|
|
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
* @Date: 2026-01-04
|
|
5
5
|
* @Description:
|
|
6
6
|
* 1. 公共样式已通过 vite.config.js 的 additionalData 全局引入:
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
7
|
+
* - cmpt-huitu-ui/src/styles/variables.scss (公共变量)
|
|
8
|
+
* - cmpt-huitu-ui/src/styles/mixin.scss (公共 mixin)
|
|
9
9
|
* 2. 必须显式引入以下产生 CSS 输出的全局样式文件(不能放在 additionalData 中):
|
|
10
10
|
* - src/styles/theme/variables.scss (项目主题变量定义)
|
|
11
|
-
* -
|
|
11
|
+
* - cmpt-huitu-ui/src/styles/reset.scss (Element Plus 样式重置)
|
|
12
12
|
* 3. 项目自定义样式请放在 theme/ 目录下,并在此处引入
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
// 引入 CSS 变量定义(主题配置)
|
|
16
|
-
@
|
|
16
|
+
@use "./theme/variables.scss" as *;
|
|
17
17
|
|
|
18
18
|
// 引入 Element Plus 重置样式(依赖上面的变量)
|
|
19
|
-
// @
|
|
19
|
+
// @use 'cmpt-huitu-ui/src/styles/reset.scss';
|
|
20
20
|
|
|
21
21
|
// 项目自定义样式
|
|
22
22
|
// 如需添加其他自定义样式,请在 theme/ 目录下创建文件并在此处引入
|
|
23
|
-
// @
|
|
23
|
+
// @use './theme/custom.scss' as *;
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
2. 在 `src/styles/index.scss` 中引入你的样式文件:
|
|
13
13
|
```scss
|
|
14
|
-
@
|
|
14
|
+
@use './theme/custom.scss' as *;
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## 公共样式
|
|
18
18
|
|
|
19
|
-
公共样式变量和 mixin 已通过
|
|
19
|
+
公共样式变量和 mixin 已通过 `cmpt-huitu-ui` 提供,在 `vite.config.js` 中已全局配置:
|
|
20
|
+
|
|
20
21
|
- `variables.scss` - 公共变量(字体大小、颜色等)
|
|
21
22
|
- `mixin.scss` - 公共 mixin(滚动条、统计数据样式等)
|
|
22
23
|
- `reset.scss` - 样式重置(Element Plus 组件样式重置等)
|
|
@@ -29,12 +30,12 @@
|
|
|
29
30
|
|
|
30
31
|
```scss
|
|
31
32
|
// src/styles/theme/variables.scss
|
|
32
|
-
:root[data-theme=
|
|
33
|
+
:root[data-theme='light'] {
|
|
33
34
|
--my-custom-color: #067dff;
|
|
34
35
|
--my-custom-bg: #ffffff;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
:root[data-theme=
|
|
38
|
+
:root[data-theme='dark'] {
|
|
38
39
|
--my-custom-color: #e3a000;
|
|
39
40
|
--my-custom-bg: #00192e;
|
|
40
41
|
}
|
|
@@ -49,4 +50,3 @@
|
|
|
49
50
|
background: var(--my-custom-bg);
|
|
50
51
|
}
|
|
51
52
|
```
|
|
52
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="home">
|
|
3
|
-
<
|
|
3
|
+
<h1>欢迎使用慧图标准脚手架</h1>
|
|
4
4
|
<VexTable
|
|
5
5
|
:columns="columns"
|
|
6
6
|
:data="data"
|
|
@@ -17,28 +17,13 @@
|
|
|
17
17
|
<li><el-tag>Vue 3</el-tag></li>
|
|
18
18
|
<li><el-tag type="success">Vite</el-tag></li>
|
|
19
19
|
<li><el-tag type="warning">Element Plus</el-tag></li>
|
|
20
|
-
<li><el-tag type="danger"
|
|
21
|
-
<li><el-tag type="info"
|
|
20
|
+
<li><el-tag type="danger">cmpt-huitu-ui</el-tag></li>
|
|
21
|
+
<li><el-tag type="info">cmpt-huitu-utils</el-tag></li>
|
|
22
22
|
</ul>
|
|
23
23
|
|
|
24
|
-
<div class="demo-section">
|
|
25
|
-
<h3>UI 组件演示</h3>
|
|
26
|
-
<div class="demo-item">
|
|
27
|
-
<p>AccentTitle:</p>
|
|
28
|
-
<AccentTitle
|
|
29
|
-
title="测试标题"
|
|
30
|
-
unit="单位: 个"
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
<div class="demo-item">
|
|
34
|
-
<p>BgTag:</p>
|
|
35
|
-
<BgTag label="标签组件" />
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
24
|
<div class="demo-section">
|
|
40
25
|
<h3>Utils 工具演示</h3>
|
|
41
|
-
<p>当前时间 (formatted by
|
|
26
|
+
<p>当前时间 (formatted by cmpt-huitu-utils): {{ currentTime }}</p>
|
|
42
27
|
</div>
|
|
43
28
|
</div>
|
|
44
29
|
</div>
|
|
@@ -46,7 +31,7 @@
|
|
|
46
31
|
|
|
47
32
|
<script setup>
|
|
48
33
|
import { ref, onMounted } from 'vue'
|
|
49
|
-
import { parseTime } from '
|
|
34
|
+
import { parseTime } from 'cmpt-huitu-utils'
|
|
50
35
|
|
|
51
36
|
const currentTime = ref('')
|
|
52
37
|
const columns = [
|
|
@@ -106,8 +106,8 @@ export default defineConfig(({ mode, command }) => {
|
|
|
106
106
|
preprocessorOptions: {
|
|
107
107
|
scss: {
|
|
108
108
|
additionalData: `
|
|
109
|
-
@use "
|
|
110
|
-
@use "
|
|
109
|
+
@use "cmpt-huitu-ui/src/styles/variables.scss" as *;
|
|
110
|
+
@use "cmpt-huitu-ui/src/styles/mixin.scss" as *;
|
|
111
111
|
`,
|
|
112
112
|
},
|
|
113
113
|
},
|
|
@@ -165,8 +165,22 @@ export default defineConfig(({ mode, command }) => {
|
|
|
165
165
|
|
|
166
166
|
// 优化依赖预构建(当你首次启动 vite 时,Vite 在本地加载你的站点之前预构建了项目依赖。)
|
|
167
167
|
optimizeDeps: {
|
|
168
|
-
include: [
|
|
169
|
-
|
|
168
|
+
include: [
|
|
169
|
+
'vue',
|
|
170
|
+
'vue-router',
|
|
171
|
+
'pinia',
|
|
172
|
+
'axios',
|
|
173
|
+
'element-plus',
|
|
174
|
+
'dayjs',
|
|
175
|
+
'dayjs/plugin/duration',
|
|
176
|
+
'dayjs/plugin/relativeTime',
|
|
177
|
+
'dayjs/plugin/isBetween',
|
|
178
|
+
'dayjs/plugin/weekday',
|
|
179
|
+
'dayjs/plugin/weekOfYear',
|
|
180
|
+
'dayjs/plugin/isSameOrBefore',
|
|
181
|
+
'dayjs/plugin/isSameOrAfter',
|
|
182
|
+
], // 默认情况下,不在 node_modules 中的,链接的包不会被预构建
|
|
183
|
+
exclude: ['cmpt-huitu-ui', 'cmpt-huitu-utils'], // 在预构建中强制排除的依赖项
|
|
170
184
|
force: false, // 强制进行依赖预构建
|
|
171
185
|
},
|
|
172
186
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|