@done-coding/cli-extract 0.1.11-alpha.0 → 0.1.11

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-fae67bc6.js";
2
+ import { c as m } from "./index-3b483023.js";
3
3
  import "./index-a1ee6691-8c73eb4d.js";
4
4
  import "@done-coding/cli-utils";
5
5
  import "node:path";
@@ -6,7 +6,7 @@ import y from "node:fs";
6
6
  import { OutputModeEnum as W, batchCompileHandler as H } from "@done-coding/cli-template";
7
7
  const N = {
8
8
  name: "@done-coding/cli-extract",
9
- version: "0.1.11-alpha.0",
9
+ version: "0.1.11",
10
10
  description: "信息提取命令行工具",
11
11
  cliConfig: {
12
12
  namespaceDir: ".done-coding",
@@ -27,7 +27,7 @@ const N = {
27
27
  const { type: a = r.READ } = o;
28
28
  switch (a) {
29
29
  case r.REG: {
30
- const { sourceKey: c, pattern: m, replaceValue: l, flags: f } = o, d = new RegExp(m, f ?? void 0), i = b(e, c);
30
+ const { sourceKey: c, pattern: p, replaceValue: l, flags: f } = o, d = new RegExp(p, f ?? void 0), i = b(e, c);
31
31
  return typeof i == "string" ? i.replace(d, l) : (s.warn(
32
32
  `${i}不是字符串类型,无法使用正则表达式进行替换,此处将直接返回原值`
33
33
  ), i);
@@ -47,7 +47,7 @@ const N = {
47
47
  }
48
48
  }, A = {
49
49
  name: "@done-coding/cli-inject",
50
- version: "0.5.11-alpha.0",
50
+ version: "0.5.11",
51
51
  description: "信息(JSON)注入命令行工具",
52
52
  cliConfig: {
53
53
  namespaceDir: ".done-coding",
@@ -93,7 +93,7 @@ const N = {
93
93
  sourceFilePath: o,
94
94
  keyConfigMap: a,
95
95
  injectFilePath: c
96
- } = n, m = {
96
+ } = n, p = {
97
97
  ...a,
98
98
  ...t
99
99
  };
@@ -101,21 +101,21 @@ const N = {
101
101
  return s.error("源文件必须是json"), process.exit(1);
102
102
  if (!c.endsWith(".json"))
103
103
  return s.error("注入文件必须是json"), process.exit(1);
104
- const l = j.resolve(e, o), f = y.readFileSync(l, "utf-8"), d = JSON.parse(f), i = Object.entries(m).reduce(
104
+ const l = j.resolve(e, o), f = y.readFileSync(l, "utf-8"), d = JSON.parse(f), i = Object.entries(p).reduce(
105
105
  (g, [R, M]) => {
106
106
  const L = C({ sourceJson: d, targetKey: R, keyConfig: M });
107
107
  return V(g, R, L), g;
108
108
  },
109
109
  {}
110
- ), p = j.resolve(e, c), E = JSON.stringify(i, null, 2);
111
- if (y.existsSync(p)) {
112
- const g = y.readFileSync(p, "utf-8");
110
+ ), m = j.resolve(e, c), E = JSON.stringify(i, null, 2);
111
+ if (y.existsSync(m)) {
112
+ const g = y.readFileSync(m, "utf-8");
113
113
  if (E === g)
114
114
  return s.skip("注入文件已存在且内容相同,无需重复注入"), i;
115
115
  s.stage("文件内容变化,开始覆盖注入文件");
116
116
  } else
117
117
  s.stage("开始注入文件");
118
- y.writeFileSync(p, E), s.success(`文件注入成功: ${p}`), s.info(E);
118
+ y.writeFileSync(m, E), s.success(`文件注入成功: ${m}`), s.info(E);
119
119
  }, te = async (e) => {
120
120
  const n = await J(e, () => (s.info("配置文件为空,使用默认配置"), O));
121
121
  if (!n)
@@ -228,16 +228,16 @@ const ie = ({
228
228
  }
229
229
  ]
230
230
  }
231
- }, pe = () => D({
231
+ }, me = () => D({
232
232
  configPathDefault: S
233
233
  }), k = async (e) => v(G, e, {
234
234
  onFileGenerated: () => {
235
235
  s.info("文件生成成功");
236
236
  }
237
- }), me = {
237
+ }), pe = {
238
238
  command: h.INIT,
239
239
  describe: "初始化配置文件",
240
- options: pe(),
240
+ options: me(),
241
241
  handler: k
242
242
  }, le = () => ({
243
243
  ...D({
@@ -255,17 +255,17 @@ const ie = ({
255
255
  config: n
256
256
  }) => {
257
257
  const { extractInput: t, extractOutput: o } = n, a = Object.entries(t).reduce(
258
- (c, [m, l]) => {
258
+ (c, [p, l]) => {
259
259
  const f = ie({
260
260
  rootDir: e,
261
- input: m
261
+ input: p
262
262
  });
263
263
  return Object.entries(l).reduce(
264
- (d, [i, p]) => {
264
+ (d, [i, m]) => {
265
265
  const E = ue({
266
266
  content: f,
267
267
  targetKey: i,
268
- keyConfig: p
268
+ keyConfig: m
269
269
  });
270
270
  return d[i] = E, d;
271
271
  },
@@ -304,7 +304,7 @@ const ie = ({
304
304
  }, { version: ye, description: ge } = N, _ = {
305
305
  describe: ge,
306
306
  version: ye,
307
- subcommands: [me, Ee].map(
307
+ subcommands: [pe, Ee].map(
308
308
  I
309
309
  ),
310
310
  demandCommandCount: 1
@@ -322,7 +322,7 @@ const ie = ({
322
322
  });
323
323
  export {
324
324
  Oe as a,
325
- me as b,
325
+ pe as b,
326
326
  Ne as c,
327
327
  $ as d,
328
328
  Ee as e,
package/es/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as t, a as i, e as s, g as d, d as l, f as p, b as f, h as u } from "./index-fae67bc6.js";
2
+ import { i as t, a as i, e as s, g as d, d as l, f as p, b as f, h as u } from "./index-3b483023.js";
3
3
  import { E as C, G as E, S as b } from "./index-a1ee6691-8c73eb4d.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/cli-extract",
3
- "version": "0.1.11-alpha.0",
3
+ "version": "0.1.11",
4
4
  "description": "信息提取命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -52,7 +52,7 @@
52
52
  "license": "MIT",
53
53
  "sideEffects": false,
54
54
  "devDependencies": {
55
- "@done-coding/cli-inject": "^0.5.11-alpha.0",
55
+ "@done-coding/cli-inject": "^0.5.11",
56
56
  "@types/node": "^18.0.0",
57
57
  "@types/yargs": "^17.0.28",
58
58
  "rimraf": "^6.0.1",
@@ -64,8 +64,8 @@
64
64
  "node": ">=18.0.0"
65
65
  },
66
66
  "dependencies": {
67
- "@done-coding/cli-template": "0.7.11-alpha.0",
68
- "@done-coding/cli-utils": "^0.7.1"
67
+ "@done-coding/cli-template": "0.7.11",
68
+ "@done-coding/cli-utils": "^0.7.2"
69
69
  },
70
- "gitHead": "dcc654349de82facba0b8d58c0001adb18144236"
70
+ "gitHead": "ad322da7f5d0897ee91a399aff9a14b111d62825"
71
71
  }