done-coding-template 0.8.0-alpha.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.mjs +2 -2
- package/es/{main-bd31ea48.js → main-85d64057.js} +12 -12
- package/package.json +4 -4
package/es/cli.mjs
CHANGED
package/es/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-85d64057.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-85d64057.js";
|
|
4
4
|
import t from "node:path";
|
|
5
5
|
import { existsSync as m } from "node:fs";
|
|
6
6
|
import "@done-coding/cli-utils";
|
|
@@ -4,9 +4,9 @@ import p from "node:fs";
|
|
|
4
4
|
import { log 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 h = {
|
|
8
8
|
name: "@done-coding/cli-template",
|
|
9
|
-
version: "0.8.0
|
|
9
|
+
version: "0.8.0",
|
|
10
10
|
description: "预编译命令行工具",
|
|
11
11
|
bin: {
|
|
12
12
|
"dc-template": "es/cli.mjs"
|
|
@@ -17,7 +17,7 @@ const N = {
|
|
|
17
17
|
}
|
|
18
18
|
}, {
|
|
19
19
|
cliConfig: { namespaceDir: z, moduleName: Z }
|
|
20
|
-
} =
|
|
20
|
+
} = h, 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 N = 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(N), 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 N = $.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 N) {
|
|
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: N,
|
|
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: N,
|
|
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 } = h, 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: h })
|
|
459
459
|
}, {
|
|
460
460
|
cliConfig: { moduleName: T }
|
|
461
|
-
} =
|
|
461
|
+
} = h, 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.8.0
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "预编译命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"sideEffects": false,
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@done-coding/cli-inject": "^0.5.13
|
|
33
|
+
"@done-coding/cli-inject": "^0.5.13",
|
|
34
34
|
"@types/lodash.assign": "^4.2.9",
|
|
35
35
|
"@types/lodash.template": "^4.5.3",
|
|
36
36
|
"@types/node": "^18.0.0",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"node": ">=18.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@done-coding/cli-utils": "^0.7.4
|
|
47
|
+
"@done-coding/cli-utils": "^0.7.4",
|
|
48
48
|
"lodash.assign": "^4.2.0",
|
|
49
49
|
"lodash.template": "^4.5.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "9b52d0d18f2b0f7e0498a8ef4dbd4a4c5fcd1ddf",
|
|
52
52
|
"scripts": {}
|
|
53
53
|
}
|