Skip to content

Commit 0a4b99a

Browse files
authored
Merge pull request #123 from long-woo/dev
Dev
2 parents 3452b20 + b250448 commit 0a4b99a

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

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.4/mod.ts'
157-
import { start } from 'jsr:@lonu/stc@^2.14.4'
156+
// import { start } from 'https://deno.land/x/stc@2.14.5/mod.ts'
157+
import { start } from 'jsr:@lonu/stc@^2.14.5'
158158

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

deno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "@lonu/stc",
3-
"version": "2.14.4",
3+
"version": "2.14.5",
44
"exports": "./mod.ts",
55
"tasks": {
66
"pack": "deno run -A src/pack.ts",
77
"dev": "deno task pack && deno run -A --watch=src src/main.ts --url='https://petstore3.swagger.io/api/v3/openapi.json' --lang=js",
88
"serve": "deno run -A --watch=src src/service.ts",
9-
"version": "echo '2.14.4' > release/version",
9+
"version": "echo '2.14.5' > 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/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.4",
3+
"version": "2.14.5",
44
"description": "A tool for converting OpenApi/Swagger/Apifox into code.",
55
"type": "module",
66
"module": "esm/mod.js",

src/plugins/javascript/index.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
IPluginTransformDefinition,
44
} from "../typeDeclaration.ts";
55

6-
import { createFile } from "../../utils.ts";
6+
import { createDiffFile, createFile } from "../../utils.ts";
77
import shared from "../typescript/shared/index.ts";
88
import { TypeScriptPlugin } from "../typescript/index.ts";
99
import { renderEtaString } from "../common.ts";
@@ -52,6 +52,15 @@ export const JavaScriptPlugin: IPlugin = {
5252
};
5353
},
5454
onEnd(options) {
55+
// 创建接口声明文件
56+
actionDeclareData.forEach((item, key) => {
57+
createDiffFile(
58+
`${options.outDir}/${key}.d.ts`,
59+
item,
60+
options.clean,
61+
);
62+
});
63+
5564
if (!options.shared) return;
5665

5766
// 创建运行时需要的文件
@@ -78,13 +87,6 @@ export const JavaScriptPlugin: IPlugin = {
7887
_fetchRuntimeFile.code,
7988
);
8089

81-
// 创建接口声明文件
82-
actionDeclareData.forEach((item, key) => {
83-
createFile(
84-
`${options.outDir}/${key}.d.ts`,
85-
item,
86-
);
87-
});
8890
createFile(
8991
`${options.outDir}/shared/apiClientBase.d.ts`,
9092
_baseFile.declaration ?? "",

0 commit comments

Comments
 (0)