done-coding-git 0.6.12 → 0.6.15
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 +40 -22
- package/es/cli.mjs +2 -3
- package/es/helpers.mjs +10 -11
- package/es/{index-8640f971.js → index-569e0691.js} +48 -47
- package/es/index-d0f82826.js +21 -0
- package/es/index.mjs +18 -19
- package/package.json +9 -10
- package/es/index-166c6260.js +0 -19
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ git 跨平台操作命令行工具 - 提供 git 平台克隆、钩子管理和
|
|
|
8
8
|
## 安装
|
|
9
9
|
|
|
10
10
|
### 独立安装
|
|
11
|
+
|
|
11
12
|
```bash
|
|
12
13
|
npm install @done-coding/cli-git
|
|
13
14
|
# 或
|
|
@@ -15,6 +16,7 @@ pnpm add @done-coding/cli-git
|
|
|
15
16
|
```
|
|
16
17
|
|
|
17
18
|
### 作为 done-coding CLI 的一部分
|
|
19
|
+
|
|
18
20
|
```bash
|
|
19
21
|
npm install -g @done-coding/cli
|
|
20
22
|
# 然后使用
|
|
@@ -45,6 +47,7 @@ dc git --help # Windows
|
|
|
45
47
|
### 基础命令
|
|
46
48
|
|
|
47
49
|
#### `dc-git init`
|
|
50
|
+
|
|
48
51
|
初始化配置文件
|
|
49
52
|
|
|
50
53
|
```bash
|
|
@@ -53,6 +56,7 @@ dc-git init
|
|
|
53
56
|
```
|
|
54
57
|
|
|
55
58
|
#### `dc-git clone <platform> <username>`
|
|
59
|
+
|
|
56
60
|
从指定的 git 平台克隆用户的代码仓库
|
|
57
61
|
|
|
58
62
|
```bash
|
|
@@ -67,10 +71,12 @@ dc-git clone bitbucket username
|
|
|
67
71
|
```
|
|
68
72
|
|
|
69
73
|
**参数说明**:
|
|
74
|
+
|
|
70
75
|
- `platform`: git 平台名称 (github, gitlab, bitbucket 等)
|
|
71
76
|
- `username`: 用户名
|
|
72
77
|
|
|
73
78
|
#### `dc-git hooks <name> [args...]`
|
|
79
|
+
|
|
74
80
|
执行 git 钩子回调
|
|
75
81
|
|
|
76
82
|
```bash
|
|
@@ -85,10 +91,12 @@ dc-git hooks pre-push origin main
|
|
|
85
91
|
```
|
|
86
92
|
|
|
87
93
|
**参数说明**:
|
|
94
|
+
|
|
88
95
|
- `name`: 钩子名称
|
|
89
96
|
- `args`: 传递给钩子的参数
|
|
90
97
|
|
|
91
98
|
#### `dc-git check <type>`
|
|
99
|
+
|
|
92
100
|
检查 git 操作和状态,主要为工程化配置提供支持
|
|
93
101
|
|
|
94
102
|
```bash
|
|
@@ -97,6 +105,7 @@ dc-git check reverse-merge
|
|
|
97
105
|
```
|
|
98
106
|
|
|
99
107
|
**参数说明**:
|
|
108
|
+
|
|
100
109
|
- `type`: 检查类型
|
|
101
110
|
- `reverse-merge`: 检测反向合并,防止高级分支被合并到低级分支
|
|
102
111
|
|
|
@@ -154,29 +163,29 @@ DC git check reverse-merge
|
|
|
154
163
|
```javascript
|
|
155
164
|
export default {
|
|
156
165
|
// 默认平台
|
|
157
|
-
defaultPlatform:
|
|
158
|
-
|
|
166
|
+
defaultPlatform: "github",
|
|
167
|
+
|
|
159
168
|
// 克隆配置
|
|
160
169
|
clone: {
|
|
161
170
|
// 默认克隆协议
|
|
162
|
-
protocol:
|
|
171
|
+
protocol: "https", // 或 'ssh'
|
|
163
172
|
// 目标目录
|
|
164
|
-
targetDir:
|
|
173
|
+
targetDir: "./repos",
|
|
165
174
|
},
|
|
166
|
-
|
|
175
|
+
|
|
167
176
|
// 钩子配置
|
|
168
177
|
hooks: {
|
|
169
178
|
// 启用的钩子
|
|
170
|
-
enabled: [
|
|
179
|
+
enabled: ["pre-commit", "post-commit", "pre-push"],
|
|
171
180
|
// 钩子脚本路径
|
|
172
|
-
scriptsPath:
|
|
181
|
+
scriptsPath: "./.git/hooks",
|
|
173
182
|
},
|
|
174
|
-
|
|
183
|
+
|
|
175
184
|
// 检查配置
|
|
176
185
|
check: {
|
|
177
186
|
// 默认检查项
|
|
178
|
-
defaultChecks: [
|
|
179
|
-
}
|
|
187
|
+
defaultChecks: ["status", "branch", "remote"],
|
|
188
|
+
},
|
|
180
189
|
};
|
|
181
190
|
```
|
|
182
191
|
|
|
@@ -185,29 +194,33 @@ export default {
|
|
|
185
194
|
### 作为模块使用
|
|
186
195
|
|
|
187
196
|
```javascript
|
|
188
|
-
import { GitHelper } from
|
|
197
|
+
import { GitHelper } from "@done-coding/cli-git/helpers";
|
|
189
198
|
|
|
190
199
|
const git = new GitHelper();
|
|
191
200
|
|
|
192
201
|
// 克隆仓库
|
|
193
|
-
await git.cloneFromPlatform(
|
|
202
|
+
await git.cloneFromPlatform("github", "username");
|
|
194
203
|
|
|
195
204
|
// 执行钩子
|
|
196
|
-
await git.executeHook(
|
|
205
|
+
await git.executeHook("pre-commit", []);
|
|
197
206
|
|
|
198
207
|
// 检查状态
|
|
199
|
-
const status = await git.checkStatus(
|
|
208
|
+
const status = await git.checkStatus("status");
|
|
200
209
|
console.log(status);
|
|
201
210
|
```
|
|
202
211
|
|
|
203
212
|
### TypeScript 支持
|
|
204
213
|
|
|
205
214
|
```typescript
|
|
206
|
-
import type {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
215
|
+
import type {
|
|
216
|
+
PlatformType,
|
|
217
|
+
HookType,
|
|
218
|
+
CheckType,
|
|
219
|
+
} from "@done-coding/cli-git/helpers";
|
|
220
|
+
|
|
221
|
+
const platform: PlatformType = "github";
|
|
222
|
+
const hook: HookType = "pre-commit";
|
|
223
|
+
const checkType: CheckType = "status";
|
|
211
224
|
```
|
|
212
225
|
|
|
213
226
|
## 故障排除
|
|
@@ -215,6 +228,7 @@ const checkType: CheckType = 'status';
|
|
|
215
228
|
### 常见问题
|
|
216
229
|
|
|
217
230
|
**Q: 克隆失败**
|
|
231
|
+
|
|
218
232
|
```bash
|
|
219
233
|
# 检查网络连接
|
|
220
234
|
ping github.com
|
|
@@ -227,6 +241,7 @@ dc-git clone github username --verbose
|
|
|
227
241
|
```
|
|
228
242
|
|
|
229
243
|
**Q: 钩子执行失败**
|
|
244
|
+
|
|
230
245
|
```bash
|
|
231
246
|
# 检查钩子文件权限
|
|
232
247
|
ls -la .git/hooks/
|
|
@@ -239,6 +254,7 @@ dc-git init
|
|
|
239
254
|
```
|
|
240
255
|
|
|
241
256
|
**Q: 检查命令无响应**
|
|
257
|
+
|
|
242
258
|
```bash
|
|
243
259
|
# 确保在 git 仓库中
|
|
244
260
|
git status
|
|
@@ -277,7 +293,7 @@ DEBUG=done-coding:git dc-git clone github username
|
|
|
277
293
|
|
|
278
294
|
```bash
|
|
279
295
|
# 克隆仓库
|
|
280
|
-
git clone https://
|
|
296
|
+
git clone https://github.com/done-coding/done-coding-cli.git
|
|
281
297
|
cd done-coding-cli/packages/git
|
|
282
298
|
|
|
283
299
|
# 安装依赖
|
|
@@ -313,6 +329,7 @@ MIT © [JustSoSu](https://gitee.com/done-coding)
|
|
|
313
329
|
### 检测功能详解
|
|
314
330
|
|
|
315
331
|
#### `dc-git check reverse-merge`
|
|
332
|
+
|
|
316
333
|
专为工程化配置提供的 git 合并规范检测:
|
|
317
334
|
|
|
318
335
|
```bash
|
|
@@ -321,12 +338,13 @@ dc-git check reverse-merge
|
|
|
321
338
|
|
|
322
339
|
# 该命令会检测:
|
|
323
340
|
# 1. 通过 git reflog 检测合并操作
|
|
324
|
-
# 2. 通过提交信息检测合并记录
|
|
341
|
+
# 2. 通过提交信息检测合并记录
|
|
325
342
|
# 3. 通过提交记录检测历史合并
|
|
326
343
|
# 4. 检测 rebase 操作的合规性
|
|
327
344
|
```
|
|
328
345
|
|
|
329
346
|
**检测场景**:
|
|
347
|
+
|
|
330
348
|
- 防止 `main` 分支被合并到 `feature` 分支
|
|
331
349
|
- 防止 `develop` 分支被合并到个人开发分支
|
|
332
350
|
- 确保分支合并方向符合 Git Flow 规范
|
|
@@ -336,4 +354,4 @@ dc-git check reverse-merge
|
|
|
336
354
|
- [主 CLI 工具](https://www.npmjs.com/package/@done-coding/cli)
|
|
337
355
|
- [配置工具包](https://www.npmjs.com/package/@done-coding/cli-config) - 使用本包的检测功能
|
|
338
356
|
- [Gitee 仓库](https://gitee.com/done-coding/done-coding-cli)
|
|
339
|
-
- [更新日志](./CHANGELOG.md)
|
|
357
|
+
- [更新日志](./CHANGELOG.md)
|
package/es/cli.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as m } from "./index-
|
|
3
|
-
import "./index-
|
|
2
|
+
import { c as m } from "./index-d0f82826.js";
|
|
3
|
+
import "./index-569e0691.js";
|
|
4
4
|
import "@done-coding/cli-utils";
|
|
5
|
-
import "node:child_process";
|
|
6
5
|
import "node:fs";
|
|
7
6
|
import "node:path";
|
|
8
7
|
import "@done-coding/request-axios";
|
package/es/helpers.mjs
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { g as
|
|
3
|
-
import {
|
|
4
|
-
import "node:child_process";
|
|
2
|
+
import { g as s, G as n, a as i, h as m } from "./index-569e0691.js";
|
|
3
|
+
import { outputConsole as o, xPrompts as r } from "@done-coding/cli-utils";
|
|
5
4
|
import "node:fs";
|
|
6
5
|
import "node:path";
|
|
7
6
|
import "@done-coding/request-axios";
|
|
8
7
|
import "axios";
|
|
9
|
-
const
|
|
8
|
+
const l = async (e) => {
|
|
10
9
|
o.info("克隆done-coding系列项目"), o.stage("选择平台:");
|
|
11
|
-
const { platform: t } = await
|
|
10
|
+
const { platform: t } = await r(s(n.GITEE));
|
|
12
11
|
o.stage("选择用户名:");
|
|
13
|
-
const { username: a } = await
|
|
14
|
-
|
|
12
|
+
const { username: a } = await r(
|
|
13
|
+
i(
|
|
15
14
|
{
|
|
16
|
-
[
|
|
17
|
-
[
|
|
15
|
+
[n.GITHUB]: "done-coding",
|
|
16
|
+
[n.GITEE]: "justsosu"
|
|
18
17
|
}[t]
|
|
19
18
|
)
|
|
20
19
|
);
|
|
21
|
-
o.info("platform:", t), o.info("username:", a), await
|
|
20
|
+
o.info("platform:", t), o.info("username:", a), await m({
|
|
22
21
|
platform: t,
|
|
23
22
|
username: a,
|
|
24
23
|
projectName: e
|
|
25
24
|
});
|
|
26
25
|
};
|
|
27
26
|
export {
|
|
28
|
-
|
|
27
|
+
l as cloneDoneCodingSeries
|
|
29
28
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { lookForParentTarget as Y,
|
|
3
|
-
import { execSync as N } from "node:child_process";
|
|
2
|
+
import { lookForParentTarget as Y, outputConsole as i, decryptAES as Z, encryptAES as W, xPrompts as d, HooksNameEnum as p, addHuskyHooks as ee, initHandlerCommon as te, getConfigFileCommonOptions as I, execSyncHijack as N, readConfigFile as R, getCurrentBranchName as se, getCommitByHookName as oe, resolveMergeInfoByGitReflogAction as re, checkCurrentIsRebasing as ne, resolveMergeInfoByCommitMsg as ce, getCurrentBranchLastCommitList as ae, getLastReflogList as ie, createSubcommand as ge, getRootScriptName as me } from "@done-coding/cli-utils";
|
|
4
3
|
import _ from "node:fs";
|
|
5
4
|
import w from "node:path";
|
|
6
5
|
import { createRequest as L } from "@done-coding/request-axios";
|
|
7
|
-
import
|
|
6
|
+
import pe from "axios";
|
|
8
7
|
var l = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(l || {}), h = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.CLONE_CONFIG = "cloneConfig", e))(h || {}), E = /* @__PURE__ */ ((e) => (e.GITHUB = "github", e.GITEE = "gitee", e))(E || {}), C = /* @__PURE__ */ ((e) => (e.REVERSE_MERGE = "reverseMerge", e))(C || {}), u = /* @__PURE__ */ ((e) => (e.REFLOG_ACTION = "reflog-action", e.COMMIT_MSG = "commit-msg", e.COMMIT_RECORD = "commit-record", e.PRE_REBASE = "pre-rebase", e))(u || {});
|
|
9
|
-
const
|
|
10
|
-
timeout:
|
|
8
|
+
const fe = 3e4, y = Math.random(), U = {
|
|
9
|
+
timeout: fe,
|
|
11
10
|
getBusinessCode() {
|
|
12
11
|
return y;
|
|
13
12
|
},
|
|
@@ -18,7 +17,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
18
17
|
return e.data;
|
|
19
18
|
},
|
|
20
19
|
businessSuccessCodeList: [y],
|
|
21
|
-
axios:
|
|
20
|
+
axios: pe
|
|
22
21
|
}, x = L({
|
|
23
22
|
basePath: " https://gitee.com",
|
|
24
23
|
...U
|
|
@@ -61,7 +60,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
61
60
|
}
|
|
62
61
|
}), T = {
|
|
63
62
|
name: "@done-coding/cli-git",
|
|
64
|
-
version: "0.6.
|
|
63
|
+
version: "0.6.15",
|
|
65
64
|
description: "git跨平台操作命令行工具",
|
|
66
65
|
bin: {
|
|
67
66
|
"dc-git": "es/cli.mjs"
|
|
@@ -72,8 +71,8 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
72
71
|
}
|
|
73
72
|
}, {
|
|
74
73
|
cliConfig: { namespaceDir: he, moduleName: Re }
|
|
75
|
-
} = T,
|
|
76
|
-
const { platform: t } = e, s =
|
|
74
|
+
} = T, H = `./${he}/${Re}`, S = `${H}.json`, F = (e) => `${H}/.${e}`, D = ({ platform: e, username: t }) => `${e}/${t}`, Me = (e) => {
|
|
75
|
+
const { platform: t } = e, s = F(t), r = Y(s, {
|
|
77
76
|
isFindFarthest: !1
|
|
78
77
|
});
|
|
79
78
|
if (!r) {
|
|
@@ -92,12 +91,12 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
92
91
|
platform: s,
|
|
93
92
|
accessToken: r
|
|
94
93
|
}) => {
|
|
95
|
-
const o =
|
|
94
|
+
const o = F(s), n = JSON.stringify({
|
|
96
95
|
accessToken: r
|
|
97
|
-
}), g = D({ platform: s, username: t }),
|
|
96
|
+
}), g = D({ platform: s, username: t }), f = W({ text: n, secretKey: g }), a = w.join(e, o);
|
|
98
97
|
_.mkdirSync(w.dirname(a), {
|
|
99
98
|
recursive: !0
|
|
100
|
-
}), _.writeFileSync(a,
|
|
99
|
+
}), _.writeFileSync(a, f, "utf-8"), i.success(`配置信息保存成功 ${a}`);
|
|
101
100
|
}, B = [
|
|
102
101
|
{ title: "GitHub", value: E.GITHUB },
|
|
103
102
|
{ title: "Gitee", value: E.GITEE }
|
|
@@ -146,13 +145,13 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
146
145
|
});
|
|
147
146
|
let g = n == null ? void 0 : n.accessToken;
|
|
148
147
|
i.stage(`正在获取${o}的${r}仓库列表...`);
|
|
149
|
-
const
|
|
148
|
+
const f = {
|
|
150
149
|
username: o,
|
|
151
150
|
accessToken: g
|
|
152
151
|
};
|
|
153
152
|
switch (s.platform) {
|
|
154
153
|
case E.GITHUB: {
|
|
155
|
-
c = (await (
|
|
154
|
+
c = (await (f.accessToken ? de : Ee)(f)).data.map((m) => ({
|
|
156
155
|
name: m.name,
|
|
157
156
|
httpUrl: m.clone_url,
|
|
158
157
|
sshUrl: m.ssh_url,
|
|
@@ -161,7 +160,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
161
160
|
break;
|
|
162
161
|
}
|
|
163
162
|
case E.GITEE: {
|
|
164
|
-
c = (await (
|
|
163
|
+
c = (await (f.accessToken ? ue : le)(f)).data.map((m) => ({
|
|
165
164
|
name: m.name,
|
|
166
165
|
httpUrl: m.html_url,
|
|
167
166
|
sshUrl: m.ssh_url,
|
|
@@ -188,20 +187,20 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
188
187
|
});
|
|
189
188
|
return a;
|
|
190
189
|
}, _e = [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
190
|
+
p.PRE_COMMIT,
|
|
191
|
+
p.PRE_MERGE_COMMIT,
|
|
192
|
+
p.PREPARE_COMMIT_MSG,
|
|
193
|
+
p.COMMIT_MSG,
|
|
194
|
+
p.PRE_REBASE,
|
|
195
|
+
p.POST_COMMIT,
|
|
196
|
+
p.POST_MERGE,
|
|
197
|
+
p.PRE_PUSH
|
|
199
198
|
], Ie = [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
p.PRE_MERGE_COMMIT,
|
|
200
|
+
p.PREPARE_COMMIT_MSG,
|
|
201
|
+
p.POST_MERGE,
|
|
202
|
+
p.PRE_PUSH,
|
|
203
|
+
p.PRE_REBASE
|
|
205
204
|
], $ = (e) => {
|
|
206
205
|
const {
|
|
207
206
|
[l.CHECK]: { [C.REVERSE_MERGE]: t }
|
|
@@ -214,7 +213,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
214
213
|
(s, [r, { afterHash: o, logCount: c }]) => {
|
|
215
214
|
let n = c - 1;
|
|
216
215
|
if (o) {
|
|
217
|
-
const g = t.findIndex((
|
|
216
|
+
const g = t.findIndex((f) => f.hash === o);
|
|
218
217
|
g !== -1 && (i.info(
|
|
219
218
|
`${r} 设置 只检测 ${o} 之后的日志 即 下标 [0 - ${g})`
|
|
220
219
|
), n = Math.min(n, g - 1));
|
|
@@ -370,7 +369,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
370
369
|
configMap: c,
|
|
371
370
|
currentBranch: t
|
|
372
371
|
})) {
|
|
373
|
-
const { fromBranch: g, toBranch:
|
|
372
|
+
const { fromBranch: g, toBranch: f = t } = o, a = `禁止${g}被合并: ${g} => ${f}
|
|
374
373
|
|
|
375
374
|
--------- 建议 ---------
|
|
376
375
|
可以通过
|
|
@@ -388,7 +387,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
388
387
|
const s = $(e), r = Te(s);
|
|
389
388
|
if (!r)
|
|
390
389
|
return;
|
|
391
|
-
const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash),
|
|
390
|
+
const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash), f = ie({
|
|
392
391
|
/** 考虑reflog存在往复切换 */
|
|
393
392
|
count: r + 30,
|
|
394
393
|
filterItem: (a) => n.includes(a.hash)
|
|
@@ -398,11 +397,13 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
398
397
|
);
|
|
399
398
|
o.forEach((a, m) => {
|
|
400
399
|
var P;
|
|
401
|
-
const O = a.mergeInfo || ((P =
|
|
400
|
+
const O = a.mergeInfo || ((P = f[a.hash]) == null ? void 0 : P.mergeInfo);
|
|
402
401
|
O && Object.entries(s).forEach(([k]) => {
|
|
403
402
|
const b = c[k];
|
|
404
403
|
if (m > b) {
|
|
405
|
-
i.skip(
|
|
404
|
+
i.skip(
|
|
405
|
+
`${k} 只检测${b + 1}条, 超出不再检测`
|
|
406
|
+
);
|
|
406
407
|
return;
|
|
407
408
|
}
|
|
408
409
|
const z = G({
|
|
@@ -428,7 +429,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
428
429
|
}
|
|
429
430
|
});
|
|
430
431
|
});
|
|
431
|
-
},
|
|
432
|
+
}, He = ({
|
|
432
433
|
config: e,
|
|
433
434
|
rebaseInfo: t
|
|
434
435
|
}) => {
|
|
@@ -473,7 +474,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
473
474
|
/** 能进入 rebase 说明originBranch有值 或者 当前在某个分支上 */
|
|
474
475
|
n = r
|
|
475
476
|
] = o;
|
|
476
|
-
|
|
477
|
+
He({
|
|
477
478
|
config: t,
|
|
478
479
|
rebaseInfo: {
|
|
479
480
|
targetBranch: c,
|
|
@@ -499,7 +500,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
499
500
|
default:
|
|
500
501
|
throw new Error(`不支持的检测类型${s}`);
|
|
501
502
|
}
|
|
502
|
-
},
|
|
503
|
+
}, Fe = {
|
|
503
504
|
command: `${l.CHECK} <type>`,
|
|
504
505
|
describe: "检查git操作",
|
|
505
506
|
options: Ne(),
|
|
@@ -516,7 +517,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
516
517
|
}), J = async (e) => {
|
|
517
518
|
const { name: t, rootDir: s, args: r } = e;
|
|
518
519
|
switch (t) {
|
|
519
|
-
case
|
|
520
|
+
case p.PRE_MERGE_COMMIT: {
|
|
520
521
|
const o = await R(e);
|
|
521
522
|
M({
|
|
522
523
|
config: o,
|
|
@@ -525,7 +526,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
525
526
|
});
|
|
526
527
|
break;
|
|
527
528
|
}
|
|
528
|
-
case
|
|
529
|
+
case p.PREPARE_COMMIT_MSG: {
|
|
529
530
|
const o = await R(e);
|
|
530
531
|
M({
|
|
531
532
|
config: o,
|
|
@@ -535,8 +536,8 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
535
536
|
});
|
|
536
537
|
break;
|
|
537
538
|
}
|
|
538
|
-
case
|
|
539
|
-
case
|
|
539
|
+
case p.POST_MERGE:
|
|
540
|
+
case p.PRE_PUSH: {
|
|
540
541
|
const o = await R(e);
|
|
541
542
|
M({
|
|
542
543
|
config: o,
|
|
@@ -545,7 +546,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
545
546
|
});
|
|
546
547
|
break;
|
|
547
548
|
}
|
|
548
|
-
case
|
|
549
|
+
case p.PRE_REBASE: {
|
|
549
550
|
const o = await R(e);
|
|
550
551
|
M({
|
|
551
552
|
config: o,
|
|
@@ -563,7 +564,7 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
563
564
|
options: De(),
|
|
564
565
|
positionals: ve(),
|
|
565
566
|
handler: J
|
|
566
|
-
},
|
|
567
|
+
}, Ye = async (e, t) => {
|
|
567
568
|
switch (e) {
|
|
568
569
|
case l.INIT:
|
|
569
570
|
return j(t);
|
|
@@ -576,14 +577,14 @@ const pe = 3e4, y = Math.random(), U = {
|
|
|
576
577
|
default:
|
|
577
578
|
throw new Error(`不支持的命令 ${e}`);
|
|
578
579
|
}
|
|
579
|
-
}, { version: je, description: Ve } = T,
|
|
580
|
+
}, { version: je, description: Ve } = T, Ze = {
|
|
580
581
|
describe: Ve,
|
|
581
582
|
version: je,
|
|
582
583
|
subcommands: [
|
|
583
584
|
be,
|
|
584
585
|
Be,
|
|
585
586
|
Ke,
|
|
586
|
-
|
|
587
|
+
Fe
|
|
587
588
|
].map(ge),
|
|
588
589
|
demandCommandCount: 1,
|
|
589
590
|
rootScriptName: me({ packageJson: T })
|
|
@@ -595,7 +596,7 @@ export {
|
|
|
595
596
|
l as S,
|
|
596
597
|
K as a,
|
|
597
598
|
Oe as b,
|
|
598
|
-
|
|
599
|
+
Ze as c,
|
|
599
600
|
j as d,
|
|
600
601
|
be as e,
|
|
601
602
|
Be as f,
|
|
@@ -605,7 +606,7 @@ export {
|
|
|
605
606
|
J as j,
|
|
606
607
|
Ke as k,
|
|
607
608
|
q as l,
|
|
608
|
-
|
|
609
|
-
|
|
609
|
+
Fe as m,
|
|
610
|
+
Ye as n,
|
|
610
611
|
u as o
|
|
611
612
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { c as a, i as t } from "./index-569e0691.js";
|
|
3
|
+
import { createMainCommand as s, createSubcommand as r } from "@done-coding/cli-utils";
|
|
4
|
+
const {
|
|
5
|
+
cliConfig: { moduleName: o }
|
|
6
|
+
} = t, e = (n = !1) => {
|
|
7
|
+
const c = n ? o : void 0, m = `$0${n ? ` ${o}` : ""} <command> [options]`;
|
|
8
|
+
return { command: c, usage: m };
|
|
9
|
+
}, u = async () => s({
|
|
10
|
+
...a,
|
|
11
|
+
...e()
|
|
12
|
+
}), f = () => r({
|
|
13
|
+
...a,
|
|
14
|
+
...e(!0),
|
|
15
|
+
// git 子命令不显示描述信息 即不在父命令的描述信息中显示
|
|
16
|
+
describe: !1
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
f as a,
|
|
20
|
+
u as c
|
|
21
|
+
};
|
package/es/index.mjs
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { o as
|
|
3
|
-
import { a as
|
|
2
|
+
import { o as i, C as l, G as t, I as d, S as c, m as C, l as p, f, h, c as u, b as k, n as I, k as E, j as b, e as H, d as g } from "./index-569e0691.js";
|
|
3
|
+
import { a as S } from "./index-d0f82826.js";
|
|
4
4
|
import "@done-coding/cli-utils";
|
|
5
|
-
import "node:child_process";
|
|
6
5
|
import "node:fs";
|
|
7
6
|
import "node:path";
|
|
8
7
|
import "@done-coding/request-axios";
|
|
9
8
|
import "axios";
|
|
10
9
|
export {
|
|
11
|
-
|
|
10
|
+
i as CheckReverseMergeWayEnum,
|
|
12
11
|
l as CheckTypeEnum,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
t as GitPlatformEnum,
|
|
13
|
+
d as InitTypeEnum,
|
|
14
|
+
c as SubcommandEnum,
|
|
15
|
+
C as checkCommandCliInfo,
|
|
16
|
+
p as checkHandler,
|
|
17
|
+
f as cloneCommandCliInfo,
|
|
18
|
+
h as cloneHandler,
|
|
19
|
+
u as commandCliInfo,
|
|
20
|
+
S as crateAsSubcommand,
|
|
21
|
+
k as getTargetRepoUrl,
|
|
22
|
+
I as handler,
|
|
23
|
+
E as hooksCommandCliInfo,
|
|
24
|
+
b as hooksHandler,
|
|
25
|
+
H as initCommandCliInfo,
|
|
26
|
+
g as initHandler
|
|
28
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "done-coding-git",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"description": "git跨平台操作命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "https://
|
|
34
|
+
"url": "https://github.com/done-coding/done-coding-cli.git",
|
|
35
35
|
"directory": "packages/git"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
@@ -42,22 +42,21 @@
|
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@done-coding/cli-inject": "0.5.
|
|
45
|
+
"@done-coding/cli-inject": "0.5.23",
|
|
46
46
|
"@types/node": "^18.0.0",
|
|
47
47
|
"@types/yargs": "^17.0.28",
|
|
48
|
-
"
|
|
49
|
-
"typescript": "^5.2.2",
|
|
48
|
+
"typescript": "^5.8.3",
|
|
50
49
|
"vite": "^4.4.11",
|
|
51
50
|
"vite-plugin-dts": "^3.6.0"
|
|
52
51
|
},
|
|
53
|
-
"engines": {
|
|
54
|
-
"node": ">=18.0.0"
|
|
55
|
-
},
|
|
56
52
|
"dependencies": {
|
|
57
|
-
"@done-coding/cli-utils": "0.8.
|
|
53
|
+
"@done-coding/cli-utils": "0.8.4",
|
|
58
54
|
"@done-coding/request-axios": "^1.2.2",
|
|
59
55
|
"axios": "^1.8.4"
|
|
60
56
|
},
|
|
61
|
-
"
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18.0.0"
|
|
59
|
+
},
|
|
60
|
+
"gitHead": "d90f437c0a716f3e62bd92a221341838710869ad",
|
|
62
61
|
"scripts": {}
|
|
63
62
|
}
|
package/es/index-166c6260.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { c as a, i as t } from "./index-8640f971.js";
|
|
3
|
-
import { createMainCommand as r, createSubcommand as s } from "@done-coding/cli-utils";
|
|
4
|
-
const {
|
|
5
|
-
cliConfig: { moduleName: o }
|
|
6
|
-
} = t, c = (n = !1) => {
|
|
7
|
-
const e = n ? o : void 0, m = `$0${n ? ` ${o}` : ""} <command> [options]`;
|
|
8
|
-
return { command: e, usage: m };
|
|
9
|
-
}, u = async () => r({
|
|
10
|
-
...a,
|
|
11
|
-
...c()
|
|
12
|
-
}), f = () => s({
|
|
13
|
-
...a,
|
|
14
|
-
...c(!0)
|
|
15
|
-
});
|
|
16
|
-
export {
|
|
17
|
-
f as a,
|
|
18
|
-
u as c
|
|
19
|
-
};
|