@done-coding/cli-git 0.6.13-alpha.0 → 0.6.13-alpha.2

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-6131addf.js";
3
- import "./index-cab9d803.js";
2
+ import { c as m } from "./index-f8ef5e74.js";
3
+ import "./index-647dd739.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 r, a as m, h as s } from "./index-cab9d803.js";
3
- import { log as o, xPrompts as n } from "@done-coding/cli-utils";
4
- import "node:child_process";
2
+ import { g as i, G as a, a as m, h as s } from "./index-647dd739.js";
3
+ import { log 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 u = async (e) => {
10
9
  o.info("克隆done-coding系列项目"), o.stage("选择平台:");
11
- const { platform: t } = await n(i(r.GITEE));
10
+ const { platform: t } = await r(i(a.GITEE));
12
11
  o.stage("选择用户名:");
13
- const { username: a } = await n(
12
+ const { username: n } = await r(
14
13
  m(
15
14
  {
16
- [r.GITHUB]: "done-coding",
17
- [r.GITEE]: "justsosu"
15
+ [a.GITHUB]: "done-coding",
16
+ [a.GITEE]: "justsosu"
18
17
  }[t]
19
18
  )
20
19
  );
21
- o.info("platform:", t), o.info("username:", a), await s({
20
+ o.info("platform:", t), o.info("username:", n), await s({
22
21
  platform: t,
23
- username: a,
22
+ username: n,
24
23
  projectName: e
25
24
  });
26
25
  };
27
26
  export {
28
- G as cloneDoneCodingSeries
27
+ u as cloneDoneCodingSeries
29
28
  };
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { lookForParentTarget as Y, log 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, log as i, decryptAES as Z, encryptAES as W, xPrompts as h, HooksNameEnum as p, addHuskyHooks as ee, initHandlerCommon as te, getConfigFileCommonOptions as I, execSyncWithLogDispatch 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.13-alpha.0",
63
+ version: "0.6.13-alpha.2",
65
64
  description: "git跨平台操作命令行工具",
66
65
  bin: {
67
66
  "dc-git": "es/cli.mjs"
@@ -94,10 +93,10 @@ const fe = 3e4, y = Math.random(), U = {
94
93
  }) => {
95
94
  const o = H(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,
@@ -261,7 +260,9 @@ const fe = 3e4, y = Math.random(), U = {
261
260
  default: d.DEFAULT
262
261
  }
263
262
  }), ke = (e) => {
264
- N(`npm pkg set scripts.postprepare="${e} init"`);
263
+ N(
264
+ `npm pkg set scripts.postprepare="${e} init"`
265
+ );
265
266
  }, j = async (e) => {
266
267
  const { type: t } = e;
267
268
  switch (t) {
@@ -290,7 +291,7 @@ const fe = 3e4, y = Math.random(), U = {
290
291
  throw new Error(`未知的初始化类型: ${t}`);
291
292
  }
292
293
  }, be = {
293
- command: l.INIT,
294
+ command: f.INIT,
294
295
  describe: "初始化配置文件",
295
296
  options: Pe(),
296
297
  handler: j
@@ -317,7 +318,7 @@ const fe = 3e4, y = Math.random(), U = {
317
318
  { stdio: "inherit" }
318
319
  ), i.success(`克隆${t}成功`);
319
320
  }, Be = {
320
- command: `${l.CLONE} <platform> <username>`,
321
+ command: `${f.CLONE} <platform> <username>`,
321
322
  describe: "从选择的git平台克隆代码",
322
323
  options: we(),
323
324
  positionals: ye(),
@@ -370,7 +371,7 @@ const fe = 3e4, y = Math.random(), U = {
370
371
  configMap: c,
371
372
  currentBranch: t
372
373
  })) {
373
- const { fromBranch: g, toBranch: f = t } = o, a = `禁止${g}被合并: ${g} => ${f}
374
+ const { fromBranch: g, toBranch: l = t } = o, a = `禁止${g}被合并: ${g} => ${l}
374
375
 
375
376
  --------- 建议 ---------
376
377
  可以通过
@@ -388,7 +389,7 @@ const fe = 3e4, y = Math.random(), U = {
388
389
  const s = $(e), r = Te(s);
389
390
  if (!r)
390
391
  return;
391
- const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash), f = ie({
392
+ const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash), l = ie({
392
393
  /** 考虑reflog存在往复切换 */
393
394
  count: r + 30,
394
395
  filterItem: (a) => n.includes(a.hash)
@@ -398,7 +399,7 @@ const fe = 3e4, y = Math.random(), U = {
398
399
  );
399
400
  o.forEach((a, m) => {
400
401
  var P;
401
- const O = a.mergeInfo || ((P = f[a.hash]) == null ? void 0 : P.mergeInfo);
402
+ const O = a.mergeInfo || ((P = l[a.hash]) == null ? void 0 : P.mergeInfo);
402
403
  O && Object.entries(s).forEach(([k]) => {
403
404
  const b = c[k];
404
405
  if (m > b) {
@@ -500,7 +501,7 @@ const fe = 3e4, y = Math.random(), U = {
500
501
  throw new Error(`不支持的检测类型${s}`);
501
502
  }
502
503
  }, He = {
503
- command: `${l.CHECK} <type>`,
504
+ command: `${f.CHECK} <type>`,
504
505
  describe: "检查git操作",
505
506
  options: Ne(),
506
507
  positionals: Le(),
@@ -558,25 +559,25 @@ const fe = 3e4, y = Math.random(), U = {
558
559
  i.error(`${t} 当前未支持处理`);
559
560
  }
560
561
  }, Ke = {
561
- command: `${l.HOOKS} <name> [args...]`,
562
+ command: `${f.HOOKS} <name> [args...]`,
562
563
  describe: "git钩子回调",
563
564
  options: De(),
564
565
  positionals: ve(),
565
566
  handler: J
566
- }, Ze = async (e, t) => {
567
+ }, Ye = async (e, t) => {
567
568
  switch (e) {
568
- case l.INIT:
569
+ case f.INIT:
569
570
  return j(t);
570
- case l.CLONE:
571
+ case f.CLONE:
571
572
  return V(t);
572
- case l.HOOKS:
573
+ case f.HOOKS:
573
574
  return J(t);
574
- case l.CHECK:
575
+ case f.CHECK:
575
576
  return q(t);
576
577
  default:
577
578
  throw new Error(`不支持的命令 ${e}`);
578
579
  }
579
- }, { version: je, description: Ve } = T, We = {
580
+ }, { version: je, description: Ve } = T, Ze = {
580
581
  describe: Ve,
581
582
  version: je,
582
583
  subcommands: [
@@ -592,10 +593,10 @@ export {
592
593
  C,
593
594
  E as G,
594
595
  d as I,
595
- l as S,
596
+ f as S,
596
597
  K as a,
597
598
  Oe as b,
598
- We as c,
599
+ Ze as c,
599
600
  j as d,
600
601
  be as e,
601
602
  Be as f,
@@ -606,6 +607,6 @@ export {
606
607
  Ke as k,
607
608
  q as l,
608
609
  He as m,
609
- Ze as n,
610
+ Ye as n,
610
611
  u as o
611
612
  };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as a, i as t } from "./index-cab9d803.js";
2
+ import { c as a, i as t } from "./index-647dd739.js";
3
3
  import { createMainCommand as r, createSubcommand as s } 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-cab9d803.js";
3
- import { a as T } from "./index-6131addf.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-647dd739.js";
3
+ import { a as S } from "./index-f8ef5e74.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.13-alpha.0",
3
+ "version": "0.6.13-alpha.2",
4
4
  "description": "git跨平台操作命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -52,7 +52,7 @@
52
52
  "license": "MIT",
53
53
  "sideEffects": false,
54
54
  "devDependencies": {
55
- "@done-coding/cli-inject": "0.5.21-alpha.0",
55
+ "@done-coding/cli-inject": "0.5.21-alpha.2",
56
56
  "@types/node": "^18.0.0",
57
57
  "@types/yargs": "^17.0.28",
58
58
  "rimraf": "^6.0.1",
@@ -64,9 +64,9 @@
64
64
  "node": ">=18.0.0"
65
65
  },
66
66
  "dependencies": {
67
- "@done-coding/cli-utils": "0.8.2-alpha.0",
67
+ "@done-coding/cli-utils": "0.8.2-alpha.2",
68
68
  "@done-coding/request-axios": "^1.2.2",
69
69
  "axios": "^1.8.4"
70
70
  },
71
- "gitHead": "b09dd794f69ba2dafe22a3519d712d059c2eb376"
71
+ "gitHead": "7683cce31678dfecc6b35014f9658ad8b59f0c97"
72
72
  }