@mznjs/mbump 2.2.0 → 2.3.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,157 @@
5
5
  格式遵循 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  本项目遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
7
7
 
8
+ ## [2.3.0] - 2026-07-05
9
+
10
+ 🚀 新增功能
11
+
12
+ - eec77e324b8d7c959f34d3a5f946e12b18092a1e feat: Rust 项目支持 cargo publish 发布命令 (VersionManager.ts)
13
+
14
+ 🩹 缺陷修复
15
+
16
+ - a3e4b4dee6f6c17c6eb12c54f43a8e9332998dd8 fix: 修复类型定义中遗漏的 npm 字段改为 publish (index.ts, test-rust-flow.ts)
17
+
18
+ ♻️ 代码重构
19
+
20
+ - b7838b079379e5445a3faf9b5ca62fe36c05bd3f refactor: 将 --npm 参数改为 --publish,Rust 模式写死 cargo publish (index.ts, parser.ts, schema.ts, VersionManager.ts, index.ts)
21
+
22
+ 📝 文档更新
23
+
24
+ - 88891287bebaa43da704acf148f707f26d57969f docs: 优化README.md的表格排版与文档结构 (README.md)
25
+ - c3284f4dc3e3b542826069e308bcd5232a652140 docs: 重新编写 README.md 文档 (README.md)
26
+
27
+ 🔧 工具变更
28
+
29
+ - bb0a16a742c64da82ca230f56c99b85ed9ab3385 chore(core): 移除未使用的isDefaultPackage参数 (VersionProvider.ts)
30
+ - 5d7eb1677d6975bc05c3b3681a449de098f5833b chore: 清理调试日志和多余代码 (VersionManager.ts)
31
+
32
+ ## [2.2.12] - 2026-07-05
33
+
34
+ ### 待补充
35
+
36
+ ## [web@0.0.21] - 2026-07-05
37
+
38
+ ### 待补充
39
+
40
+ ## [2.2.11] - 2026-07-05
41
+
42
+ 🩹 缺陷修复
43
+
44
+ - 6e09e184542111e37ab223ba63f11e1fd9aee207 fix: 修复批量更新时 tag 格式错误 (VersionManager.ts, test-full-flow.mjs, test-tag-format-simple.mjs, test-tag-format.js, test-tag-format.mjs, test-tag-issue.mjs)
45
+ - 8fb56158b4544d1c8b99768433b8d215fc8fe25c fix: 修复 getDefaultTagFormat 调用参数 (VersionManager.ts)
46
+ - 504c46d8731fe1c30cec68c2178c9224291cd96c fix: 使用 resolve 统一路径比较 (VersionManager.ts)
47
+
48
+ 🔧 工具变更
49
+
50
+ - 5e10c03bb886567421b99860054710a9ad0cb40e chore(test): 删除全部旧的测试文件 (test-full-flow.mjs, test-tag-format-simple.mjs, test-tag-format.js, test-tag-format.mjs, test-tag-issue.mjs)
51
+
52
+ ## [2.2.10] - 2026-07-05
53
+
54
+ ### 待补充
55
+
56
+ ## [2.2.9] - 2026-07-05
57
+
58
+ ### 待补充
59
+
60
+ ## [web@0.0.18] - 2026-07-05
61
+
62
+ 🩹 缺陷修复
63
+
64
+ - 448d6274e7a51e2f92be7343f803442778e46da9 fix(VersionManager): 修复根路径package.json识别逻辑 (VersionManager.ts)
65
+
66
+ ## [2.2.8] - 2026-07-05
67
+
68
+ ### 待补充
69
+
70
+ ## [web@0.0.16] - 2026-07-05
71
+
72
+ ### 待补充
73
+
74
+ ## [2.2.7] - 2026-07-05
75
+
76
+ ### 待补充
77
+
78
+ ## [2.2.6] - 2026-07-05
79
+
80
+ ### 待补充
81
+
82
+ ## [web@0.0.13] - 2026-07-05
83
+
84
+ 🩹 缺陷修复
85
+
86
+ - 01ad1feedee16743953f2a2f0d7eb8cd464716d3 fix(VersionManager): 修正node根包文件的匹配逻辑 (VersionManager.ts)
87
+
88
+ ## [0.0.12] - 2026-07-05
89
+
90
+ ♻️ 代码重构
91
+
92
+ - 3f5c96ffc215ed1dd8c28e36c7588d8d185d2905 refactor(VersionManager): 简化默认标签格式的判断逻辑 (VersionManager.ts, VersionProvider.ts)
93
+
94
+ ## [0.0.11] - 2026-07-05
95
+
96
+ ### 待补充
97
+
98
+ ## [0.0.10] - 2026-07-05
99
+
100
+ 🔧 工具变更
101
+
102
+ - abbdf45020ec070ee1480ce302a2ffb1c604bc81 chore(rust-test): 将版本从0.0.14-beta.1更改为0.0.14并更新changelog (VersionProvider.ts)
103
+
104
+ ## [2.2.5] - 2026-07-05
105
+
106
+ ### 待补充
107
+
108
+ ## [0.0.9] - 2026-07-05
109
+
110
+ ### 待补充
111
+
112
+ ## [web@0.0.6] - 2026-07-05
113
+
114
+ ♻️ 代码重构
115
+
116
+ - e1140ccab10e36e0fda8cb4aae25be323228a351 refactor: 移除独立RustManager,整合到VersionManager中 (README.md, GitManager.ts, RustManager.ts, index.ts, test-rust-flow.ts, rust.test.ts)
117
+
118
+ 🔧 工具变更
119
+
120
+ - fea8c7aca22dffe06559bba5f8653541fcb2cdbd chore(rust-test): 升级版本到0.0.14-beta.1并优化git远程仓库获取逻辑 (CHANGELOG.md, Cargo.toml, GitManager.ts)
121
+ - f4ae76f56ff48ce7795c427cfde55b26912feb54 chore(rust-test): 发布版本0.0.14-beta.0 (CHANGELOG.md, Cargo.toml)
122
+
123
+ ## [2.2.4] - 2026-07-05
124
+
125
+ ### 待补充
126
+
127
+ ## [web@0.0.4] - 2026-07-05
128
+
129
+ ### 待补充
130
+
131
+ ## [2.2.3] - 2026-07-05
132
+
133
+ 🚀 新增功能
134
+
135
+ - 0feaf6a62d3c5e8667a376de0955bf3ee0172eda feat: 新增多语言版本管理,重构cli与核心逻辑 (CHANGELOG.md, Cargo.toml, index.ts, VersionManager.ts, VersionProvider.ts, index.ts, test-changelog.ts, test-git.ts, test-git2.ts, test-rust-flow.ts)
136
+
137
+ 🔧 工具变更
138
+
139
+ - 223c0f8002ab37081de27034c0742e19cfe5e493 chore(rust-test): 发布版本 0.0.13 (CHANGELOG.md, Cargo.toml)
140
+ - a2fecae3a4258f5fc477fe84a217f580ca5fb2c0 chore(rust-test, src): 发布v0.0.12并更新版本相关逻辑 (CHANGELOG.md, Cargo.toml, VersionManager.ts, VersionProvider.ts)
141
+ - c8451bb9cebf34ffae76061828e8373193496ed1 chore: update mbump config and settings (Cargo.toml)
142
+
143
+ ## [2.2.2] - 2026-07-05
144
+
145
+ ### 待补充
146
+
147
+ ## [2.2.1] - 2026-07-05
148
+
149
+ 🔧 工具变更
150
+
151
+ - eb0a7a12f75a7bea8c80fe141be832c92a6d294c chore: 更新项目依赖包版本 (package.json, pnpm-lock.yaml)
152
+
153
+ ## [2.2.1-beta.0] - 2026-07-05
154
+
155
+ ♻️ 代码重构
156
+
157
+ - 0fa4bd4b466607a6f656a3a95c53152963188a22 refactor(path,cli,rust): 优化导入方式和代码格式 (interactive.ts, RustManager.ts, path.ts)
158
+
8
159
  ## [2.2.0] - 2026-07-04
9
160
 
10
161
  ### 待补充
package/README.md CHANGED
@@ -10,7 +10,8 @@
10
10
  - **Git 集成**:自动提交、打 Tag、推送到远程仓库
11
11
  - **CHANGELOG 生成**:根据 Git 提交自动生成更新日志
12
12
  - **路径模式**:直接指定项目目录,无需配置文件
13
- - **Rust 支持**:更新 Cargo.toml 中的版本号
13
+ - **Rust 支持**:更新 Cargo.toml 中的版本号,支持 `cargo publish`
14
+ - **包发布**:支持 Node.js(pnpm/npm)和 Rust(cargo)包发布
14
15
  - **安全检查**:检测未提交更改,防止版本状态不一致
15
16
  - **Dry-run 模式**:预览将要执行的操作,避免误操作
16
17
  - **多格式配置**:支持 TS/JS/JSON/YAML/TOML 等多种配置格式
@@ -91,6 +92,9 @@ mbump all
91
92
 
92
93
  # 试运行模式
93
94
  mbump all minor --dry-run
95
+
96
+ # 更新并发布所有包
97
+ mbump all patch --publish
94
98
  ```
95
99
 
96
100
  ## 📖 使用方法
@@ -107,15 +111,15 @@ mbump <path> <type>
107
111
 
108
112
  ### 2. 版本类型
109
113
 
110
- | 类型 | 说明 | 示例 |
111
- |------|------|------|
112
- | `major` | 主版本号递增 | 1.0.0 → 2.0.0 |
113
- | `minor` | 次版本号递增 | 1.0.0 → 1.1.0 |
114
- | `patch` | 修订号递增 | 1.0.0 → 1.0.1 |
115
- | `pre-major` | 预发布主版本 | 1.0.0 → 2.0.0-beta.0 |
116
- | `pre-minor` | 预发布次版本 | 1.0.0 → 1.1.0-beta.0 |
117
- | `pre-patch` | 预发布修订版 | 1.0.0 → 1.0.1-beta.0 |
118
- | `as-is` | 使用自定义版本 | 指定 customVersion |
114
+ | 类型 | 说明 | 示例 |
115
+ | ----------- | ------- | -------------------- |
116
+ | `major` | 主版本号递增 | 1.0.0 → 2.0.0 |
117
+ | `minor` | 次版本号递增 | 1.0.0 → 1.1.0 |
118
+ | `patch` | 修订号递增 | 1.0.0 → 1.0.1 |
119
+ | `pre-major` | 预发布主版本 | 1.0.0 → 2.0.0-beta.0 |
120
+ | `pre-minor` | 预发布次版本 | 1.0.0 → 1.1.0-beta.0 |
121
+ | `pre-patch` | 预发布修订版 | 1.0.0 → 1.0.1-beta.0 |
122
+ | `as-is` | 使用自定义版本 | 指定 customVersion |
119
123
 
120
124
  ### 3. 常用命令示例
121
125
 
@@ -138,8 +142,8 @@ mbump pre-minor
138
142
  # 试运行模式(预览操作)
139
143
  mbump components patch --dry-run
140
144
 
141
- # 更新版本并发布到 NPM
142
- mbump components patch --npm
145
+ # 更新版本并发布
146
+ mbump components patch --publish
143
147
 
144
148
  # 更新版本但不推送到远程
145
149
  mbump components patch --no-push
@@ -170,14 +174,14 @@ mbump .
170
174
 
171
175
  支持的路径格式:
172
176
 
173
- | 格式 | 示例 |
174
- |------|------|
175
- | 相对路径 | `./packages/my-pkg` |
176
- | 上级目录 | `../other-project` |
177
- | 绝对路径 | `/usr/local/project` |
178
- | Windows 路径 | `C:\Projects\app` |
179
- | 用户主目录 | `~/projects/my-app` |
180
- | UNC 路径 | `\\server\share\project` |
177
+ | 格式 | 示例 |
178
+ | ---------- | ------------------------ |
179
+ | 相对路径 | `./packages/my-pkg` |
180
+ | 上级目录 | `../other-project` |
181
+ | 绝对路径 | `/usr/local/project` |
182
+ | Windows 路径 | `C:\Projects\app` |
183
+ | 用户主目录 | `~/projects/my-app` |
184
+ | UNC 路径 | `\\server\share\project` |
181
185
 
182
186
  ### 5. Rust 项目模式
183
187
 
@@ -188,10 +192,19 @@ mbump --rust patch
188
192
  # 更新指定目录的 Rust 项目
189
193
  mbump ./backend -r minor
190
194
 
195
+ # 更新并发布到 crates.io
196
+ mbump -r patch --publish
197
+
191
198
  # 试运行模式
192
199
  mbump -r major --dry-run
193
200
  ```
194
201
 
202
+ Rust 项目特点:
203
+
204
+ - 自动检测 `Cargo.toml` 文件
205
+ - 使用 `cargo publish` 发布(写死,不可配置)
206
+ - Tag 格式为 `{package-name}@{version}`
207
+
195
208
  ## ⚙️ 配置文件
196
209
 
197
210
  ### 配置文件格式
@@ -205,22 +218,19 @@ mbump -r major --dry-run
205
218
  import type { Config } from '@mznjs/mbump'
206
219
 
207
220
  export default {
208
- // 包路径配置
209
221
  packagePaths: {
210
222
  default: 'package.json',
211
223
  components: 'packages/components/package.json',
212
224
  },
213
225
 
214
- // 默认选项
215
226
  defaults: {
216
227
  releaseType: 'patch',
217
228
  dryRun: false,
218
229
  verbose: false,
219
230
  allowUncommitted: false,
220
- npm: false,
231
+ publish: false,
221
232
  },
222
233
 
223
- // Git 选项
224
234
  git: {
225
235
  commitMessage: 'chore: bump version to {{newVersion}}',
226
236
  push: true,
@@ -230,7 +240,6 @@ export default {
230
240
  changelog: true,
231
241
  },
232
242
 
233
- // 发布选项
234
243
  publish: {
235
244
  command: 'pnpm publish --access public --no-git-checks',
236
245
  skipChecks: true,
@@ -249,31 +258,33 @@ export default {
249
258
 
250
259
  #### defaults
251
260
 
252
- | 选项 | 类型 | 默认值 | 说明 |
253
- |------|------|--------|------|
254
- | `releaseType` | `string` | `'patch'` | 默认版本类型 |
255
- | `dryRun` | `boolean` | `false` | 默认试运行模式 |
256
- | `verbose` | `boolean` | `false` | 默认详细输出 |
257
- | `allowUncommitted` | `boolean` | `false` | 允许未提交更改 |
258
- | `npm` | `boolean` | `false` | 默认启用发布 |
261
+ | 选项 | 类型 | 默认值 | 说明 |
262
+ | ------------------ | --------- | --------- | ------- |
263
+ | `releaseType` | `string` | `'patch'` | 默认版本类型 |
264
+ | `dryRun` | `boolean` | `false` | 默认试运行模式 |
265
+ | `verbose` | `boolean` | `false` | 默认详细输出 |
266
+ | `allowUncommitted` | `boolean` | `false` | 允许未提交更改 |
267
+ | `publish` | `boolean` | `false` | 默认启用发布 |
259
268
 
260
269
  #### git
261
270
 
262
- | 选项 | 类型 | 默认值 | 说明 |
263
- |------|------|--------|------|
264
- | `commitMessage` | `string` | `'chore: bump version...'` | 提交消息模板 |
265
- | `push` | `boolean` | `true` | 是否自动推送 |
266
- | `autoCommit` | `boolean` | `true` | 是否自动提交 |
267
- | `tag` | `boolean` | `true` | 是否创建 Tag |
268
- | `tagPrefix` | `string` | `'v'` | Tag 前缀(仅主项目) |
269
- | `changelog` | `boolean` | `true` | 是否生成 CHANGELOG |
271
+ | 选项 | 类型 | 默认值 | 说明 |
272
+ | --------------- | --------- | -------------------------- | -------------- |
273
+ | `commitMessage` | `string` | `'chore: bump version...'` | 提交消息模板 |
274
+ | `push` | `boolean` | `true` | 是否自动推送 |
275
+ | `autoCommit` | `boolean` | `true` | 是否自动提交 |
276
+ | `tag` | `boolean` | `true` | 是否创建 Tag |
277
+ | `tagPrefix` | `string` | `'v'` | Tag 前缀(仅主项目) |
278
+ | `changelog` | `boolean` | `true` | 是否生成 CHANGELOG |
270
279
 
271
280
  #### publish
272
281
 
273
- | 选项 | 类型 | 默认值 | 说明 |
274
- |------|------|--------|------|
275
- | `command` | `string` | `'pnpm publish...'` | 发布命令 |
276
- | `skipChecks` | `boolean` | `true` | 跳过安全检查 |
282
+ | 选项 | 类型 | 默认值 | 说明 |
283
+ | ------------ | --------- | ------------------- | ------------------ |
284
+ | `command` | `string` | `'pnpm publish...'` | 发布命令(仅 Node.js 项目) |
285
+ | `skipChecks` | `boolean` | `true` | 跳过安全检查 |
286
+
287
+ **注意**:Rust 项目的发布命令固定为 `cargo publish`,不受此配置影响。
277
288
 
278
289
  ## 📝 命令行选项
279
290
 
@@ -291,96 +302,20 @@ export default {
291
302
  --no-commit, -n 禁用自动 Git 提交
292
303
  --no-push, -p 禁用自动推送到远程仓库
293
304
  --allow-uncommitted, -u 允许在有未提交更改的情况下继续操作
294
- --npm, -N 启用 NPM/PNPM 包发布功能
305
+ --publish, -P 启用包发布功能(Node.js 使用 pnpm,Rust 使用 cargo)
295
306
  --show-config, -c 显示当前加载的完整配置信息
296
307
  --rust, -r 启用 Rust 项目模式
297
308
  --version, -V 显示当前版本号
298
309
  --help, -h 显示帮助信息
299
310
  ```
300
311
 
301
- ## 🔌 API 使用
302
-
303
- ### 核心类
304
-
305
- ```typescript
306
- import { VersionManager, RustManager, GitManager, ChangelogManager } from '@mznjs/mbump'
307
- ```
308
-
309
- ### VersionManager
310
-
311
- ```typescript
312
- import { VersionManager, loadConfigAsync } from '@mznjs/mbump'
313
-
314
- const config = await loadConfigAsync(process.cwd())
315
- const manager = new VersionManager({ config, rootDir: process.cwd() })
316
-
317
- // 更新版本
318
- const result = await manager.updateVersion('my-package', 'minor', {
319
- dryRun: false,
320
- verbose: true,
321
- autoCommit: true,
322
- push: true,
323
- })
324
-
325
- // 预览更新
326
- const preview = await manager.previewUpdate('my-package', 'patch')
327
-
328
- // 获取包版本
329
- const version = manager.getPackageVersion('my-package')
330
- ```
331
-
332
- ### RustManager
333
-
334
- ```typescript
335
- import { RustManager } from '@mznjs/mbump'
336
-
337
- const rustManager = new RustManager('/path/to/rust-project')
338
-
339
- // 更新版本
340
- const result = rustManager.updateVersion('patch', {
341
- dryRun: false,
342
- })
343
- ```
344
-
345
- ### GitManager
346
-
347
- ```typescript
348
- import { GitManager } from '@mznjs/mbump'
349
-
350
- const gitManager = new GitManager('/path/to/project')
351
-
352
- // 检查未提交更改
353
- const hasChanges = gitManager.hasUncommittedChanges()
354
-
355
- // 创建 Tag
356
- await gitManager.createTag('1.0.0', 'v')
357
-
358
- // 提交并推送
359
- await gitManager.commitAndPush('chore: bump version', true, true, '1.0.0', 'v')
360
- ```
361
-
362
- ### 工具函数
363
-
364
- ```typescript
365
- import { pathUtils, semverUtils, securityUtils } from '@mznjs/mbump'
366
-
367
- // 路径工具
368
- pathUtils.isPathLike('./packages/my-pkg') // true
369
-
370
- // Semver 工具
371
- semverUtils.incrementVersion('1.0.0', 'patch') // '1.0.1'
372
-
373
- // 安全工具
374
- securityUtils.validatePath('/project/src', '/project') // true
375
- ```
376
-
377
312
  ## 🏷️ Git Tag 策略
378
313
 
379
314
  ### 主项目包
380
315
 
381
316
  - **格式**: `{tagPrefix}{version}`
382
317
  - **示例**: `v1.0.1`, `release-2.0.0`
383
- - **识别条件**: 包名为 `default` 或包路径为 `package.json`
318
+ - **识别条件**: 包名为 `default` 或包路径为根目录的 `package.json`
384
319
 
385
320
  ### 子包
386
321
 
@@ -388,6 +323,12 @@ securityUtils.validatePath('/project/src', '/project') // true
388
323
  - **示例**: `@my-org/components@1.0.1`, `cli@2.3.0`
389
324
  - **识别条件**: 所有非主项目包
390
325
 
326
+ ### Rust 项目
327
+
328
+ - **格式**: `{package-name}@{version}`
329
+ - **示例**: `my-crate@0.1.0`
330
+ - **说明**: Rust 项目始终使用子包格式,不使用 tagPrefix
331
+
391
332
  ### 批量更新
392
333
 
393
334
  使用 `mbump all` 时,会为每个包创建独立的 Tag:
@@ -398,6 +339,20 @@ v1.0.1 # 主项目包
398
339
  @my-org/cli@2.3.0 # 子包
399
340
  ```
400
341
 
342
+ ## 🚀 包发布机制
343
+
344
+ ### Node.js 项目
345
+
346
+ - 默认命令: `pnpm publish --access public --no-git-checks`
347
+ - 可通过配置文件自定义发布命令
348
+ - 使用 `--publish` 或 `-P` 启用
349
+
350
+ ### Rust 项目
351
+
352
+ - 默认命令: `cargo publish`(固定写死,不可配置)
353
+ - 使用 `--publish` 或 `-P` 启用
354
+ - 发布前确保已登录 crates.io(`cargo login`)
355
+
401
356
  ## 📋 Dry-run 模式
402
357
 
403
358
  Dry-run 模式允许预览将要执行的操作,不实际修改任何文件:
@@ -416,9 +371,10 @@ mbump components patch --dry-run
416
371
  新版本: 1.0.1
417
372
  Tag: @my-org/components@1.0.1
418
373
  CHANGELOG: 是
374
+
419
375
  Git Commit: 是
420
376
  Git Push: 是
421
- NPM Publish: 否
377
+ Publish: 否
422
378
 
423
379
  ✅ 以上为预览,未执行任何实际操作
424
380
  ```
@@ -460,13 +416,107 @@ mbump components patch --verbose
460
416
 
461
417
  ### 常见错误处理
462
418
 
463
- | 错误 | 解决方案 |
464
- |------|---------|
465
- | 版本已存在 | 删除已有 Tag: `git tag -d v1.0.1` |
466
- | Git 冲突 | 解决冲突后重新运行 |
467
- | NPM 认证失败 | 运行 `pnpm login` 登录 |
468
- | 包名不存在 | 检查配置文件中的 `packagePaths` |
469
- | 路径不存在 | 确认路径正确,目录存在 |
419
+ | 错误 | 解决方案 |
420
+ | ---------- | ----------------------------- |
421
+ | 版本已存在 | 删除已有 Tag: `git tag -d v1.0.1` |
422
+ | Git 冲突 | 解决冲突后重新运行 |
423
+ | NPM 认证失败 | 运行 `pnpm login` 登录 |
424
+ | Cargo 认证失败 | 运行 `cargo login` 登录 |
425
+ | 包名不存在 | 检查配置文件中的 `packagePaths` |
426
+ | 路径不存在 | 确认路径正确,目录存在 |
427
+
428
+ ## 🔌 API 使用
429
+
430
+ ### 核心类
431
+
432
+ ```typescript
433
+ import { VersionManager, GitManager, ChangelogManager } from '@mznjs/mbump'
434
+ ```
435
+
436
+ ### VersionManager
437
+
438
+ ```typescript
439
+ import { VersionManager, loadConfigAsync } from '@mznjs/mbump'
440
+
441
+ const config = await loadConfigAsync(process.cwd())
442
+ const manager = new VersionManager({ config, rootDir: process.cwd() })
443
+
444
+ // 更新版本
445
+ const result = await manager.updateVersion('my-package', 'minor', {
446
+ dryRun: false,
447
+ verbose: true,
448
+ autoCommit: true,
449
+ push: true,
450
+ publish: false,
451
+ })
452
+
453
+ // 预览更新
454
+ const preview = await manager.previewUpdate('my-package', 'patch')
455
+
456
+ // 获取包版本
457
+ const version = manager.getPackageVersion('my-package')
458
+ ```
459
+
460
+ ### Rust 项目支持
461
+
462
+ ```typescript
463
+ import { VersionManager } from '@mznjs/mbump'
464
+
465
+ const manager = new VersionManager({
466
+ rootDir: '/path/to/rust-project',
467
+ projectType: 'rust',
468
+ config: {
469
+ packagePaths: {
470
+ 'my-crate': '/path/to/rust-project/Cargo.toml',
471
+ },
472
+ git: {
473
+ autoCommit: true,
474
+ push: true,
475
+ tag: true,
476
+ },
477
+ },
478
+ })
479
+
480
+ // 更新版本
481
+ const result = await manager.updateVersion('my-crate', 'patch')
482
+
483
+ // 更新并发布
484
+ const result = await manager.updateVersion('my-crate', 'patch', {
485
+ publish: true,
486
+ })
487
+ ```
488
+
489
+ ### GitManager
490
+
491
+ ```typescript
492
+ import { GitManager } from '@mznjs/mbump'
493
+
494
+ const gitManager = new GitManager('/path/to/project')
495
+
496
+ // 检查未提交更改
497
+ const hasChanges = gitManager.hasUncommittedChanges()
498
+
499
+ // 创建 Tag
500
+ await gitManager.createTag('1.0.0', 'v')
501
+
502
+ // 提交并推送
503
+ await gitManager.commitAndPush('chore: bump version', true, true, '1.0.0', 'v')
504
+ ```
505
+
506
+ ### 工具函数
507
+
508
+ ```typescript
509
+ import { pathUtils, semverUtils, securityUtils } from '@mznjs/mbump'
510
+
511
+ // 路径工具
512
+ pathUtils.isPathLike('./packages/my-pkg') // true
513
+
514
+ // Semver 工具
515
+ semverUtils.incrementVersion('1.0.0', 'patch') // '1.0.1'
516
+
517
+ // 安全工具
518
+ securityUtils.validatePath('/project/src', '/project') // true
519
+ ```
470
520
 
471
521
  ## 🧪 测试
472
522
 
@@ -479,38 +529,28 @@ pnpm test tests/integration.test.ts
479
529
 
480
530
  # 监听模式
481
531
  pnpm test:watch
482
- ```
483
532
 
484
- ## 🤝 贡献指南
485
-
486
- 1. Fork 本仓库
487
- 2. 创建特性分支 (`git checkout -b feature/amazing-feature`)
488
- 3. 提交更改 (`git commit -m 'Add some amazing feature'`)
489
- 4. 推送到分支 (`git push origin feature/amazing-feature`)
490
- 5. 开启 Pull Request
491
-
492
- ### 开发要求
533
+ # 类型检查
534
+ pnpm typecheck
535
+ ```
493
536
 
494
- - Node.js >= 18.0.0
495
- - 所有测试必须通过
496
- - 代码必须符合 ESLint 规范
537
+ <br />
497
538
 
498
539
  ## 📄 许可证
499
540
 
500
541
  MIT License
501
542
 
502
- ## 👥 作者
543
+ <br />
503
544
 
504
- **mznjs Team** - [GitHub](https://github.com/mznjs)
505
-
506
- ## 🙏 致谢
545
+ 🙏 致谢
507
546
 
508
547
  感谢以下开源项目的支持:
548
+
509
549
  - [semver](https://github.com/npm/node-semver) - 语义化版本解析
510
550
  - [consola](https://github.com/unjs/consola) - 优雅的日志输出
511
551
  - [inquirer](https://github.com/SBoudrias/Inquirer.js) - 交互式命令行
512
552
  - [vitest](https://vitest.dev/) - 快速单元测试框架
513
553
 
514
- ---
554
+ ***
515
555
 
516
- **mbump** - 让版本管理更简单!🚀
556
+ **mbump** - 让版本管理更简单!🚀
@@ -1,5 +1,3 @@
1
- import { createRequire } from "module";
2
-
3
1
  //#region rolldown:runtime
4
2
  var __defProp = Object.defineProperty;
5
3
  var __export = (target, all) => {
@@ -8,7 +6,6 @@ var __export = (target, all) => {
8
6
  enumerable: true
9
7
  });
10
8
  };
11
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
12
9
 
13
10
  //#endregion
14
- export { __export, __require };
11
+ export { __export };
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli/index.ts"],"sourcesContent":null,"mappings":";;iBA6RgB,QAAA,CAAA;;;AAAhB"}
1
+ {"version":3,"file":"cli.d.ts","names":[],"sources":["../src/cli/index.ts"],"sourcesContent":null,"mappings":";;iBA4RgB,QAAA,CAAA;;;AAAhB"}