cmpt-huitu-cli 1.0.0 → 1.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmpt-huitu-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "慧图前端项目工程化 CLI 工具",
6
6
  "main": "index.js",
package/src/create.js CHANGED
@@ -91,6 +91,7 @@ export async function create(projectName, targetDir) {
91
91
  // 将 workspace 协议改为具体版本号(从 npm 安装)
92
92
  // 使用语义化版本范围(如 ^1.0.0),允许小版本和补丁版本更新
93
93
  if (pkg.dependencies) {
94
+ // 处理旧包名(向后兼容)
94
95
  if (pkg.dependencies['@huitu/ui'] === 'workspace:*') {
95
96
  pkg.dependencies['cmpt-huitu-ui'] = getDependencyVersion('cmpt-huitu-ui')
96
97
  delete pkg.dependencies['@huitu/ui']
@@ -99,6 +100,13 @@ export async function create(projectName, targetDir) {
99
100
  pkg.dependencies['cmpt-huitu-utils'] = getDependencyVersion('cmpt-huitu-utils')
100
101
  delete pkg.dependencies['@huitu/utils']
101
102
  }
103
+ // 处理新包名
104
+ if (pkg.dependencies['cmpt-huitu-ui'] === 'workspace:*') {
105
+ pkg.dependencies['cmpt-huitu-ui'] = getDependencyVersion('cmpt-huitu-ui')
106
+ }
107
+ if (pkg.dependencies['cmpt-huitu-utils'] === 'workspace:*') {
108
+ pkg.dependencies['cmpt-huitu-utils'] = getDependencyVersion('cmpt-huitu-utils')
109
+ }
102
110
  }
103
111
 
104
112
  await fs.writeJson(pkgPath, pkg, { spaces: 2 })
@@ -123,5 +131,5 @@ export async function create(projectName, targetDir) {
123
131
  console.log('')
124
132
  console.log(chalk.yellow('💡 提示:'))
125
133
  console.log(chalk.yellow(' - 如果使用私有 npm 仓库,请先配置正确的 registry'))
126
- console.log(chalk.yellow(' - 运行 npm install 时会自动安装 @huitu/ui 和 @huitu/utils\n'))
134
+ console.log(chalk.yellow(' - 运行 npm install 时会自动安装 cmpt-huitu-ui 和 cmpt-huitu-utils\n'))
127
135
  }
@@ -11,8 +11,8 @@
11
11
  - ✅ **Element Plus**:企业级 UI 组件库
12
12
  - ✅ **Pinia**:Vue 3 官方状态管理
13
13
  - ✅ **Vue Router**:官方路由管理器
14
- - ✅ **@huitu/ui**:共享 UI 组件库
15
- - ✅ **@huitu/utils**:共享工具函数库
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
- ### 使用 @huitu/ui 组件
84
+ ### 使用 cmpt-huitu-ui 组件
85
85
 
86
86
  ```javascript
87
- import { HTable, ModuleTitle } from '@huitu/ui'
87
+ import { HTable, ModuleTitle } from 'cmpt-huitu-ui'
88
88
  ```
89
89
 
90
- ### 使用 @huitu/utils 工具
90
+ ### 使用 cmpt-huitu-utils 工具
91
91
 
92
92
  ```javascript
93
- import { parseTime, cache, modal } from '@huitu/utils'
93
+ import { parseTime, cache, modal } from 'cmpt-huitu-utils'
94
94
  ```
95
95
 
96
96
  ## 🔧 开发命令
@@ -4,20 +4,20 @@
4
4
  * @Date: 2026-01-04
5
5
  * @Description:
6
6
  * 1. 公共样式已通过 vite.config.js 的 additionalData 全局引入:
7
- * - @huitu/ui/src/styles/variables.scss (公共变量)
8
- * - @huitu/ui/src/styles/mixin.scss (公共 mixin)
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
- * - @huitu/ui/src/styles/reset.scss (Element Plus 样式重置)
11
+ * - cmpt-huitu-ui/src/styles/reset.scss (Element Plus 样式重置)
12
12
  * 3. 项目自定义样式请放在 theme/ 目录下,并在此处引入
13
13
  */
14
14
 
15
15
  // 引入 CSS 变量定义(主题配置)
16
- @import "./theme/variables.scss";
16
+ @use "./theme/variables.scss" as *;
17
17
 
18
18
  // 引入 Element Plus 重置样式(依赖上面的变量)
19
- // @import '@huitu/ui/src/styles/reset.scss';
19
+ // @use 'cmpt-huitu-ui/src/styles/reset.scss';
20
20
 
21
21
  // 项目自定义样式
22
22
  // 如需添加其他自定义样式,请在 theme/ 目录下创建文件并在此处引入
23
- // @import './theme/custom.scss';
23
+ // @use './theme/custom.scss' as *;
@@ -11,12 +11,13 @@
11
11
 
12
12
  2. 在 `src/styles/index.scss` 中引入你的样式文件:
13
13
  ```scss
14
- @import './theme/custom.scss';
14
+ @use './theme/custom.scss' as *;
15
15
  ```
16
16
 
17
17
  ## 公共样式
18
18
 
19
- 公共样式变量和 mixin 已通过 `@huitu/ui` 提供,在 `vite.config.js` 中已全局配置:
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="light"] {
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="dark"] {
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
-
@@ -2,7 +2,7 @@
2
2
  * @FileDescription: 系统登录信息工具类
3
3
  */
4
4
 
5
- import { cache } from '@huitu/utils'
5
+ import { cache } from 'cmpt-huitu-utils'
6
6
  const { session } = cache
7
7
  // Token 管理(使用通用前缀)
8
8
  export function getToken() {
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import axios from 'axios'
9
9
  import { getToken, clearAuth } from '@utils/auth'
10
- import { tansParamsString } from '@huitu/utils'
10
+ import { tansParamsString } from 'cmpt-huitu-utils'
11
11
  import errorCode from '@utils/errorCode'
12
12
 
13
13
  // 全局默认基础配置
@@ -3,7 +3,7 @@
3
3
  */
4
4
 
5
5
  // 设置主题
6
- import { cache } from '@huitu/utils'
6
+ import { cache } from 'cmpt-huitu-utils'
7
7
  const { local } = cache
8
8
  export const setTheme = (theme) => {
9
9
  local.set('data-theme', theme)
@@ -17,8 +17,8 @@
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">@huitu/ui</el-tag></li>
21
- <li><el-tag type="info">@huitu/utils</el-tag></li>
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
24
  <div class="demo-section">
@@ -38,7 +38,7 @@
38
38
 
39
39
  <div class="demo-section">
40
40
  <h3>Utils 工具演示</h3>
41
- <p>当前时间 (formatted by @huitu/utils): {{ currentTime }}</p>
41
+ <p>当前时间 (formatted by cmpt-huitu-utils): {{ currentTime }}</p>
42
42
  </div>
43
43
  </div>
44
44
  </div>
@@ -46,7 +46,7 @@
46
46
 
47
47
  <script setup>
48
48
  import { ref, onMounted } from 'vue'
49
- import { parseTime } from '@huitu/utils'
49
+ import { parseTime } from 'cmpt-huitu-utils'
50
50
 
51
51
  const currentTime = ref('')
52
52
  const columns = [
@@ -106,8 +106,8 @@ export default defineConfig(({ mode, command }) => {
106
106
  preprocessorOptions: {
107
107
  scss: {
108
108
  additionalData: `
109
- @use "${resolve(__dirname, '../../packages/ui/src/styles/variables.scss')}" as *;
110
- @use "${resolve(__dirname, '../../packages/ui/src/styles/mixin.scss')}" as *;
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
  },
@@ -166,7 +166,7 @@ export default defineConfig(({ mode, command }) => {
166
166
  // 优化依赖预构建(当你首次启动 vite 时,Vite 在本地加载你的站点之前预构建了项目依赖。)
167
167
  optimizeDeps: {
168
168
  include: ['vue', 'vue-router', 'pinia', 'axios', 'element-plus', 'dayjs'], // 默认情况下,不在 node_modules 中的,链接的包不会被预构建
169
- exclude: ['@huitu'], // 在预构建中强制排除的依赖项
169
+ exclude: ['cmpt-huitu-ui', 'cmpt-huitu-utils'], // 在预构建中强制排除的依赖项
170
170
  force: false, // 强制进行依赖预构建
171
171
  },
172
172