@duxweb/dvha-template 1.0.10 → 1.0.11

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/bin/index.js CHANGED
@@ -139,13 +139,31 @@ async function createProject(projectName) {
139
139
  fs.copySync(uiPagesDir, targetPagesDir)
140
140
  }
141
141
 
142
- // 2.5. 检查并复制UI特定的main.ts文件(如果存在)
143
- const uiMainTsPath = path.resolve(__dirname, '..', 'template', 'ui-configs', template, 'main.ts')
142
+ // 2.5. 检查并复制UI特定的配置文件(如果存在)
143
+ const uiConfigDir = path.resolve(__dirname, '..', 'template', 'ui-configs', template)
144
+
145
+ // 复制 main.ts
146
+ const uiMainTsPath = path.join(uiConfigDir, 'main.ts')
144
147
  if (fs.existsSync(uiMainTsPath)) {
145
148
  const targetMainTsPath = path.join(root, 'main.ts')
146
149
  fs.copySync(uiMainTsPath, targetMainTsPath)
147
150
  }
148
151
 
152
+ // 复制 vite.config.ts
153
+ const uiViteConfigPath = path.join(uiConfigDir, 'vite.config.ts')
154
+ if (fs.existsSync(uiViteConfigPath)) {
155
+ const targetViteConfigPath = path.join(root, 'vite.config.ts')
156
+ fs.copySync(uiViteConfigPath, targetViteConfigPath)
157
+ }
158
+
159
+ // 对于 pro 模板,删除 uno.config.ts(因为不需要 UnoCSS)
160
+ if (template === 'pro') {
161
+ const targetUnoConfigPath = path.join(root, 'uno.config.ts')
162
+ if (fs.existsSync(targetUnoConfigPath)) {
163
+ fs.removeSync(targetUnoConfigPath)
164
+ }
165
+ }
166
+
149
167
  // 3. 更新package.json
150
168
  const pkgPath = path.join(root, 'package.json')
151
169
  if (fs.existsSync(pkgPath)) {
@@ -167,6 +185,18 @@ async function createProject(projectName) {
167
185
  }
168
186
  }
169
187
 
188
+ // 移除排除的依赖
189
+ if (uiConfig.excludeDependencies && Array.isArray(uiConfig.excludeDependencies)) {
190
+ uiConfig.excludeDependencies.forEach((dep) => {
191
+ if (pkg.dependencies && pkg.dependencies[dep]) {
192
+ delete pkg.dependencies[dep]
193
+ }
194
+ if (pkg.devDependencies && pkg.devDependencies[dep]) {
195
+ delete pkg.devDependencies[dep]
196
+ }
197
+ })
198
+ }
199
+
170
200
  fs.writeJsonSync(pkgPath, pkg, { spaces: 2 })
171
201
  }
172
202
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duxweb/dvha-template",
3
3
  "type": "module",
4
- "version": "1.0.10",
4
+ "version": "1.0.11",
5
5
  "description": "Create DVHA project from template",
6
6
  "author": "DuxWeb",
7
7
  "license": "MIT",
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { DuxCard, DuxChart, DuxDashboardQuick } from '@duxweb/dvha-pro'
3
- import { NButton, NGi, NGrid } from 'naive-ui'
2
+ import { DuxCard } from '@duxweb/dvha-pro'
4
3
  import { computed, ref } from 'vue'
5
4
 
6
5
  // 基本统计数据
@@ -37,11 +36,11 @@ const chartData = computed(() => ({
37
36
  </script>
38
37
 
39
38
  <template>
40
- <div class="p-6 space-y-6">
39
+ <div class="space-y-4">
41
40
  <!-- 欢迎区域 -->
42
41
  <DuxCard>
43
42
  <div class="text-center py-8">
44
- <div class="i-tabler:brand-vue text-6xl text-blue-600 mx-auto mb-6" />
43
+ <div class="i-tabler:brand-vue text-4xl text-blue-600 mx-auto mb-4" />
45
44
  <h1 class="text-3xl font-bold text-gray-900 dark:text-gray-100 mb-4">
46
45
  欢迎使用 Dux Pro
47
46
  </h1>
@@ -51,108 +50,119 @@ const chartData = computed(() => ({
51
50
  </div>
52
51
  </DuxCard>
53
52
 
54
- <!-- 统计卡片 -->
55
- <NGrid :cols="3" :x-gap="16">
56
- <NGi v-for="item in stats" :key="item.label">
57
- <DuxDashboardQuick
58
- :label="item.label"
59
- :icon="item.icon"
60
- :value="item.value"
61
- />
62
- </NGi>
63
- </NGrid>
53
+ <!-- Dux Pro 特性展示 -->
54
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-4">
55
+ <DuxCard>
56
+ <div class="text-center p-4">
57
+ <div class="i-tabler:components text-4xl text-purple-600 mb-6 mx-auto" />
58
+ <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
59
+ 远程渲染
60
+ </h3>
61
+ <p class="text-gray-600 dark:text-gray-300 text-sm">
62
+ 支持字符串渲染为 Vue 页面,远程组件动态加载
63
+ </p>
64
+ </div>
65
+ </DuxCard>
64
66
 
65
- <!-- 图表区域 -->
66
- <DuxCard>
67
- <template #header>
68
- <div class="flex items-center justify-between">
69
- <h3 class="text-lg font-semibold">
70
- 数据概览
67
+ <DuxCard>
68
+ <div class="text-center p-4">
69
+ <div class="i-tabler:chart-bar text-4xl text-green-600 mb-6 mx-auto" />
70
+ <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
71
+ 数据可视化
71
72
  </h3>
72
- <NButton size="small" type="primary">
73
- 查看详情
74
- </NButton>
73
+ <p class="text-gray-600 dark:text-gray-300 text-sm">
74
+ 内置图表组件,轻松展示数据分析结果
75
+ </p>
75
76
  </div>
76
- </template>
77
- <DuxChart :option="chartData" style="height: 300px;" />
78
- </DuxCard>
77
+ </DuxCard>
79
78
 
80
- <!-- Dux Pro 特性展示 -->
81
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
82
79
  <DuxCard>
83
80
  <div class="text-center p-4">
84
- <div class="i-tabler:components text-4xl text-purple-600 mb-4" />
81
+ <div class="i-tabler:layout-dashboard text-4xl text-blue-600 mb-6 mx-auto" />
85
82
  <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
86
- 丰富组件
83
+ 动态渲染
87
84
  </h3>
88
85
  <p class="text-gray-600 dark:text-gray-300 text-sm">
89
- 提供丰富的业务组件,快速构建管理后台
86
+ 页面布局支持动态渲染,运行时 UnoCSS 样式生成
90
87
  </p>
91
88
  </div>
92
89
  </DuxCard>
93
90
 
94
91
  <DuxCard>
95
92
  <div class="text-center p-4">
96
- <div class="i-tabler:chart-bar text-4xl text-green-600 mb-4" />
93
+ <div class="i-tabler:forms text-4xl text-orange-600 mb-6 mx-auto" />
97
94
  <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
98
- 数据可视化
95
+ 表单组件
99
96
  </h3>
100
97
  <p class="text-gray-600 dark:text-gray-300 text-sm">
101
- 内置图表组件,轻松展示数据分析结果
98
+ 强大的表单构建器,支持各种表单验证
102
99
  </p>
103
100
  </div>
104
101
  </DuxCard>
105
102
 
106
103
  <DuxCard>
107
104
  <div class="text-center p-4">
108
- <div class="i-tabler:layout-dashboard text-4xl text-blue-600 mb-4" />
105
+ <div class="i-tabler:table text-4xl text-indigo-600 mb-6 mx-auto" />
109
106
  <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
110
- 页面布局
107
+ 数据表格
111
108
  </h3>
112
109
  <p class="text-gray-600 dark:text-gray-300 text-sm">
113
- 灵活的布局组件,适应各种业务场景
110
+ 功能完整的数据表格,支持排序、筛选、分页
114
111
  </p>
115
112
  </div>
116
113
  </DuxCard>
117
- </div>
118
114
 
119
- <!-- 快速操作 -->
120
- <DuxCard>
121
- <template #header>
122
- <h3 class="text-lg font-semibold">
123
- 快速操作
124
- </h3>
125
- </template>
126
- <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
127
- <NButton block type="primary">
128
- <template #icon>
129
- <div class="i-tabler:plus" />
130
- </template>
131
- 创建订单
132
- </NButton>
133
- <NButton block>
134
- <template #icon>
135
- <div class="i-tabler:users" />
136
- </template>
137
- 用户管理
138
- </NButton>
139
- <NButton block>
140
- <template #icon>
141
- <div class="i-tabler:chart-bar" />
142
- </template>
143
- 数据统计
144
- </NButton>
145
- <NButton block>
146
- <template #icon>
147
- <div class="i-tabler:settings" />
148
- </template>
149
- 系统设置
150
- </NButton>
151
- </div>
152
- </DuxCard>
115
+ <DuxCard>
116
+ <div class="text-center p-4">
117
+ <div class="i-tabler:palette text-4xl text-pink-600 mb-6 mx-auto" />
118
+ <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
119
+ 主题定制
120
+ </h3>
121
+ <p class="text-gray-600 dark:text-gray-300 text-sm">
122
+ 灵活的主题配置,支持深色模式和自定义色彩
123
+ </p>
124
+ </div>
125
+ </DuxCard>
126
+
127
+ <DuxCard>
128
+ <div class="text-center p-4">
129
+ <div class="i-tabler:shield-check text-4xl text-red-600 mb-6 mx-auto" />
130
+ <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
131
+ 权限管理
132
+ </h3>
133
+ <p class="text-gray-600 dark:text-gray-300 text-sm">
134
+ 完善的权限控制系统,角色和权限精细化管理
135
+ </p>
136
+ </div>
137
+ </DuxCard>
138
+
139
+ <DuxCard>
140
+ <div class="text-center p-4">
141
+ <div class="i-tabler:rocket text-4xl text-cyan-600 mb-6 mx-auto" />
142
+ <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
143
+ 高性能
144
+ </h3>
145
+ <p class="text-gray-600 dark:text-gray-300 text-sm">
146
+ 基于 Vue 3 构建,享受最新技术带来的性能提升
147
+ </p>
148
+ </div>
149
+ </DuxCard>
150
+
151
+ <DuxCard>
152
+ <div class="text-center p-4">
153
+ <div class="i-tabler:devices text-4xl text-teal-600 mb-6 mx-auto" />
154
+ <h3 class="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
155
+ 响应式设计
156
+ </h3>
157
+ <p class="text-gray-600 dark:text-gray-300 text-sm">
158
+ 完美适配桌面、平板、手机等各种设备
159
+ </p>
160
+ </div>
161
+ </DuxCard>
162
+ </div>
153
163
 
154
164
  <!-- 开始使用 -->
155
- <div class="bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950 dark:to-indigo-950 rounded-lg border p-8 text-center">
165
+ <div class="bg-primary-50 dark:bg-primary-950 rounded-lg border border-primary/50 p-8 text-center">
156
166
  <h3 class="text-xl font-bold text-gray-900 dark:text-gray-100 mb-4">
157
167
  开始构建您的 Pro 应用
158
168
  </h3>
@@ -162,12 +172,15 @@ const chartData = computed(() => ({
162
172
  <div class="flex justify-center space-x-4">
163
173
  <a
164
174
  href="https://github.com/duxweb/dvha" target="_blank"
165
- class="inline-flex items-center px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-sm font-medium"
175
+ class="inline-flex items-center px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 text-sm font-medium"
166
176
  >
167
177
  <div class="i-tabler:brand-github mr-2" />
168
178
  查看源码
169
179
  </a>
170
- <a href="#" class="inline-flex items-center px-4 py-2 border border-gray-300 text-gray-700 dark:text-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 text-sm font-medium">
180
+ <a
181
+ href="https://duxweb.dux.plus/dvha/" target="_blank"
182
+ class="inline-flex items-center px-4 py-2 border border-gray-300 text-gray-700 dark:text-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 text-sm font-medium"
183
+ >
171
184
  <div class="i-tabler:book mr-2" />
172
185
  查看文档
173
186
  </a>
@@ -0,0 +1,32 @@
1
+ import { resolve } from 'node:path'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import VueJsx from '@vitejs/plugin-vue-jsx'
4
+ import { defineConfig } from 'vite'
5
+
6
+ export default defineConfig({
7
+ plugins: [
8
+ vue(),
9
+ VueJsx(),
10
+ ],
11
+ build: {
12
+ rollupOptions: {
13
+ input: {
14
+ index: resolve(__dirname, 'index.html'),
15
+ },
16
+ output: {
17
+ entryFileNames: 'js/[name]-[hash].js',
18
+ chunkFileNames: 'js/[name]-[hash].js',
19
+ manualChunks(id) {
20
+ if (id.includes('node_modules')) {
21
+ return id
22
+ .toString()
23
+ .split('node_modules/')[1]
24
+ .split('/')[0]
25
+ .toString()
26
+ }
27
+ },
28
+ },
29
+ },
30
+ outDir: resolve(__dirname, 'dist'),
31
+ },
32
+ })
@@ -10,5 +10,12 @@
10
10
  "vue": "^3.5.0",
11
11
  "vue-router": "^4.5.1"
12
12
  },
13
- "devDependencies": {}
13
+ "devDependencies": {},
14
+ "excludeDependencies": [
15
+ "@iconify-json/tabler",
16
+ "@unocss/preset-icons",
17
+ "@unocss/eslint-plugin",
18
+ "@unocss/reset",
19
+ "unocss"
20
+ ]
14
21
  }