haiwei-ui 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": "haiwei-ui",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "HaiWei前端组件库",
5
5
  "author": "Eric",
6
6
  "license": "ISC",
@@ -1,13 +1,10 @@
1
- # 设置执行策略(如果需要)
2
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
3
-
4
1
  # 切换到项目根目录
5
2
  Set-Location ..
6
3
 
7
4
  # 使用淘宝镜像安装依赖(加速下载)
8
- Write-Host "正在使用淘宝镜像安装依赖..." -ForegroundColor Green
5
+ Write-Host "Installing dependencies using Taobao mirror..." -ForegroundColor Green
9
6
  npm --registry https://registry.npmmirror.com/ install
10
7
 
11
8
  # 等待用户按键
12
- Write-Host "依赖安装完成,按任意键继续..." -ForegroundColor Green
9
+ Write-Host "Dependencies installation completed. Press any key to continue..." -ForegroundColor Green
13
10
  $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
@@ -1,12 +1,10 @@
1
- # 设置执行策略(如果需要)
2
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
3
-
4
1
  # 切换到项目根目录
5
2
  Set-Location ..
6
3
 
7
4
  # 发布到 npm 官方仓库
5
+ Write-Host "Publishing to npm official registry..." -ForegroundColor Green
8
6
  npm --registry https://registry.npmjs.org/ publish
9
7
 
10
8
  # 等待用户按键
11
- Write-Host "发布完成,按任意键继续..."
9
+ Write-Host "Publishing completed. Press any key to continue..." -ForegroundColor Green
12
10
  $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
@@ -1,13 +1,10 @@
1
- # 设置执行策略(如果需要)
2
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
3
-
4
1
  # 切换到项目根目录
5
2
  Set-Location ..
6
3
 
7
4
  # 使用淘宝镜像更新依赖(加速下载)
8
- Write-Host "正在使用淘宝镜像更新依赖..." -ForegroundColor Green
5
+ Write-Host "Updating dependencies using Taobao mirror..." -ForegroundColor Green
9
6
  npm --registry https://registry.npmmirror.com/ update
10
7
 
11
8
  # 等待用户按键
12
- Write-Host "依赖更新完成,按任意键继续..." -ForegroundColor Green
9
+ Write-Host "Dependencies update completed. Press any key to continue..." -ForegroundColor Green
13
10
  $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
@@ -1,296 +0,0 @@
1
- # HaiWei.UI npm 发布详细操作指引
2
-
3
- ## 准备工作
4
-
5
- ### 1. 检查当前项目状态
6
- ```bash
7
- # 进入项目目录
8
- cd haiwei.ui
9
-
10
- # 检查 package.json 配置
11
- cat package.json | grep -E "(name|version|description)"
12
-
13
- # 预期输出:
14
- # "name": "haiwei-ui",
15
- # "version": "2.0.6",
16
- # "description": "HaiWei前端组件库",
17
- ```
18
-
19
- ### 2. 检查 npm 账户状态
20
- ```bash
21
- # 检查是否已登录
22
- npm whoami
23
-
24
- # 如果显示 "npm ERR! code ENEEDAUTH",表示需要登录
25
- # 如果显示用户名,表示已登录
26
- ```
27
-
28
- ## npm 账户管理
29
-
30
- ### 1. 注册 npm 账户(如果没有账户)
31
- 访问 [npm 官网](https://www.npmjs.com/signup) 注册账户
32
-
33
- ### 2. 登录 npm
34
- ```bash
35
- # 登录 npm
36
- npm login
37
-
38
- # 按提示输入:
39
- # - 用户名 (Username)
40
- # - 密码 (Password)
41
- # - 邮箱 (Email)
42
- # - 一次性密码 (如果有启用双重验证)
43
-
44
- # 验证登录状态
45
- npm whoami
46
- ```
47
-
48
- ### 3. 检查包名可用性
49
- ```bash
50
- # 检查 haiwei-ui 包名是否可用
51
- npm view haiwei-ui
52
-
53
- # 如果返回 404,表示包名可用
54
- # 如果返回包信息,表示包名已被占用
55
- ```
56
-
57
- ## npm 镜像配置
58
-
59
- ### 1. 检查当前镜像
60
- ```bash
61
- # 查看当前 npm 镜像源
62
- npm config get registry
63
-
64
- # 默认应该是:https://registry.npmjs.org/
65
- ```
66
-
67
- ### 2. 设置官方镜像(推荐)
68
- ```bash
69
- # 设置为官方镜像
70
- npm config set registry https://registry.npmjs.org/
71
- ```
72
-
73
- ### 3. 国内镜像配置(可选)
74
- 如果需要使用国内镜像加速:
75
-
76
- ```bash
77
- # 淘宝镜像
78
- npm config set registry https://registry.npmmirror.com/
79
-
80
- # 华为云镜像
81
- npm config set registry https://mirrors.huaweicloud.com/repository/npm/
82
-
83
- # 腾讯云镜像
84
- npm config set registry https://mirrors.cloud.tencent.com/npm/
85
- ```
86
-
87
- **注意**:发布包时必须使用官方镜像!
88
-
89
- ### 4. 临时切换镜像
90
- ```bash
91
- # 临时使用官方镜像发布
92
- npm publish --registry=https://registry.npmjs.org/
93
-
94
- # 临时使用淘宝镜像安装
95
- npm install --registry=https://registry.npmmirror.com/
96
- ```
97
-
98
- ## 发布前测试
99
-
100
- ### 1. 安装依赖
101
- ```bash
102
- # 确保所有依赖已安装
103
- npm install
104
- ```
105
-
106
- ### 2. 构建测试
107
- ```bash
108
- # 执行构建
109
- npm run build
110
-
111
- # 检查 dist 目录是否生成
112
- ls dist/
113
- ```
114
-
115
- ### 3. 本地测试
116
- ```bash
117
- # 启动开发服务器测试
118
- npm run serve
119
-
120
- # 访问 http://localhost:6220 验证功能
121
- ```
122
-
123
- ### 4. 版本管理
124
- ```bash
125
- # 查看当前版本
126
- npm version
127
-
128
- # 更新版本(根据需要选择)
129
- npm version patch # 小版本更新,如 2.0.6 → 2.0.7
130
- npm version minor # 中版本更新,如 2.0.6 → 2.1.0
131
- npm version major # 大版本更新,如 2.0.6 → 3.0.0
132
-
133
- # 或手动修改 package.json 中的 version 字段
134
- ```
135
-
136
- ## 发布流程
137
-
138
- ### 1. 最终验证
139
- ```bash
140
- # 确认所有修改已提交
141
- git status
142
-
143
- # 确认包名和版本
144
- cat package.json | grep -E "(name|version)"
145
-
146
- # 确认镜像源为官方
147
- npm config get registry
148
- ```
149
-
150
- ### 2. 发布到 npm
151
- ```bash
152
- # 方法1:使用项目脚本
153
- npm run pub
154
-
155
- # 方法2:直接发布
156
- npm publish
157
-
158
- # 方法3:指定官方镜像发布(确保使用正确镜像)
159
- npm publish --registry=https://registry.npmjs.org/
160
- ```
161
-
162
- ### 3. 发布成功验证
163
- ```bash
164
- # 查看已发布的包信息
165
- npm view haiwei-ui
166
-
167
- # 查看版本信息
168
- npm view haiwei-ui versions
169
-
170
- # 查看最新版本详情
171
- npm info haiwei-ui
172
- ```
173
-
174
- ## 发布后操作
175
-
176
- ### 1. 安装测试
177
- ```bash
178
- # 在另一个目录测试安装
179
- cd /tmp
180
- mkdir test-haiwei-ui
181
- cd test-haiwei-ui
182
- npm init -y
183
- npm install haiwei-ui
184
-
185
- # 检查是否安装成功
186
- ls node_modules/haiwei-ui/
187
- ```
188
-
189
- ### 2. 标签管理(可选)
190
- ```bash
191
- # 为版本添加标签
192
- npm dist-tag add haiwei-ui@2.0.6 latest
193
-
194
- # 查看标签
195
- npm dist-tag ls haiwei-ui
196
- ```
197
-
198
- ### 3. 撤销发布(如果需要)
199
- ```bash
200
- # 撤销特定版本(24小时内)
201
- npm unpublish haiwei-ui@2.0.6
202
-
203
- # 撤销整个包(72小时内,且没有其他版本)
204
- npm unpublish haiwei-ui --force
205
- ```
206
-
207
- ## 常见问题解决
208
-
209
- ### 1. 权限问题
210
- ```bash
211
- # 检查包权限
212
- npm access ls-packages
213
-
214
- # 添加维护者
215
- npm owner add <username> haiwei-ui
216
-
217
- # 查看维护者列表
218
- npm owner ls haiwei-ui
219
- ```
220
-
221
- ### 2. 发布失败 - 包名冲突
222
- ```bash
223
- # 如果包名已被占用,考虑:
224
- # 1. 使用作用域包名
225
- # 修改 package.json 中的 name 为 @your-username/haiwei-ui
226
-
227
- # 2. 联系包所有者
228
- # 访问 https://www.npmjs.com/package/haiwei-ui 联系维护者
229
- ```
230
-
231
- ### 3. 发布失败 - 镜像问题
232
- ```bash
233
- # 确保使用官方镜像
234
- npm config set registry https://registry.npmjs.org/
235
- npm publish
236
- ```
237
-
238
- ### 4. 发布失败 - 认证问题
239
- ```bash
240
- # 重新登录
241
- npm logout
242
- npm login
243
- npm publish
244
- ```
245
-
246
- ### 5. 构建问题
247
- ```bash
248
- # 清理缓存和重新安装
249
- npm run cm # 清理 node_modules 和 dist
250
- npm i # 重新安装依赖
251
- npm run build # 重新构建
252
- ```
253
-
254
- ## 自动化发布脚本
255
-
256
- 项目已包含发布脚本 `script/npm_publish.ps1`,可以查看和自定义:
257
-
258
- ```powershell
259
- # 查看发布脚本内容
260
- cat script/npm_publish.ps1
261
- ```
262
-
263
- ## 最佳实践
264
-
265
- 1. **版本管理**:遵循语义化版本控制
266
- 2. **文档更新**:确保 README.md 准确反映包功能
267
- 3. **测试充分**:发布前充分测试所有功能
268
- 4. **依赖管理**:定期更新依赖包
269
- 5. **代码质量**:使用 ESLint 和 Prettier 保持代码规范
270
-
271
- ## 后续维护
272
-
273
- ### 1. 更新包
274
- ```bash
275
- # 更新版本号
276
- npm version patch
277
-
278
- # 重新发布
279
- npm publish
280
- ```
281
-
282
- ### 2. 弃用版本
283
- ```bash
284
- # 标记版本为弃用
285
- npm deprecate haiwei-ui@1.0.0 "此版本已弃用,请升级到最新版本"
286
- ```
287
-
288
- ### 3. 包信息更新
289
- ```bash
290
- # 更新包描述等信息后重新发布
291
- npm publish
292
- ```
293
-
294
- ## 总结
295
-
296
- 按照以上步骤,您可以顺利完成 `haiwei-ui` 的 npm 发布。如果在任何步骤遇到问题,请参考对应的问题解决部分。
@@ -1,92 +0,0 @@
1
- # 发布脚本修复说明
2
-
3
- ## 问题描述
4
-
5
- 当执行 `npm run pub` 时,系统会弹出文本编辑器而不是执行发布脚本。
6
-
7
- ## 问题原因
8
-
9
- 在 Windows 系统中,`.ps1` 文件(PowerShell 脚本)的默认关联是使用 PowerShell ISE 或文本编辑器打开,而不是直接执行。当 npm 运行 `npm_publish.ps1` 时,系统会打开该文件进行编辑。
10
-
11
- ## 解决方案
12
-
13
- ### 1. 创建批处理文件
14
- 创建了 `npm_publish.bat` 批处理文件,通过 PowerShell 命令行正确执行脚本:
15
-
16
- ```batch
17
- @echo off
18
- REM 执行 npm 发布脚本
19
- powershell -ExecutionPolicy Bypass -File "%~dp0npm_publish.ps1"
20
- pause
21
- ```
22
-
23
- ### 2. 更新 package.json
24
- 将发布脚本改为使用批处理文件:
25
-
26
- ```json
27
- "pub": "cd ./script && npm_publish.bat"
28
- ```
29
-
30
- ### 3. 改进 PowerShell 脚本
31
- 优化了 `npm_publish.ps1` 脚本:
32
- - 添加执行策略设置
33
- - 使用 PowerShell 标准命令
34
- - 改进用户交互
35
-
36
- ## 使用方法
37
-
38
- 现在可以正常使用发布命令:
39
-
40
- ```bash
41
- npm run pub
42
- ```
43
-
44
- ## 脚本执行流程
45
-
46
- 1. `npm run pub` → 执行 `npm_publish.bat`
47
- 2. `npm_publish.bat` → 调用 PowerShell 执行 `npm_publish.ps1`
48
- 3. `npm_publish.ps1` → 执行实际的 npm 发布命令
49
-
50
- ## 验证修复
51
-
52
- 现在执行 `npm run pub` 应该:
53
- - ✅ 不会弹出文本编辑器
54
- - ✅ 在命令行中显示发布过程
55
- - ✅ 正常执行 npm publish 命令
56
-
57
- ## 修复的脚本列表
58
-
59
- ### 1. 发布脚本 (pub)
60
- - **PowerShell 脚本**: `npm_publish.ps1`
61
- - **批处理文件**: `npm_publish.bat`
62
- - **package.json 引用**: `"pub": "cd ./script && npm_publish.bat"`
63
- - **镜像配置**: 使用官方镜像 `https://registry.npmjs.org/`
64
-
65
- ### 2. 安装脚本 (i)
66
- - **PowerShell 脚本**: `npm_install.ps1`
67
- - **批处理文件**: `npm_install.bat`
68
- - **package.json 引用**: `"i": "cd ./script && npm_install.bat"`
69
- - **镜像配置**: 使用淘宝镜像 `https://registry.npmmirror.com/` (加速下载)
70
-
71
- ### 3. 更新脚本 (up)
72
- - **PowerShell 脚本**: `npm_update.ps1`
73
- - **批处理文件**: `npm_update.bat`
74
- - **package.json 引用**: `"up": "cd ./script && npm_update.bat"`
75
- - **镜像配置**: 使用淘宝镜像 `https://registry.npmmirror.com/` (加速下载)
76
-
77
- ## 使用方法
78
-
79
- 现在可以正常使用所有脚本命令:
80
-
81
- ```bash
82
- npm run i # 安装依赖
83
- npm run up # 更新依赖
84
- npm run pub # 发布包
85
- ```
86
-
87
- ## 脚本执行流程
88
-
89
- 所有脚本都遵循相同的执行流程:
90
- 1. `npm run [command]` → 执行对应的 `.bat` 文件
91
- 2. `.bat` 文件 → 调用 PowerShell 执行对应的 `.ps1` 文件
92
- 3. `.ps1` 文件 → 执行实际的 npm 命令
@@ -1,74 +0,0 @@
1
- # HaiWei.UI 项目改名完成总结
2
-
3
- ## 已完成修改的文件
4
-
5
- ### 1. package.json
6
- - **包名**: `netmodular-ui` → `haiwei-ui`
7
- - **描述**: `NetModular前端组件库` → `HaiWei前端组件库`
8
- - **组件前缀**: 保持 `Nm` 不变
9
-
10
- ### 2. README.md
11
- - **标题**: `# NetModular.UI` → `# HaiWei.UI`
12
- - **描述**: 更新为 HaiWei 相关描述
13
-
14
- ### 3. vue.config.js
15
- - **转译依赖**: `'netmodular.*'` → `'haiwei-ui.*'`
16
-
17
- ## 保持不变的配置
18
-
19
- ### 组件前缀
20
- - 保持 `Nm` 前缀不变,确保现有组件兼容性
21
- - 在 `packages/library.js` 中:`prefix: 'Nm'`
22
-
23
- ### 其他配置
24
- - 版本号:2.0.6
25
- - 作者:Oldli
26
- - 许可证:ISC
27
- - 主要依赖:Vue2、ElementUI 等保持不变
28
-
29
- ## 验证结果
30
-
31
- ✅ **package.json**: 包名已成功改为 `haiwei-ui`
32
- ✅ **README.md**: 标题已改为 `HaiWei.UI`
33
- ✅ **vue.config.js**: 转译依赖已更新为 `'haiwei-ui.*'`
34
- ✅ **组件前缀**: 保持 `Nm` 不变,确保兼容性
35
-
36
- ## 下一步操作建议
37
-
38
- ### 1. 测试构建
39
- ```bash
40
- npm run build
41
- ```
42
-
43
- ### 2. 本地测试
44
- ```bash
45
- npm run serve
46
- ```
47
-
48
- ### 3. 发布到 npm
49
- ```bash
50
- npm run pub
51
- # 或
52
- npm publish
53
- ```
54
-
55
- ### 4. 创建 GitHub 仓库(可选)
56
- - 创建新的 `haiwei-ui` 仓库
57
- - 更新 package.json 中的 repository URL
58
-
59
- ## 注意事项
60
-
61
- 1. **组件前缀保持 `Nm`**:确保现有项目中的组件引用不会中断
62
- 2. **依赖兼容性**:所有依赖包版本保持不变
63
- 3. **构建验证**:在发布前确保构建和功能正常
64
- 4. **文档更新**:后续需要更新相关文档链接
65
-
66
- ## 发布准备
67
-
68
- 项目已准备好发布到 npm,其他开发者可以通过以下方式安装:
69
-
70
- ```bash
71
- npm install haiwei-ui
72
- ```
73
-
74
- 项目改名工作已完成,可以继续进行测试和发布流程。