@done-coding/cli-git 0.3.0-alpha.0 → 0.3.2-alpha.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/es/cli.mjs +1 -2
- package/es/{index-1cb42d1b.js → index-da471e5e.js} +22 -21
- package/es/index.mjs +5 -6
- package/package.json +8 -11
- package/types/injectInfo.json.d.ts +1 -1
package/es/cli.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as m } from "./index-
|
|
2
|
+
import { c as m } from "./index-da471e5e.js";
|
|
3
3
|
import "@done-coding/cli-utils";
|
|
4
4
|
import "@done-coding/request-axios";
|
|
5
5
|
import "axios";
|
|
6
6
|
import "node:fs";
|
|
7
7
|
import "node:path";
|
|
8
8
|
import "node:child_process";
|
|
9
|
-
import "lodash.curry";
|
|
10
9
|
m();
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { lookForParentTarget as y, log as n, decryptAES as I, xPrompts as
|
|
2
|
+
import { lookForParentTarget as y, log as n, decryptAES as I, xPrompts as p, _curry as S, createSubcommand as h, createMainCommand as v } from "@done-coding/cli-utils";
|
|
3
3
|
import { createRequest as C } from "@done-coding/request-axios";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import N from "axios";
|
|
5
|
+
import w from "node:fs";
|
|
6
6
|
import "node:path";
|
|
7
|
-
import { execSync as
|
|
8
|
-
import B from "lodash.curry";
|
|
7
|
+
import { execSync as B } from "node:child_process";
|
|
9
8
|
var u = /* @__PURE__ */ ((e) => (e.CLONE = "clone", e))(u || {}), i = /* @__PURE__ */ ((e) => (e.GITHUB = "github", e.GITEE = "gitee", e))(i || {});
|
|
10
9
|
const P = 1e4, d = Math.random(), $ = {
|
|
11
10
|
timeout: P,
|
|
@@ -19,7 +18,7 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
19
18
|
return e.data;
|
|
20
19
|
},
|
|
21
20
|
businessSuccessCodeList: [d],
|
|
22
|
-
axios:
|
|
21
|
+
axios: N
|
|
23
22
|
}, b = C({
|
|
24
23
|
basePath: " https://gitee.com",
|
|
25
24
|
...$
|
|
@@ -48,8 +47,8 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
48
47
|
url: `/users/${e}/repos`,
|
|
49
48
|
method: "GET"
|
|
50
49
|
}), T = {
|
|
51
|
-
version: "0.3.0-alpha.0",
|
|
52
50
|
name: "@done-coding/cli-git",
|
|
51
|
+
version: "0.3.2-alpha.0",
|
|
53
52
|
description: "git跨平台操作命令行工具",
|
|
54
53
|
cliConfig: {
|
|
55
54
|
namespaceDir: ".done-coding",
|
|
@@ -64,7 +63,7 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
64
63
|
n.warn("配置文件不存在");
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
|
-
const a = `${o}/${r}`, c =
|
|
66
|
+
const a = `${o}/${r}`, c = w.readFileSync(a, "utf-8"), m = I({ encryptedText: c, secretKey: e });
|
|
68
67
|
if (!m) {
|
|
69
68
|
n.warn("配置文件解密失败");
|
|
70
69
|
return;
|
|
@@ -83,14 +82,14 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
83
82
|
{ title: "GitHub", value: i.GITHUB },
|
|
84
83
|
{ title: "Gitee", value: i.GITEE }
|
|
85
84
|
];
|
|
86
|
-
r.platform = (await
|
|
85
|
+
r.platform = (await p({
|
|
87
86
|
type: "select",
|
|
88
87
|
name: "platform",
|
|
89
88
|
message: "选择git平台",
|
|
90
89
|
choices: t
|
|
91
90
|
})).platform;
|
|
92
91
|
}
|
|
93
|
-
s || (r.username = (await
|
|
92
|
+
s || (r.username = (await p({
|
|
94
93
|
type: "text",
|
|
95
94
|
name: "username",
|
|
96
95
|
message: "请输入用户名",
|
|
@@ -105,13 +104,13 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
105
104
|
});
|
|
106
105
|
let g = m == null ? void 0 : m.accessToken;
|
|
107
106
|
n.stage(`正在获取${a}的${o}仓库列表...`);
|
|
108
|
-
const
|
|
107
|
+
const l = {
|
|
109
108
|
username: a,
|
|
110
109
|
accessToken: g
|
|
111
110
|
};
|
|
112
111
|
switch (r.platform) {
|
|
113
112
|
case i.GITHUB: {
|
|
114
|
-
c = (await R(
|
|
113
|
+
c = (await R(l)).data.map((t) => ({
|
|
115
114
|
name: t.name,
|
|
116
115
|
httpUrl: t.clone_url,
|
|
117
116
|
sshUrl: t.ssh_url,
|
|
@@ -120,7 +119,7 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
120
119
|
break;
|
|
121
120
|
}
|
|
122
121
|
case i.GITEE: {
|
|
123
|
-
c = (await (
|
|
122
|
+
c = (await (l.accessToken ? O : x)(l)).data.map((t) => ({
|
|
124
123
|
name: t.name,
|
|
125
124
|
httpUrl: t.html_url,
|
|
126
125
|
sshUrl: t.ssh_url,
|
|
@@ -136,7 +135,7 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
136
135
|
return;
|
|
137
136
|
} else
|
|
138
137
|
n.stage(`共${c.length}个仓库`);
|
|
139
|
-
const { repoUrl: G } = await
|
|
138
|
+
const { repoUrl: G } = await p({
|
|
140
139
|
name: "repoUrl",
|
|
141
140
|
type: "select",
|
|
142
141
|
message: "选择仓库",
|
|
@@ -148,7 +147,7 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
148
147
|
return G;
|
|
149
148
|
}, M = async (e) => {
|
|
150
149
|
const s = await F(e);
|
|
151
|
-
|
|
150
|
+
B(`git clone ${s} 1>&2`), n.success(`克隆${s}成功`);
|
|
152
151
|
}, q = async (e, s) => e === u.CLONE ? M(s) : (n.error(`无效的命令: ${e}`), process.exit(1)), {
|
|
153
152
|
version: j,
|
|
154
153
|
description: J,
|
|
@@ -167,26 +166,28 @@ const P = 1e4, d = Math.random(), $ = {
|
|
|
167
166
|
type: "string"
|
|
168
167
|
}
|
|
169
168
|
},
|
|
170
|
-
handler:
|
|
169
|
+
handler: S(q)(
|
|
170
|
+
u.CLONE
|
|
171
|
+
)
|
|
171
172
|
}, U = {
|
|
172
173
|
describe: J,
|
|
173
174
|
version: j,
|
|
174
|
-
subcommands: [K].map(
|
|
175
|
+
subcommands: [K].map(h),
|
|
175
176
|
demandCommandCount: 1
|
|
176
177
|
}, E = (e = !1) => {
|
|
177
178
|
const s = e ? f : void 0, r = `$0${e ? ` ${f}` : ""} <command> [options]`;
|
|
178
179
|
return { command: s, usage: r };
|
|
179
|
-
},
|
|
180
|
+
}, Z = async () => v({
|
|
180
181
|
...U,
|
|
181
182
|
...E()
|
|
182
|
-
}),
|
|
183
|
+
}), ee = () => h({
|
|
183
184
|
...U,
|
|
184
185
|
...E(!0)
|
|
185
186
|
});
|
|
186
187
|
export {
|
|
187
|
-
|
|
188
|
+
ee as a,
|
|
188
189
|
M as b,
|
|
189
|
-
|
|
190
|
+
Z as c,
|
|
190
191
|
F as g,
|
|
191
192
|
q as h
|
|
192
193
|
};
|
package/es/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as n, g as s, b as g, h as b } from "./index-da471e5e.js";
|
|
3
3
|
import "@done-coding/cli-utils";
|
|
4
4
|
import "@done-coding/request-axios";
|
|
5
5
|
import "axios";
|
|
6
6
|
import "node:fs";
|
|
7
7
|
import "node:path";
|
|
8
8
|
import "node:child_process";
|
|
9
|
-
import "lodash.curry";
|
|
10
9
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
n as crateAsSubcommand,
|
|
11
|
+
s as getTargetRepoUrl,
|
|
12
|
+
g as gitClone,
|
|
13
|
+
b as handler
|
|
15
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/cli-git",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2-alpha.0",
|
|
4
4
|
"description": "git跨平台操作命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"es",
|
|
19
19
|
"lib",
|
|
20
|
-
"types"
|
|
21
|
-
"gif"
|
|
20
|
+
"types"
|
|
22
21
|
],
|
|
23
22
|
"scripts": {
|
|
24
23
|
"clean": "rimraf es lib types",
|
|
@@ -41,9 +40,8 @@
|
|
|
41
40
|
"license": "MIT",
|
|
42
41
|
"sideEffects": false,
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"@done-coding/cli-inject": "^0.5.
|
|
45
|
-
"@types/
|
|
46
|
-
"@types/node": "^16.0.0",
|
|
43
|
+
"@done-coding/cli-inject": "^0.5.1-alpha.0",
|
|
44
|
+
"@types/node": "^18.0.0",
|
|
47
45
|
"@types/yargs": "^17.0.28",
|
|
48
46
|
"rimraf": "^6.0.1",
|
|
49
47
|
"typescript": "^5.2.2",
|
|
@@ -51,13 +49,12 @@
|
|
|
51
49
|
"vite-plugin-dts": "^3.6.0"
|
|
52
50
|
},
|
|
53
51
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
52
|
+
"node": ">=18.0.0"
|
|
55
53
|
},
|
|
56
54
|
"dependencies": {
|
|
57
|
-
"@done-coding/cli-utils": "^0.3.
|
|
55
|
+
"@done-coding/cli-utils": "^0.3.1-alpha.0",
|
|
58
56
|
"@done-coding/request-axios": "^1.1.1",
|
|
59
|
-
"axios": "^1.8.4"
|
|
60
|
-
"lodash.curry": "^4.1.1"
|
|
57
|
+
"axios": "^1.8.4"
|
|
61
58
|
},
|
|
62
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ec6957606bbae68d7268159b38b9d36dab4a2731"
|
|
63
60
|
}
|