@fxri/swagger2api 1.2.0 → 1.2.2

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 CHANGED
@@ -206,10 +206,10 @@ npx @fxri/swagger2api [--replace-tags,-rt <regexp> <substr>]
206
206
 
207
207
  作者:唐启云 <tqy@fxri.net>
208
208
 
209
- 版权:Copyright © 2025 方弦研究所. All rights reserved.
209
+ 版权:Copyright © 2025-2026 方弦研究所. All rights reserved.
210
210
 
211
211
  网站:[方弦研究信息网](https://fxri.net:444/)
212
212
 
213
213
  协议:[MIT License](./LICENSE)
214
214
 
215
- 商标:"方弦™"为第 42 类商标(注册号 89648411),本开源许可不授予商标使用权,详见 [TRADEMARK.md](./TRADEMARK.md)
215
+ 商标:"方弦®"为第42类注册商标(注册号89648411),本开源许可不授予商标使用权,详见 [TRADEMARK.md](./TRADEMARK.md)
package/dist/cli.js CHANGED
File without changes
@@ -1,32 +1,32 @@
1
- <%
2
- const { utils, config, routes, modelTypes } = it;
3
- const { _, pascalCase } = utils;
4
- const dataContracts = config.modular ? _.map(modelTypes, "name") : [];
5
- %>
6
-
7
- <% if (dataContracts.length) { %>
8
- import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataContracts %>"
9
- <% } %>
10
-
11
- <%
12
- /* TODO: outOfModule, combined should be attributes of route, which will allow to avoid duplication of code */
13
- %>
14
-
15
- <% if (routes.outOfModule) { %>
16
- <% for (const { routes: outOfModuleRoutes = [] } of routes.outOfModule) { %>
17
- <% for (const route of outOfModuleRoutes) { %>
18
- <%~ includeFile('./route-type.ejs', { ...it, route }) %>
19
- <% } %>
20
- <% } %>
21
- <% } %>
22
-
23
- <% if (routes.combined) { %>
24
- <% for (const { routes: combinedRoutes = [], moduleName } of routes.combined) { %>
25
- export namespace <%~ pascalCase(moduleName) %> {
26
- <% for (const route of combinedRoutes) { %>
27
- <%~ includeFile('./route-type.ejs', { ...it, route }) %>
28
- <% } %>
29
- }
30
-
31
- <% } %>
32
- <% } %>
1
+ <%
2
+ const { utils, config, routes, modelTypes } = it;
3
+ const { _, pascalCase } = utils;
4
+ const dataContracts = config.modular ? _.map(modelTypes, "name") : [];
5
+ %>
6
+
7
+ <% if (dataContracts.length) { %>
8
+ import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataContracts %>"
9
+ <% } %>
10
+
11
+ <%
12
+ /* TODO: outOfModule, combined should be attributes of route, which will allow to avoid duplication of code */
13
+ %>
14
+
15
+ <% if (routes.outOfModule) { %>
16
+ <% for (const { routes: outOfModuleRoutes = [] } of routes.outOfModule) { %>
17
+ <% for (const route of outOfModuleRoutes) { %>
18
+ <%~ includeFile('./route-type.ejs', { ...it, route }) %>
19
+ <% } %>
20
+ <% } %>
21
+ <% } %>
22
+
23
+ <% if (routes.combined) { %>
24
+ <% for (const { routes: combinedRoutes = [], moduleName } of routes.combined) { %>
25
+ export namespace <%~ pascalCase(moduleName) %> {
26
+ <% for (const route of combinedRoutes) { %>
27
+ <%~ includeFile('./route-type.ejs', { ...it, route }) %>
28
+ <% } %>
29
+ }
30
+
31
+ <% } %>
32
+ <% } %>
@@ -1,15 +1,15 @@
1
- <%
2
- const { contract, utils } = it;
3
- const { formatDescription, require, _ } = utils;
4
-
5
- %>
6
- <% if (contract.$content.length) { %>
7
- export type <%~ contract.name %> = {
8
- <% for (const field of contract.$content) { %>
9
- <%~ includeFile('./object-field-jsdoc.ejs', { ...it, field }) %>
10
- <%~ field.field %>;
11
- <% } %>
12
- }<%~ utils.isNeedToAddNull(contract) ? ' | null' : ''%>
13
- <% } else { %>
14
- export type <%~ contract.name %> = Record<string, any>;
15
- <% } %>
1
+ <%
2
+ const { contract, utils } = it;
3
+ const { formatDescription, require, _ } = utils;
4
+
5
+ %>
6
+ <% if (contract.$content.length) { %>
7
+ export type <%~ contract.name %> = {
8
+ <% for (const field of contract.$content) { %>
9
+ <%~ includeFile('./object-field-jsdoc.ejs', { ...it, field }) %>
10
+ <%~ field.field %>;
11
+ <% } %>
12
+ }<%~ utils.isNeedToAddNull(contract) ? ' | null' : ''%>
13
+ <% } else { %>
14
+ export type <%~ contract.name %> = Record<string, any>;
15
+ <% } %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fxri/swagger2api",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "基于 swagger-typescript-api,将 Swagger 文档自动转为 TypeScript 格式的 API 文件。",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -16,19 +16,30 @@
16
16
  "README.md",
17
17
  "package.json"
18
18
  ],
19
+ "scripts": {
20
+ "dev": "pnpm build:debug && node ./dist/cli.js",
21
+ "build": "cross-env NODE_ENV=production tsup",
22
+ "build:debug": "cross-env NODE_ENV=development tsup --config tsup.dev.config.ts",
23
+ "release": "pnpm build && pnpm publish",
24
+ "api": "pnpm dev --axios --responses -q -rpi 0 -err",
25
+ "tasks": "toolkit tasks",
26
+ "tasks:archive": "toolkit tasks archive",
27
+ "changeset": "toolkit changelog",
28
+ "version": "toolkit changelog version"
29
+ },
19
30
  "keywords": [
20
31
  "swagger",
21
32
  "typescript",
22
33
  "api"
23
34
  ],
24
35
  "dependencies": {
25
- "axios": "^1.12.2",
36
+ "axios": "^1.20.0",
26
37
  "glob": "^11.0.3",
27
38
  "prompts": "^2.4.2",
28
- "swagger-typescript-api": "^13.2.15"
39
+ "swagger-typescript-api": "^13.12.6"
29
40
  },
30
41
  "devDependencies": {
31
- "@fxri/toolkit": "^1.1.3",
42
+ "@fxri/toolkit": "^1.6.1",
32
43
  "@types/node": "^20.19.21",
33
44
  "@types/prompts": "^2.4.9",
34
45
  "@typescript-eslint/eslint-plugin": "^6.21.0",
@@ -38,9 +49,10 @@
38
49
  "eslint": "^8.57.1",
39
50
  "eslint-config-prettier": "^9.1.2",
40
51
  "eslint-plugin-vue": "^9.33.0",
41
- "tsup": "^8.5.0",
52
+ "tsup": "^8.5.1",
42
53
  "typescript": "^5.9.3"
43
54
  },
55
+ "packageManager": "pnpm@10.34.4",
44
56
  "engines": {
45
57
  "node": ">=20"
46
58
  },
@@ -54,16 +66,5 @@
54
66
  },
55
67
  "bugs": {
56
68
  "url": "https://github.com/fxri-net/swagger2api/issues"
57
- },
58
- "scripts": {
59
- "dev": "pnpm build:debug && node ./dist/cli.js",
60
- "build": "cross-env NODE_ENV=production tsup",
61
- "build:debug": "cross-env NODE_ENV=development tsup --config tsup.dev.config.ts",
62
- "release": "pnpm build && pnpm publish",
63
- "api": "pnpm dev --axios --responses -q -rpi 0 -err",
64
- "tasks": "toolkit tasks",
65
- "tasks:archive": "toolkit tasks archive",
66
- "changeset": "toolkit changelog",
67
- "version": "toolkit changelog version"
68
69
  }
69
- }
70
+ }