done-coding-template 0.8.10 → 0.9.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/README.md +2 -2
- package/es/cli.mjs +1 -1
- package/es/index.mjs +8 -8
- package/es/{main-8e07f653.js → main-94359b78.js} +12 -12
- package/package.json +4 -4
- package/types/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -264,10 +264,10 @@ node es/cli.mjs --help
|
|
|
264
264
|
|
|
265
265
|
## 许可证
|
|
266
266
|
|
|
267
|
-
MIT © [
|
|
267
|
+
MIT © [done-coding](https://github.com/done-coding)
|
|
268
268
|
|
|
269
269
|
## 相关链接
|
|
270
270
|
|
|
271
271
|
- [主 CLI 工具](https://www.npmjs.com/package/@done-coding/cli)
|
|
272
|
-
- [
|
|
272
|
+
- [Github 仓库](https://github.com/done-coding/done-coding-cli)
|
|
273
273
|
- [更新日志](./CHANGELOG.md)
|
package/es/cli.mjs
CHANGED
package/es/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { M as r } from "./main-
|
|
3
|
-
import { d as f, O as T, S as _, T as h, b as A, a as O, c as b, h as L } from "./main-
|
|
2
|
+
import { M as r } from "./main-94359b78.js";
|
|
3
|
+
import { d as f, O as T, S as _, T as h, b as A, a as O, c as b, h as L } from "./main-94359b78.js";
|
|
4
4
|
import t from "node:path";
|
|
5
5
|
import { existsSync as m } from "node:fs";
|
|
6
6
|
import "@done-coding/cli-utils";
|
|
7
7
|
import "lodash.template";
|
|
8
8
|
import "lodash.assign";
|
|
9
9
|
const E = ({
|
|
10
|
-
rootDir:
|
|
11
|
-
configPath:
|
|
10
|
+
rootDir: o,
|
|
11
|
+
configPath: a = r
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
if (m(
|
|
15
|
-
return
|
|
13
|
+
const e = t.resolve(o, a);
|
|
14
|
+
if (m(e))
|
|
15
|
+
return e;
|
|
16
16
|
};
|
|
17
17
|
export {
|
|
18
18
|
f as MODULE_CONFIG_RELATIVE_PATH,
|
|
@@ -22,7 +22,7 @@ export {
|
|
|
22
22
|
h as TemplateBindKeyEnum,
|
|
23
23
|
A as batchCompileHandler,
|
|
24
24
|
O as compileHandler,
|
|
25
|
-
b as
|
|
25
|
+
b as createAsSubcommand,
|
|
26
26
|
E as getConfigPath,
|
|
27
27
|
L as handler
|
|
28
28
|
};
|
|
@@ -4,9 +4,9 @@ import p from "node:fs";
|
|
|
4
4
|
import { outputConsole as a, xPrompts as A, getConfigFileCommonOptions as P, getUseDefaultConfig as V, initHandlerCommon as W, readConfigFile as G, createSubcommand as S, getRootScriptName as J, createMainCommand as K } from "@done-coding/cli-utils";
|
|
5
5
|
import L from "lodash.template";
|
|
6
6
|
import q from "lodash.assign";
|
|
7
|
-
const
|
|
7
|
+
const N = {
|
|
8
8
|
name: "@done-coding/cli-template",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.9.2-alpha.0",
|
|
10
10
|
description: "预编译命令行工具",
|
|
11
11
|
bin: {
|
|
12
12
|
"dc-template": "es/cli.mjs"
|
|
@@ -17,7 +17,7 @@ const h = {
|
|
|
17
17
|
}
|
|
18
18
|
}, {
|
|
19
19
|
cliConfig: { namespaceDir: z, moduleName: Z }
|
|
20
|
-
} =
|
|
20
|
+
} = N, Q = `./${z}/${Z}`, _ = `${Q}.json`, w = (t, n) => {
|
|
21
21
|
if (!n)
|
|
22
22
|
return a.error(`${t}模式下output不能为空`), process.exit(1);
|
|
23
23
|
}, k = (t, n) => {
|
|
@@ -75,7 +75,7 @@ const x = async (t, { rootDir: n, rollback: s }) => {
|
|
|
75
75
|
mode: ${o}
|
|
76
76
|
rollback: ${s}
|
|
77
77
|
`);
|
|
78
|
-
const
|
|
78
|
+
const h = F({
|
|
79
79
|
rootDir: n,
|
|
80
80
|
filePath: c,
|
|
81
81
|
dataInit: r,
|
|
@@ -83,7 +83,7 @@ rollback: ${s}
|
|
|
83
83
|
filePathKey: "input",
|
|
84
84
|
dataInitKey: "inputData",
|
|
85
85
|
dealMarkdown: D
|
|
86
|
-
}), g = L(
|
|
86
|
+
}), g = L(h), v = typeof E == "function" ? E() : E, l = g(v);
|
|
87
87
|
switch (o) {
|
|
88
88
|
case d.OVERWRITE: {
|
|
89
89
|
w(o, i), k(i, c);
|
|
@@ -310,7 +310,7 @@ rollback: ${s}
|
|
|
310
310
|
validate: (b) => b.length > 0 || `${m}不能为空`
|
|
311
311
|
}))[e];
|
|
312
312
|
}
|
|
313
|
-
const
|
|
313
|
+
const h = $.map((l) => {
|
|
314
314
|
const { envData: e, env: m, input: f, output: b, ...H } = l;
|
|
315
315
|
return m && a.warn(`批量处理中 env:${m} 将被忽略, 只读envData`), {
|
|
316
316
|
...H,
|
|
@@ -327,7 +327,7 @@ rollback: ${s}
|
|
|
327
327
|
rollback: i
|
|
328
328
|
};
|
|
329
329
|
}), g = [];
|
|
330
|
-
for (const l of
|
|
330
|
+
for (const l of h) {
|
|
331
331
|
const e = await x(l, {
|
|
332
332
|
rootDir: c,
|
|
333
333
|
rollback: i
|
|
@@ -398,7 +398,7 @@ rollback: ${s}
|
|
|
398
398
|
} = t, {
|
|
399
399
|
rootDir: D = n.rootDir.default,
|
|
400
400
|
rollbackDelNullFile: E,
|
|
401
|
-
rollbackDelAskAsYes:
|
|
401
|
+
rollbackDelAskAsYes: h,
|
|
402
402
|
dealMarkdown: g,
|
|
403
403
|
rollback: v
|
|
404
404
|
} = C;
|
|
@@ -421,7 +421,7 @@ rollback: ${s}
|
|
|
421
421
|
output: i,
|
|
422
422
|
mode: o,
|
|
423
423
|
rollbackDelNullFile: E,
|
|
424
|
-
rollbackDelAskAsYes:
|
|
424
|
+
rollbackDelAskAsYes: h,
|
|
425
425
|
dealMarkdown: g,
|
|
426
426
|
envData: l
|
|
427
427
|
},
|
|
@@ -446,7 +446,7 @@ rollback: ${s}
|
|
|
446
446
|
default:
|
|
447
447
|
throw new Error(`不支持的命令 ${t}`);
|
|
448
448
|
}
|
|
449
|
-
}, { version: ie, description: le } =
|
|
449
|
+
}, { version: ie, description: le } = N, j = {
|
|
450
450
|
describe: le,
|
|
451
451
|
version: ie,
|
|
452
452
|
subcommands: [
|
|
@@ -455,10 +455,10 @@ rollback: ${s}
|
|
|
455
455
|
re
|
|
456
456
|
].map(S),
|
|
457
457
|
demandCommandCount: 1,
|
|
458
|
-
rootScriptName: J({ packageJson:
|
|
458
|
+
rootScriptName: J({ packageJson: N })
|
|
459
459
|
}, {
|
|
460
460
|
cliConfig: { moduleName: T }
|
|
461
|
-
} =
|
|
461
|
+
} = N, B = (t = !1) => {
|
|
462
462
|
const n = t ? T : void 0, s = `$0${t ? ` ${T}` : ""} <command> [options]`;
|
|
463
463
|
return { command: n, usage: s };
|
|
464
464
|
}, $e = async () => K({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "done-coding-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2-alpha.0",
|
|
4
4
|
"description": "预编译命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"sideEffects": false,
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@done-coding/cli-inject": "0.
|
|
34
|
+
"@done-coding/cli-inject": "0.6.2-alpha.0",
|
|
35
35
|
"@types/lodash.assign": "^4.2.9",
|
|
36
36
|
"@types/lodash.template": "^4.5.3",
|
|
37
37
|
"@types/node": "^18.0.0",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"vite-plugin-dts": "^3.6.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@done-coding/cli-utils": "0.
|
|
44
|
+
"@done-coding/cli-utils": "0.9.2-alpha.0",
|
|
45
45
|
"lodash.assign": "^4.2.0",
|
|
46
46
|
"lodash.template": "^4.5.0"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=18.0.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "74e5c9a43a622ed90e64e8c9a67b110c22c89887",
|
|
52
52
|
"scripts": {}
|
|
53
53
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare interface CompileTemplateConfigListItemRaw {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/** 作为子命令创建 */
|
|
100
|
-
export declare const
|
|
100
|
+
export declare const createAsSubcommand: () => CommandModule<{}, {}>;
|
|
101
101
|
|
|
102
102
|
/** 获取配置文件路径 */
|
|
103
103
|
export declare const getConfigPath: ({ rootDir, configPath, }: ReadConfigFileOptions) => string | undefined;
|