@done-coding/cli-git 0.6.14-alpha.1 → 0.6.14-alpha.3

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/es/cli.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-d828de0e.js";
3
- import "./index-a9558422.js";
2
+ import { c as m } from "./index-6257eade.js";
3
+ import "./index-488dfda2.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 i, G as n, a as m, h as s } from "./index-a9558422.js";
3
- import { outputConsole as o, xPrompts as a } from "@done-coding/cli-utils";
4
- import "node:child_process";
2
+ import { g as s, G as n, a as i, h as m } from "./index-488dfda2.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 G = async (e) => {
8
+ const l = async (e) => {
10
9
  o.info("克隆done-coding系列项目"), o.stage("选择平台:");
11
- const { platform: t } = await a(i(n.GITEE));
10
+ const { platform: t } = await r(s(n.GITEE));
12
11
  o.stage("选择用户名:");
13
- const { username: r } = await a(
14
- m(
12
+ const { username: a } = await r(
13
+ i(
15
14
  {
16
15
  [n.GITHUB]: "done-coding",
17
16
  [n.GITEE]: "justsosu"
18
17
  }[t]
19
18
  )
20
19
  );
21
- o.info("platform:", t), o.info("username:", r), await s({
20
+ o.info("platform:", t), o.info("username:", a), await m({
22
21
  platform: t,
23
- username: r,
22
+ username: a,
24
23
  projectName: e
25
24
  });
26
25
  };
27
26
  export {
28
- G as cloneDoneCodingSeries
27
+ l as cloneDoneCodingSeries
29
28
  };
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { lookForParentTarget as Y, outputConsole as i, decryptAES as Z, encryptAES as W, xPrompts as h, HooksNameEnum as p, addHuskyHooks as ee, initHandlerCommon as te, getConfigFileCommonOptions as I, 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";
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 h, 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
6
  import pe from "axios";
8
- var l = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(l || {}), d = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.CLONE_CONFIG = "cloneConfig", e))(d || {}), 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 fe = 3e4, y = Math.random(), U = {
10
- timeout: fe,
7
+ var f = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(f || {}), d = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.CLONE_CONFIG = "cloneConfig", e))(d || {}), 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 || {});
8
+ const le = 3e4, y = Math.random(), U = {
9
+ timeout: le,
11
10
  getBusinessCode() {
12
11
  return y;
13
12
  },
@@ -25,7 +24,7 @@ const fe = 3e4, y = Math.random(), U = {
25
24
  }), A = L({
26
25
  basePath: "https://api.github.com",
27
26
  ...U
28
- }), le = ({
27
+ }), fe = ({
29
28
  username: e
30
29
  }) => x({
31
30
  url: `/api/v5/users/${e}/repos`,
@@ -61,7 +60,7 @@ const fe = 3e4, y = Math.random(), U = {
61
60
  }
62
61
  }), T = {
63
62
  name: "@done-coding/cli-git",
64
- version: "0.6.14-alpha.1",
63
+ version: "0.6.14-alpha.3",
65
64
  description: "git跨平台操作命令行工具",
66
65
  bin: {
67
66
  "dc-git": "es/cli.mjs"
@@ -72,8 +71,8 @@ const fe = 3e4, y = Math.random(), U = {
72
71
  }
73
72
  }, {
74
73
  cliConfig: { namespaceDir: de, moduleName: Re }
75
- } = T, F = `./${de}/${Re}`, S = `${F}.json`, H = (e) => `${F}/.${e}`, D = ({ platform: e, username: t }) => `${e}/${t}`, Me = (e) => {
76
- const { platform: t } = e, s = H(t), r = Y(s, {
74
+ } = T, H = `./${de}/${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 fe = 3e4, y = Math.random(), U = {
92
91
  platform: s,
93
92
  accessToken: r
94
93
  }) => {
95
- const o = H(s), n = JSON.stringify({
94
+ const o = F(s), n = JSON.stringify({
96
95
  accessToken: r
97
- }), g = D({ platform: s, username: t }), f = W({ text: n, secretKey: g }), a = w.join(e, o);
96
+ }), g = D({ platform: s, username: t }), l = W({ text: n, secretKey: g }), a = w.join(e, o);
98
97
  _.mkdirSync(w.dirname(a), {
99
98
  recursive: !0
100
- }), _.writeFileSync(a, f, "utf-8"), i.success(`配置信息保存成功 ${a}`);
99
+ }), _.writeFileSync(a, l, "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 fe = 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 f = {
148
+ const l = {
150
149
  username: o,
151
150
  accessToken: g
152
151
  };
153
152
  switch (s.platform) {
154
153
  case E.GITHUB: {
155
- c = (await (f.accessToken ? he : Ee)(f)).data.map((m) => ({
154
+ c = (await (l.accessToken ? he : Ee)(l)).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 fe = 3e4, y = Math.random(), U = {
161
160
  break;
162
161
  }
163
162
  case E.GITEE: {
164
- c = (await (f.accessToken ? ue : le)(f)).data.map((m) => ({
163
+ c = (await (l.accessToken ? ue : fe)(l)).data.map((m) => ({
165
164
  name: m.name,
166
165
  httpUrl: m.html_url,
167
166
  sshUrl: m.ssh_url,
@@ -204,7 +203,7 @@ const fe = 3e4, y = Math.random(), U = {
204
203
  p.PRE_REBASE
205
204
  ], $ = (e) => {
206
205
  const {
207
- [l.CHECK]: { [C.REVERSE_MERGE]: t }
206
+ [f.CHECK]: { [C.REVERSE_MERGE]: t }
208
207
  } = e;
209
208
  return t;
210
209
  }, Te = (e) => Math.max(
@@ -214,7 +213,7 @@ const fe = 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((f) => f.hash === o);
216
+ const g = t.findIndex((l) => l.hash === o);
218
217
  g !== -1 && (i.info(
219
218
  `${r} 设置 只检测 ${o} 之后的日志 即 下标 [0 - ${g})`
220
219
  ), n = Math.min(n, g - 1));
@@ -241,7 +240,7 @@ const fe = 3e4, y = Math.random(), U = {
241
240
  );
242
241
  return n || i.skip(`跳过: 允许${r} => ${o}`), n;
243
242
  }, Ge = {
244
- [l.CHECK]: {
243
+ [f.CHECK]: {
245
244
  [C.REVERSE_MERGE]: {
246
245
  [/^test$/.source]: {
247
246
  includeRebase: !0,
@@ -290,7 +289,7 @@ const fe = 3e4, y = Math.random(), U = {
290
289
  throw new Error(`未知的初始化类型: ${t}`);
291
290
  }
292
291
  }, be = {
293
- command: l.INIT,
292
+ command: f.INIT,
294
293
  describe: "初始化配置文件",
295
294
  options: Pe(),
296
295
  handler: j
@@ -317,7 +316,7 @@ const fe = 3e4, y = Math.random(), U = {
317
316
  { stdio: "inherit" }
318
317
  ), i.success(`克隆${t}成功`);
319
318
  }, Be = {
320
- command: `${l.CLONE} <platform> <username>`,
319
+ command: `${f.CLONE} <platform> <username>`,
321
320
  describe: "从选择的git平台克隆代码",
322
321
  options: we(),
323
322
  positionals: ye(),
@@ -370,7 +369,7 @@ const fe = 3e4, y = Math.random(), U = {
370
369
  configMap: c,
371
370
  currentBranch: t
372
371
  })) {
373
- const { fromBranch: g, toBranch: f = t } = o, a = `禁止${g}被合并: ${g} => ${f}
372
+ const { fromBranch: g, toBranch: l = t } = o, a = `禁止${g}被合并: ${g} => ${l}
374
373
 
375
374
  --------- 建议 ---------
376
375
  可以通过
@@ -388,7 +387,7 @@ const fe = 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), f = ie({
390
+ const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash), l = ie({
392
391
  /** 考虑reflog存在往复切换 */
393
392
  count: r + 30,
394
393
  filterItem: (a) => n.includes(a.hash)
@@ -398,7 +397,7 @@ const fe = 3e4, y = Math.random(), U = {
398
397
  );
399
398
  o.forEach((a, m) => {
400
399
  var P;
401
- const O = a.mergeInfo || ((P = f[a.hash]) == null ? void 0 : P.mergeInfo);
400
+ const O = a.mergeInfo || ((P = l[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) {
@@ -430,7 +429,7 @@ const fe = 3e4, y = Math.random(), U = {
430
429
  }
431
430
  });
432
431
  });
433
- }, Fe = ({
432
+ }, He = ({
434
433
  config: e,
435
434
  rebaseInfo: t
436
435
  }) => {
@@ -475,7 +474,7 @@ const fe = 3e4, y = Math.random(), U = {
475
474
  /** 能进入 rebase 说明originBranch有值 或者 当前在某个分支上 */
476
475
  n = r
477
476
  ] = o;
478
- Fe({
477
+ He({
479
478
  config: t,
480
479
  rebaseInfo: {
481
480
  targetBranch: c,
@@ -501,8 +500,8 @@ const fe = 3e4, y = Math.random(), U = {
501
500
  default:
502
501
  throw new Error(`不支持的检测类型${s}`);
503
502
  }
504
- }, He = {
505
- command: `${l.CHECK} <type>`,
503
+ }, Fe = {
504
+ command: `${f.CHECK} <type>`,
506
505
  describe: "检查git操作",
507
506
  options: Ne(),
508
507
  positionals: Le(),
@@ -560,32 +559,32 @@ const fe = 3e4, y = Math.random(), U = {
560
559
  i.error(`${t} 当前未支持处理`);
561
560
  }
562
561
  }, Ke = {
563
- command: `${l.HOOKS} <name> [args...]`,
562
+ command: `${f.HOOKS} <name> [args...]`,
564
563
  describe: "git钩子回调",
565
564
  options: De(),
566
565
  positionals: ve(),
567
566
  handler: J
568
- }, Ze = async (e, t) => {
567
+ }, Ye = async (e, t) => {
569
568
  switch (e) {
570
- case l.INIT:
569
+ case f.INIT:
571
570
  return j(t);
572
- case l.CLONE:
571
+ case f.CLONE:
573
572
  return V(t);
574
- case l.HOOKS:
573
+ case f.HOOKS:
575
574
  return J(t);
576
- case l.CHECK:
575
+ case f.CHECK:
577
576
  return q(t);
578
577
  default:
579
578
  throw new Error(`不支持的命令 ${e}`);
580
579
  }
581
- }, { version: je, description: Ve } = T, We = {
580
+ }, { version: je, description: Ve } = T, Ze = {
582
581
  describe: Ve,
583
582
  version: je,
584
583
  subcommands: [
585
584
  be,
586
585
  Be,
587
586
  Ke,
588
- He
587
+ Fe
589
588
  ].map(ge),
590
589
  demandCommandCount: 1,
591
590
  rootScriptName: me({ packageJson: T })
@@ -594,10 +593,10 @@ export {
594
593
  C,
595
594
  E as G,
596
595
  d as I,
597
- l as S,
596
+ f as S,
598
597
  K as a,
599
598
  Oe as b,
600
- We as c,
599
+ Ze as c,
601
600
  j as d,
602
601
  be as e,
603
602
  Be as f,
@@ -607,7 +606,7 @@ export {
607
606
  J as j,
608
607
  Ke as k,
609
608
  q as l,
610
- He as m,
611
- Ze as n,
609
+ Fe as m,
610
+ Ye as n,
612
611
  u as o
613
612
  };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as a, i as t } from "./index-a9558422.js";
2
+ import { c as a, i as t } from "./index-488dfda2.js";
3
3
  import { createMainCommand as s, createSubcommand as r } from "@done-coding/cli-utils";
4
4
  const {
5
5
  cliConfig: { moduleName: o }
package/es/index.mjs CHANGED
@@ -1,28 +1,27 @@
1
1
  #!/usr/bin/env node
2
- import { o as t, C as l, G as d, I as c, S as C, m as p, l as f, f as h, h as u, c as k, b as I, n as E, k as b, j as H, e as g, d as y } from "./index-a9558422.js";
3
- import { a as T } from "./index-d828de0e.js";
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-488dfda2.js";
3
+ import { a as S } from "./index-6257eade.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
- t as CheckReverseMergeWayEnum,
10
+ i as CheckReverseMergeWayEnum,
12
11
  l as CheckTypeEnum,
13
- d as GitPlatformEnum,
14
- c as InitTypeEnum,
15
- C as SubcommandEnum,
16
- p as checkCommandCliInfo,
17
- f as checkHandler,
18
- h as cloneCommandCliInfo,
19
- u as cloneHandler,
20
- k as commandCliInfo,
21
- T as crateAsSubcommand,
22
- I as getTargetRepoUrl,
23
- E as handler,
24
- b as hooksCommandCliInfo,
25
- H as hooksHandler,
26
- g as initCommandCliInfo,
27
- y as initHandler
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/cli-git",
3
- "version": "0.6.14-alpha.1",
3
+ "version": "0.6.14-alpha.3",
4
4
  "description": "git跨平台操作命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -49,7 +49,7 @@
49
49
  "license": "MIT",
50
50
  "sideEffects": false,
51
51
  "devDependencies": {
52
- "@done-coding/cli-inject": "0.5.22-alpha.1",
52
+ "@done-coding/cli-inject": "0.5.22-alpha.3",
53
53
  "@types/node": "^18.0.0",
54
54
  "@types/yargs": "^17.0.28",
55
55
  "typescript": "^5.8.3",
@@ -57,12 +57,12 @@
57
57
  "vite-plugin-dts": "^3.6.0"
58
58
  },
59
59
  "dependencies": {
60
- "@done-coding/cli-utils": "0.8.3-alpha.1",
60
+ "@done-coding/cli-utils": "0.8.3-alpha.3",
61
61
  "@done-coding/request-axios": "^1.2.2",
62
62
  "axios": "^1.8.4"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=18.0.0"
66
66
  },
67
- "gitHead": "c316dae3339308b554618b88b3e826502c5fc9f1"
67
+ "gitHead": "30a4e6c8721e6bcafa72d4e05b35b5ed5fc75c0d"
68
68
  }