create-done-coding 0.7.0 → 0.8.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-8034b5bc.js → index-272eb081.js} +24 -24
- package/es/index.mjs +1 -1
- package/package.json +3 -3
- package/types/injectInfo.json.d.ts +1 -1
package/es/cli.mjs
CHANGED
|
@@ -6,21 +6,21 @@ import u, { existsSync as N, rmSync as d } from "node:fs";
|
|
|
6
6
|
import a from "prompts";
|
|
7
7
|
import { getConfigPath as _, batchHandler as S } from "@done-coding/cli-template";
|
|
8
8
|
import { lookForParentTarget as U } from "@done-coding/node-tools";
|
|
9
|
-
import { getTargetRepoUrl as b } from "@done-coding/cli-git";
|
|
10
|
-
import
|
|
11
|
-
import { hideBin as
|
|
9
|
+
import { getTargetRepoUrl as b, gitCloneCommand as I } from "@done-coding/cli-git";
|
|
10
|
+
import L from "yargs";
|
|
11
|
+
import { hideBin as F } from "yargs/helpers";
|
|
12
12
|
const p = {
|
|
13
|
-
version: "0.
|
|
13
|
+
version: "0.8.0",
|
|
14
14
|
name: "create-done-coding",
|
|
15
15
|
description: "项目创建命令行工具",
|
|
16
16
|
cliConfig: {
|
|
17
17
|
namespaceDir: ".done-coding",
|
|
18
18
|
moduleName: "create"
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, A = "git@gitee.com:justsosu/done-coding-cli-config-json.git", C = "自定义模版路径", j = "某个git平台用户仓库", H = `./.${p.name}_temp`;
|
|
21
21
|
let w;
|
|
22
|
-
const
|
|
23
|
-
...await
|
|
22
|
+
const M = async () => (w || (w = (await B()).templateList), w), $ = async () => [
|
|
23
|
+
...await M(),
|
|
24
24
|
{ name: C },
|
|
25
25
|
{ name: j }
|
|
26
26
|
], R = {
|
|
@@ -36,7 +36,7 @@ const H = async () => (w || (w = (await k()).templateList), w), $ = async () =>
|
|
|
36
36
|
title: i.name,
|
|
37
37
|
value: i.name
|
|
38
38
|
}))
|
|
39
|
-
}),
|
|
39
|
+
}), k = {
|
|
40
40
|
type: "confirm",
|
|
41
41
|
name: "saveGitHistory",
|
|
42
42
|
message: "是否保留git历史",
|
|
@@ -45,17 +45,17 @@ const H = async () => (w || (w = (await k()).templateList), w), $ = async () =>
|
|
|
45
45
|
type: "confirm",
|
|
46
46
|
name: "isRemove",
|
|
47
47
|
message: e
|
|
48
|
-
}),
|
|
48
|
+
}), B = async () => {
|
|
49
49
|
console.log(t.blue("拉取模板列表,请稍等..."));
|
|
50
50
|
const e = g.resolve(
|
|
51
51
|
process.cwd(),
|
|
52
|
-
|
|
52
|
+
H
|
|
53
53
|
);
|
|
54
54
|
if (console.log(t.blue(`配置临时目录:${e}`)), u.existsSync(e)) {
|
|
55
55
|
const o = `${e}目录已存在,是否删除?`, { isRemove: r } = await a(E(o));
|
|
56
56
|
r ? u.rmSync(e, { recursive: !0, force: !0 }) : (console.log(t.red(`${e}已存在,请手动删除后再试!`)), process.exit(1));
|
|
57
57
|
}
|
|
58
|
-
l(`git clone ${
|
|
58
|
+
l(`git clone ${A} ${e} --depth=1`);
|
|
59
59
|
const i = p.name, c = g.resolve(e, `${i}.json`), v = JSON.parse(u.readFileSync(c, "utf-8"));
|
|
60
60
|
if (!Array.isArray(v.templateList))
|
|
61
61
|
throw new Error("远程配置文件出错,templateList 不是数组");
|
|
@@ -134,7 +134,7 @@ const H = async () => (w || (w = (await k()).templateList), w), $ = async () =>
|
|
|
134
134
|
)
|
|
135
135
|
);
|
|
136
136
|
} else {
|
|
137
|
-
if ((await a(
|
|
137
|
+
if ((await a(k)).saveGitHistory)
|
|
138
138
|
l(
|
|
139
139
|
`cd ${r} && git remote rename origin upstream && git fetch --unshallow`
|
|
140
140
|
), console.log(
|
|
@@ -160,7 +160,7 @@ const H = async () => (w || (w = (await k()).templateList), w), $ = async () =>
|
|
|
160
160
|
3. pnpm run dev
|
|
161
161
|
`)
|
|
162
162
|
);
|
|
163
|
-
},
|
|
163
|
+
}, Y = async () => ({
|
|
164
164
|
projectName: {
|
|
165
165
|
type: "string",
|
|
166
166
|
alias: "p",
|
|
@@ -172,22 +172,22 @@ const H = async () => (w || (w = (await k()).templateList), w), $ = async () =>
|
|
|
172
172
|
choices: (await $()).map((e) => e.name),
|
|
173
173
|
describe: (await T()).message
|
|
174
174
|
}
|
|
175
|
-
}), x = p.cliConfig.moduleName,
|
|
175
|
+
}), x = p.cliConfig.moduleName, J = (e, i) => {
|
|
176
176
|
console.log(e ? t.red(e) : t.red(i.message)), process.exit(1);
|
|
177
|
-
},
|
|
178
|
-
const c = await
|
|
179
|
-
return e.strict().usage(i).help("help").version(p.version).alias("v", "version").alias("h", "help").options(c).fail(
|
|
180
|
-
},
|
|
177
|
+
}, q = p.description, z = `Usage: $0 ${x} [options]`, K = "Usage: $0 [options]", D = async (e, i) => {
|
|
178
|
+
const c = await Y();
|
|
179
|
+
return e.strict().usage(i).help("help").version(p.version).alias("v", "version").alias("h", "help").options(c).command(I).fail(J).argv;
|
|
180
|
+
}, Q = (e) => D(e, z), ne = {
|
|
181
181
|
command: x,
|
|
182
|
-
describe:
|
|
183
|
-
builder:
|
|
182
|
+
describe: q,
|
|
183
|
+
builder: Q,
|
|
184
184
|
handler: G
|
|
185
|
-
},
|
|
186
|
-
const e =
|
|
185
|
+
}, ae = async () => {
|
|
186
|
+
const e = L(F(process.argv)), i = await D(e, K);
|
|
187
187
|
return G(i);
|
|
188
188
|
};
|
|
189
189
|
export {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
ne as a,
|
|
191
|
+
ae as c,
|
|
192
192
|
G as h
|
|
193
193
|
};
|
package/es/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-done-coding",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "项目创建命令行工具",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"node": ">=18.0.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@done-coding/cli-git": "^0.
|
|
54
|
+
"@done-coding/cli-git": "^0.2.0",
|
|
55
55
|
"@done-coding/cli-template": "^0.5.1",
|
|
56
56
|
"@done-coding/node-tools": "^0.1.0",
|
|
57
57
|
"chalk": "^5.3.0",
|
|
58
58
|
"prompts": "^2.4.2",
|
|
59
59
|
"yargs": "^17.7.2"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "690833f1f52879f45270df9436742695c0dd3c25"
|
|
62
62
|
}
|