@done-coding/cli-git 0.1.0 → 0.2.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 -1
- package/es/{index-aab45cf7.js → index-20b2b104.js} +29 -26
- package/es/index.mjs +5 -3
- package/package.json +2 -2
- package/types/index.d.ts +2 -2
- package/types/injectInfo.json.d.ts +1 -1
- package/types/main.d.ts +1 -0
- package/types/utils/clone.d.ts +1 -1
package/es/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import s from "chalk";
|
|
3
|
-
import { createRequest as
|
|
3
|
+
import { createRequest as b } from "@done-coding/request-axios";
|
|
4
4
|
import v from "axios";
|
|
5
5
|
import g from "prompts";
|
|
6
6
|
import { lookForParentTarget as G, decryptAES as S } from "@done-coding/node-tools";
|
|
@@ -11,7 +11,7 @@ import I from "yargs";
|
|
|
11
11
|
import { hideBin as N } from "yargs/helpers";
|
|
12
12
|
import _ from "lodash.curry";
|
|
13
13
|
var m = /* @__PURE__ */ ((e) => (e.CLONE = "clone", e))(m || {}), i = /* @__PURE__ */ ((e) => (e.GITHUB = "github", e.GITEE = "gitee", e))(i || {});
|
|
14
|
-
const x = 1e4, f = Math.random(),
|
|
14
|
+
const x = 1e4, f = Math.random(), $ = {
|
|
15
15
|
timeout: x,
|
|
16
16
|
getBusinessCode() {
|
|
17
17
|
return f;
|
|
@@ -24,20 +24,20 @@ const x = 1e4, f = Math.random(), b = {
|
|
|
24
24
|
},
|
|
25
25
|
businessSuccessCodeList: [f],
|
|
26
26
|
axios: v
|
|
27
|
-
},
|
|
27
|
+
}, C = b({
|
|
28
28
|
basePath: " https://gitee.com",
|
|
29
|
-
|
|
30
|
-
}), O =
|
|
29
|
+
...$
|
|
30
|
+
}), O = b({
|
|
31
31
|
basePath: "https://api.github.com",
|
|
32
|
-
|
|
32
|
+
...$
|
|
33
33
|
}), k = ({
|
|
34
34
|
username: e
|
|
35
|
-
}) =>
|
|
35
|
+
}) => C({
|
|
36
36
|
url: `/api/v5/users/${e}/repos`,
|
|
37
37
|
method: "GET"
|
|
38
38
|
}), D = ({
|
|
39
39
|
accessToken: e
|
|
40
|
-
}) =>
|
|
40
|
+
}) => C({
|
|
41
41
|
url: "/api/v5/user/repos",
|
|
42
42
|
method: "GET",
|
|
43
43
|
params: {
|
|
@@ -52,7 +52,7 @@ const x = 1e4, f = Math.random(), b = {
|
|
|
52
52
|
url: `/users/${e}/repos`,
|
|
53
53
|
method: "GET"
|
|
54
54
|
}), u = {
|
|
55
|
-
version: "0.
|
|
55
|
+
version: "0.2.0",
|
|
56
56
|
name: "@done-coding/cli-git",
|
|
57
57
|
description: "git跨平台操作命令行工具",
|
|
58
58
|
cliConfig: {
|
|
@@ -155,35 +155,38 @@ const x = 1e4, f = Math.random(), b = {
|
|
|
155
155
|
}, A = async (e) => {
|
|
156
156
|
const o = await M(e);
|
|
157
157
|
B(`git clone ${o} 1>&2`), console.log(s.green(`克隆${o}成功`));
|
|
158
|
-
}, j = async (e, o) => (console.log("com", o), e === m.CLONE ? A(o) : (console.log(s.red(`无效的命令: ${e}`)), process.exit(1))),
|
|
159
|
-
},
|
|
158
|
+
}, j = async (e, o) => (console.log("com", o), e === m.CLONE ? A(o) : (console.log(s.red(`无效的命令: ${e}`)), process.exit(1))), U = async (e) => {
|
|
159
|
+
}, y = u.cliConfig.moduleName, J = (e, o) => {
|
|
160
160
|
console.log(e ? s.red(e) : s.red(o.message)), process.exit(1);
|
|
161
|
-
}, K = u.description, z = `Usage: $0 ${
|
|
161
|
+
}, K = u.description, z = `Usage: $0 ${y} <command> [options]`, Q = "Usage: $0 <command> [options]", V = {
|
|
162
162
|
command: `${m.CLONE} <platform> <username>`,
|
|
163
|
-
describe: "
|
|
164
|
-
builder: (
|
|
165
|
-
describe: "git平台",
|
|
163
|
+
describe: "从选择的git平台克隆代码",
|
|
164
|
+
builder: (e) => e.positional("platform", {
|
|
165
|
+
describe: "选择git平台",
|
|
166
166
|
type: "string",
|
|
167
167
|
choices: [i.GITHUB, i.GITEE]
|
|
168
168
|
}).positional("username", {
|
|
169
169
|
describe: "git平台用户名",
|
|
170
170
|
type: "string"
|
|
171
171
|
}),
|
|
172
|
+
/** @ts-ignore */
|
|
172
173
|
handler: _(j)(m.CLONE)
|
|
173
|
-
}).demandCommand(1), T = (e, o = !1) => o ? h(e.strict().usage(z)) : h(
|
|
174
|
+
}, h = (e) => e.command(V).demandCommand(1), T = (e, o = !1) => o ? h(e.strict().usage(z)) : h(
|
|
174
175
|
e.strict().usage(Q).help("help").version(u.version).alias("v", "version").alias("h", "help")
|
|
175
|
-
).fail(J).argv,
|
|
176
|
-
command:
|
|
176
|
+
).fail(J).argv, W = (e) => T(e, !0), ie = {
|
|
177
|
+
command: y,
|
|
177
178
|
describe: K,
|
|
178
|
-
builder:
|
|
179
|
-
handler:
|
|
180
|
-
},
|
|
179
|
+
builder: W,
|
|
180
|
+
handler: U
|
|
181
|
+
}, le = async () => {
|
|
181
182
|
const e = I(N(process.argv));
|
|
182
|
-
return await T(e),
|
|
183
|
+
return await T(e), U();
|
|
183
184
|
};
|
|
184
185
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
ie as a,
|
|
187
|
+
M as b,
|
|
188
|
+
le as c,
|
|
189
|
+
A as d,
|
|
190
|
+
V as g,
|
|
191
|
+
U as h
|
|
189
192
|
};
|
package/es/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as C, b, d as h, g as c, h as f } from "./index-20b2b104.js";
|
|
3
3
|
import "chalk";
|
|
4
4
|
import "@done-coding/request-axios";
|
|
5
5
|
import "axios";
|
|
@@ -12,7 +12,9 @@ import "yargs";
|
|
|
12
12
|
import "yargs/helpers";
|
|
13
13
|
import "lodash.curry";
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
C as command,
|
|
16
16
|
b as getTargetRepoUrl,
|
|
17
|
-
|
|
17
|
+
h as gitClone,
|
|
18
|
+
c as gitCloneCommand,
|
|
19
|
+
f as handler
|
|
18
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@done-coding/cli-git",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "git跨平台操作命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"prompts": "^2.4.2",
|
|
64
64
|
"yargs": "^17.7.2"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "690833f1f52879f45270df9436742695c0dd3c25"
|
|
67
67
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { handler } from "./handler";
|
|
2
|
-
export { command } from "./main";
|
|
3
|
-
export { getTargetRepoUrl } from "./utils";
|
|
2
|
+
export { command, gitCloneCommand } from "./main";
|
|
3
|
+
export { getTargetRepoUrl, gitClone } from "./utils";
|
package/types/main.d.ts
CHANGED
package/types/utils/clone.d.ts
CHANGED