@done-coding/cli-inject 0.3.0 → 0.4.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.
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  const n = {
3
- version: "0.3.0",
3
+ version: "0.4.0",
4
4
  name: "@done-coding/cli-inject",
5
5
  description: "信息注入命令行工具",
6
6
  cliConfig: {
7
7
  namespaceDir: ".done-coding",
8
- commandName: "inject"
8
+ moduleName: "inject"
9
9
  }
10
10
  };
11
11
  export {
package/es/main.mjs CHANGED
@@ -2,8 +2,8 @@
2
2
  import c from "yargs";
3
3
  import { hideBin as l } from "yargs/helpers";
4
4
  import { handler as i } from "./handler.mjs";
5
- import s from "chalk";
6
- import n from "./injectInfo.json.mjs";
5
+ import n from "chalk";
6
+ import s from "./injectInfo.json.mjs";
7
7
  const m = () => ({
8
8
  sourceJsonFilePath: {
9
9
  type: "string",
@@ -23,18 +23,18 @@ const m = () => ({
23
23
  describe: "注入信息文件路径",
24
24
  default: "./src/injectInfo.json"
25
25
  }
26
- }), t = n.cliConfig.commandName, d = (e, o) => {
27
- console.log(e ? s.red(e) : s.red(o.message)), process.exit(1);
28
- }, p = n.description, g = `Usage: $0 ${t} [options]`, f = "Usage: $0 [options]", a = (e, o) => {
29
- const r = m();
30
- return e.strict().usage(o).help("help").version(n.version).alias("v", "version").alias("h", "help").options(r).fail(d).argv;
31
- }, h = (e) => a(e, g), C = {
26
+ }), t = s.cliConfig.moduleName, d = (e, o) => {
27
+ console.log(e ? n.red(e) : n.red(o.message)), process.exit(1);
28
+ }, p = s.description, g = `Usage: $0 ${t} [options]`, f = "Usage: $0 [options]", r = (e, o) => {
29
+ const a = m();
30
+ return e.strict().usage(o).help("help").version(s.version).alias("v", "version").alias("h", "help").options(a).fail(d).argv;
31
+ }, u = (e) => r(e, g), C = {
32
32
  command: t,
33
33
  describe: p,
34
- builder: h,
34
+ builder: u,
35
35
  handler: i
36
36
  }, k = async () => {
37
- const e = c(l(process.argv)), o = await a(e, f);
37
+ const e = c(l(process.argv)), o = await r(e, f);
38
38
  return i(o);
39
39
  };
40
40
  export {
package/es/use.mjs ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { handler as o } from "./handler.mjs";
3
+ const c = (n = [
4
+ "version",
5
+ "name",
6
+ "description",
7
+ "name:cliConfig.namespaceDir:VALUE:.done-coding",
8
+ `name:cliConfig.moduleName:REG:${/@done-coding\/cli-([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)/.source}:$1`
9
+ ]) => {
10
+ o({
11
+ sourceJsonFilePath: "./package.json",
12
+ injectKeyPath: n,
13
+ injectInfoFilePath: "./src/injectInfo.json"
14
+ });
15
+ };
16
+ export {
17
+ c as injectDoneCodingCliInfo
18
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-inject",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "信息注入命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -12,6 +12,17 @@
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": "./es/index.mjs"
15
+ },
16
+ "./use": {
17
+ "import": "./es/use.mjs",
18
+ "types": "./types/use.d.ts"
19
+ }
20
+ },
21
+ "typesVersions": {
22
+ "*": {
23
+ "use": [
24
+ "./types/use.d.ts"
25
+ ]
15
26
  }
16
27
  },
17
28
  "files": [
@@ -43,7 +54,7 @@
43
54
  "devDependencies": {
44
55
  "@types/lodash.get": "^4.4.9",
45
56
  "@types/lodash.set": "^4.3.9",
46
- "@types/node": "^20.0.0",
57
+ "@types/node": "^18.0.0",
47
58
  "@types/prompts": "^2.4.6",
48
59
  "@types/yargs": "^17.0.28",
49
60
  "rimraf": "^6.0.1",
@@ -52,7 +63,7 @@
52
63
  "vite-plugin-dts": "^3.6.0"
53
64
  },
54
65
  "engines": {
55
- "node": ">=16.0.0"
66
+ "node": ">=18.0.0"
56
67
  },
57
68
  "dependencies": {
58
69
  "chalk": "^5.3.0",
@@ -61,5 +72,5 @@
61
72
  "prompts": "^2.4.2",
62
73
  "yargs": "^17.7.2"
63
74
  },
64
- "gitHead": "0e9dcf532b8abf7608d07f738348538fa9a9864d"
75
+ "gitHead": "b3311b79a55322e4689718d59c072388e2866e17"
65
76
  }
@@ -1,10 +1,10 @@
1
1
  declare const _default: {
2
- "version": "0.3.0",
2
+ "version": "0.4.0",
3
3
  "name": "@done-coding/cli-inject",
4
4
  "description": "信息注入命令行工具",
5
5
  "cliConfig": {
6
6
  "namespaceDir": ".done-coding",
7
- "commandName": "inject"
7
+ "moduleName": "inject"
8
8
  }
9
9
  };
10
10
 
package/types/use.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * done-coding cli信息注入
3
+ * ---
4
+ * 从 package.json 中注入 done-coding-cli 信息
5
+ */
6
+ export declare const injectDoneCodingCliInfo: (injectKeyPath?: string[]) => void;