Skip to content

Commit a8de249

Browse files
authored
Merge pull request #118 from long-woo/dev
release: v2.14.2
2 parents d52c0a5 + 604772a commit a8de249

File tree

20 files changed

+108
-86
lines changed

20 files changed

+108
-86
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_call:
55

66
pull_request:
7-
branches: ['master']
7+
branches: ['master', 'main']
88

99
jobs:
1010
check:

.github/workflows/deno-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Publish to release
1010

1111
on:
1212
push:
13-
branches: ['master']
13+
branches: ['master', 'main']
1414
paths:
1515
- deno.json
1616

.github/workflows/npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Publish Package to npmjs
22

33
on:
44
push:
5-
branches: ['master']
5+
branches: ['master', 'main']
66
paths:
77
- src/npm/pkg.json
88

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ Create a `myPlugin.ts` file:
153153

154154
```ts
155155
// 引用模块
156-
// import { start } from 'https://deno.land/x/stc@2.14.1/mod.ts'
157-
import { start } from 'jsr:@lonu/stc@^2.14.1'
156+
// import { start } from 'https://deno.land/x/stc@2.14.2/mod.ts'
157+
import { start } from 'jsr:@lonu/stc@^2.14.2'
158158

159159
// Defining plugins
160160
const myPlugin: IPlugin = {

deno.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "@lonu/stc",
3-
"version": "2.14.1",
3+
"version": "2.14.2",
44
"exports": "./mod.ts",
55
"tasks": {
66
"pack": "deno run -A src/pack.ts",
7-
"dev": "deno task pack && deno run -A --watch=src src/main.ts --url='https://petstore3.swagger.io/api/v3/openapi.json'",
7+
"dev": "deno task pack && deno run -A --watch=src src/main.ts --url='https://petstore3.swagger.io/api/v3/openapi.json' --lang=swift",
88
"serve": "deno run -A --watch=src src/service.ts",
9-
"version": "echo '2.14.1' > release/version",
9+
"version": "echo '2.14.2' > release/version",
1010
"build:npm": "deno run -A src/npm/build.ts",
1111
"build:mac": "deno compile -A --target x86_64-apple-darwin --output release/stc src/main.ts",
1212
"build:mac-m": "deno compile -A --target aarch64-apple-darwin --output release/stc-m src/main.ts",

src/app.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ export const start = async (options: DefaultConfigOptions): Promise<void> => {
148148
});
149149

150150
console.log("\n");
151-
Logs.success(`${getT("$t(app.generateFileDone)")}\n\t${options.outDir}\n`);
151+
Logs.success(
152+
`${
153+
getT("$t(app.generateFileDone)", { total: actionData.size })
154+
}\n\t${options.outDir}\n`,
155+
);
152156
// 触发插件 onEnd 事件
153157
context.onEnd?.(context.options);
154158
};

src/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const getVirtualProperties = (
126126

127127
// 如果 ref 的自定义类型为基础类型,且 type 为空
128128
if (
129-
!type && !defs[refName].type.includes("object") &&
129+
!type && defs[refName] && !defs[refName].type.includes("object") &&
130130
!defs[refName].enum?.length
131131
) {
132132
type = defs[refName].type;

src/i18n/locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
},
1515
"path": {
1616
"notName": "{{url}} [{{method}}] cannot get the method name, so it will be ignored.",
17-
"duplicate": "{{url}} [{{method}}] has the same method name {{name}}, you can set the `--actionIndex` option."
17+
"duplicate": "{{url}} [{{method}}] has the same method name {{name}}, you can set the `--actionIndex` option, or add `operationId` for each method."
1818
},
1919
"app": {
2020
"apiJsonFileError": "API file parsing failed. Reason: {{error}}",
21-
"generateFileDone": "API file is generated:"
21+
"generateFileDone": "API file is generated ({{total}} apis):"
2222
},
2323
"cli": {
2424
"checkUpdate": "Check for updates",

src/i18n/locales/zh-CN.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
},
1515
"path": {
1616
"notName": "{{url}} 【{{method}}】 无法获取方法名称,故忽略。",
17-
"duplicate": "{{url}} 【{{method}}】 的 {{name}} 方法名重复,可设置 `--actionIndex` 选项。"
17+
"duplicate": "{{url}} 【{{method}}】 的 {{name}} 方法名重复,可设置 `--actionIndex` 选项,或者为每个方法添加 `operationId`"
1818
},
1919
"app": {
2020
"apiJsonFileError": "API 文件解析失败。原因:{{error}}",
21-
"generateFileDone": "API 文件生成完成:"
21+
"generateFileDone": "API 文件生成完成(共 {{total}} 个接口)"
2222
},
2323
"cli": {
2424
"checkUpdate": "检查更新",

src/npm/pkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lonu/stc",
3-
"version": "2.14.1",
3+
"version": "2.14.2",
44
"description": "A tool for converting OpenApi/Swagger/Apifox into code.",
55
"type": "module",
66
"module": "esm/mod.js",

0 commit comments

Comments
 (0)