done-coding-inject 0.5.15 → 0.5.17
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-8f7fc8b2.js → index-2755aae8.js} +28 -28
- package/es/index.mjs +1 -1
- package/package.json +4 -4
package/es/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { I as c, S as E } from "./index-a1ee6691.js";
|
|
3
3
|
import { log as o, _get as I, initHandlerCommon as k, getConfigFileCommonOptions as A, _set as w, readConfigFile as T, createSubcommand as N, getRootScriptName as _, createMainCommand as M } from "@done-coding/cli-utils";
|
|
4
|
-
import
|
|
4
|
+
import $ from "node:path";
|
|
5
5
|
import u from "node:fs";
|
|
6
6
|
const x = ({
|
|
7
7
|
sourceJson: e,
|
|
@@ -36,7 +36,7 @@ const x = ({
|
|
|
36
36
|
}
|
|
37
37
|
}, d = {
|
|
38
38
|
name: "@done-coding/cli-inject",
|
|
39
|
-
version: "0.5.
|
|
39
|
+
version: "0.5.17",
|
|
40
40
|
description: "信息(JSON)注入命令行工具",
|
|
41
41
|
bin: {
|
|
42
42
|
"dc-inject": "es/cli.mjs"
|
|
@@ -47,7 +47,7 @@ const x = ({
|
|
|
47
47
|
}
|
|
48
48
|
}, {
|
|
49
49
|
cliConfig: { namespaceDir: G, moduleName: J }
|
|
50
|
-
} = d, L = `./${G}/${J}`, R = `${L}.json`,
|
|
50
|
+
} = d, L = `./${G}/${J}`, R = `${L}.json`, h = {
|
|
51
51
|
sourceFilePath: "./package.json",
|
|
52
52
|
keyConfigMap: {
|
|
53
53
|
name: {
|
|
@@ -64,22 +64,22 @@ const x = ({
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
injectFilePath: "./src/injectInfo.json"
|
|
67
|
-
},
|
|
67
|
+
}, U = () => A({
|
|
68
68
|
configPathDefault: R
|
|
69
69
|
}), S = async (e) => k(h, e, {
|
|
70
70
|
onFileGenerated: () => {
|
|
71
71
|
o.info("文件生成成功");
|
|
72
72
|
}
|
|
73
|
-
}),
|
|
73
|
+
}), V = {
|
|
74
74
|
command: E.INIT,
|
|
75
75
|
describe: "初始化配置文件",
|
|
76
|
-
options:
|
|
76
|
+
options: U(),
|
|
77
77
|
handler: S
|
|
78
|
-
},
|
|
78
|
+
}, H = () => ({
|
|
79
79
|
...A({
|
|
80
80
|
configPathDefault: R
|
|
81
81
|
})
|
|
82
|
-
}),
|
|
82
|
+
}), K = async ({
|
|
83
83
|
rootDir: e = process.cwd(),
|
|
84
84
|
config: n = h,
|
|
85
85
|
keyConfigMap: t = {}
|
|
@@ -96,13 +96,13 @@ const x = ({
|
|
|
96
96
|
return o.error("源文件必须是json"), process.exit(1);
|
|
97
97
|
if (!r.endsWith(".json"))
|
|
98
98
|
return o.error("注入文件必须是json"), process.exit(1);
|
|
99
|
-
const p =
|
|
99
|
+
const p = $.resolve(e, s), g = u.readFileSync(p, "utf-8"), y = JSON.parse(g), i = Object.entries(f).reduce(
|
|
100
100
|
(m, [F, v]) => {
|
|
101
101
|
const P = x({ sourceJson: y, targetKey: F, keyConfig: v });
|
|
102
102
|
return w(m, F, P), m;
|
|
103
103
|
},
|
|
104
104
|
{}
|
|
105
|
-
), l =
|
|
105
|
+
), l = $.resolve(e, r), C = JSON.stringify(i, null, 2);
|
|
106
106
|
if (u.existsSync(l)) {
|
|
107
107
|
const m = u.readFileSync(l, "utf-8");
|
|
108
108
|
if (C === m)
|
|
@@ -116,13 +116,13 @@ const x = ({
|
|
|
116
116
|
if (!n)
|
|
117
117
|
return o.error("配置文件为空"), process.exit(1);
|
|
118
118
|
const { rootDir: t } = e;
|
|
119
|
-
await
|
|
120
|
-
},
|
|
119
|
+
await K({ rootDir: t, config: n });
|
|
120
|
+
}, W = {
|
|
121
121
|
command: "$0",
|
|
122
122
|
describe: "生成文件",
|
|
123
|
-
options:
|
|
123
|
+
options: H(),
|
|
124
124
|
handler: j
|
|
125
|
-
},
|
|
125
|
+
}, Z = async (e, n) => {
|
|
126
126
|
switch (e) {
|
|
127
127
|
case E.INIT:
|
|
128
128
|
return S(n);
|
|
@@ -131,34 +131,34 @@ const x = ({
|
|
|
131
131
|
default:
|
|
132
132
|
return j(n);
|
|
133
133
|
}
|
|
134
|
-
}, { version:
|
|
135
|
-
describe:
|
|
136
|
-
version:
|
|
137
|
-
subcommands: [
|
|
134
|
+
}, { version: X, description: q } = d, b = {
|
|
135
|
+
describe: q,
|
|
136
|
+
version: X,
|
|
137
|
+
subcommands: [V, W].map(
|
|
138
138
|
N
|
|
139
139
|
),
|
|
140
140
|
demandCommandCount: 1,
|
|
141
141
|
rootScriptName: _({ packageJson: d })
|
|
142
142
|
}, {
|
|
143
|
-
cliConfig: { moduleName:
|
|
143
|
+
cliConfig: { moduleName: D }
|
|
144
144
|
} = d, O = (e = !1) => {
|
|
145
|
-
const n = e ?
|
|
145
|
+
const n = e ? D : void 0, t = `$0${e ? ` ${D}` : ""} <command> [options]`;
|
|
146
146
|
return { command: n, usage: t };
|
|
147
|
-
},
|
|
147
|
+
}, ee = async () => M({
|
|
148
148
|
...b,
|
|
149
149
|
...O()
|
|
150
|
-
}),
|
|
150
|
+
}), ne = () => N({
|
|
151
151
|
...b,
|
|
152
152
|
...O(!0)
|
|
153
153
|
});
|
|
154
154
|
export {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
ne as a,
|
|
156
|
+
V as b,
|
|
157
|
+
ee as c,
|
|
158
158
|
j as d,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
W as e,
|
|
160
|
+
Z as f,
|
|
161
|
+
K as g,
|
|
162
162
|
S as h,
|
|
163
163
|
b as i,
|
|
164
164
|
x as k
|
package/es/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as r, a as i, e as s, g as t, d, f as l, b as f, h as p, k as C } from "./index-
|
|
2
|
+
import { i as r, a as i, e as s, g as t, d, f as l, b as f, h as p, k as C } from "./index-2755aae8.js";
|
|
3
3
|
import { I as g, S as u } from "./index-a1ee6691.js";
|
|
4
4
|
import "@done-coding/cli-utils";
|
|
5
5
|
import "node:path";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "done-coding-inject",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17",
|
|
4
4
|
"description": "信息(JSON)注入命令行工具",
|
|
5
5
|
"private": false,
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|
|
34
|
-
"url": "https://gitee.com/
|
|
34
|
+
"url": "https://gitee.com/done-coding/done-coding-cli.git",
|
|
35
35
|
"directory": "packages/inject"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"node": ">=18.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@done-coding/cli-utils": "
|
|
56
|
+
"@done-coding/cli-utils": "0.7.7"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "60699aec488072491ef8643fafa9ffc4bdce48c3",
|
|
59
59
|
"scripts": {}
|
|
60
60
|
}
|