From ac682a62558af25b02acf56ad2c71b4616445b44 Mon Sep 17 00:00:00 2001 From: "loong.woo" Date: Tue, 8 Oct 2024 17:50:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E9=80=89=E9=A1=B9=20?= =?UTF-8?q?platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - src/cli.ts | 10 ---------- src/common.ts | 11 ----------- src/i18n/locales/en.json | 2 -- src/i18n/locales/zh-CN.json | 2 -- src/swagger.ts | 6 ------ 6 files changed, 32 deletions(-) diff --git a/README.md b/README.md index 37e129e..e102576 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,6 @@ App({ | ----------- | ----- | -------- | --------- | ------------------------------------------------------------------------------------------------------------ | | url | | string | | Swagger/OpenApi/Apifox document address, or local path. | | outDir | o | string | ./stc_out | Output Directory. | -| ~~platform~~| p | string | axios | Platform, optional values: `axios`, `wechat`. **Will be deprecated soon, please use `client`.** | | client | | string | axios | http request client. When `lang` is `ts/js`, the possible values ​​are: `axios`, `wechat`, `fetch`. | | lang | l | string | ts | Language, used for output file suffix. | | tag | | number | | Specify the tag from the interface url. By default, the first tag is read for the file name. | diff --git a/src/cli.ts b/src/cli.ts index 751d747..b3594cf 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -155,7 +155,6 @@ ${getT("$t(cli.option)")} -h, --help ${getT("$t(cli.option_help)")} --url ${getT("$t(cli.option_url)")} -o, --outDir ${getT("$t(cli.option_out)", { out: "./stc_out" })} - -p, --platform ${getT("$t(cli.option_platform)")} --client ${getT("$t(cli.option_client)")} -l, --lang ${getT("$t(cli.option_lang)")} -f, --filter ${getT("$t(cli.option_filter)")} @@ -180,7 +179,6 @@ export const main = async (): Promise => { string: [ "url", "outDir", - "platform", "client", "lang", "tag", @@ -190,7 +188,6 @@ export const main = async (): Promise => { alias: { h: "help", o: "outDir", - p: "platform", l: "lang", v: "version", f: "filter", @@ -200,7 +197,6 @@ export const main = async (): Promise => { default: { outDir: "./stc_out", lang: "ts", - platform: "axios", client: "axios", conjunction: "By", }, @@ -236,15 +232,9 @@ export const main = async (): Promise => { printHelp(); } - if (args.platform !== "axios") { - Logs.warn(getT("$t(cli.deprecatedOptionPlatform)")); - args.client = args.platform; - } - return { url: args.url, outDir: args.outDir, - platform: args.platform, client: args.client, lang: args.lang, tag: args.tag, diff --git a/src/common.ts b/src/common.ts index c603d2b..282688e 100644 --- a/src/common.ts +++ b/src/common.ts @@ -122,17 +122,6 @@ export const getRefType = (ref: string) => true, ); -/** - * 属性注释 - * @param commit - 注释 - */ -export const propCommit = (commit: string) => - commit - ? `\t/** -\t * ${commit} -\t */\n\t` - : "\t"; - /** * 根据值获取对象的 key * @param obj - 对象 diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 666579e..d4e37e4 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -28,14 +28,12 @@ "latestVersion": "Already the latest version.", "unknownOption": "Unknown option: {{arg}}.", "requiredUrl": "The option url must be provided.", - "deprecatedOptionPlatform": "The platform option has been deprecated. Please use the --client option.", "usage": "Use:", "option": "Options:", "example": "Example:", "option_help": "View help information.", "option_url": "Remote address or local file path.", "option_out": "The output directory, the default is {{out}} under the current execution directory of stc.", - "option_platform": "**Deprecated** Platform, optional values: axios, wechat, [default: \"axios\"].", "option_client": "http request client. When `lang` is `ts/js`, the possible values ​​are: `axios`, `wechat`, `fetch`.", "option_lang": "Language, the suffix used for the output file, [default: \"ts\"].", "option_filter": "Filter interfaces, and the interfaces that meet the filter conditions will be generated.", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 3b6b8a2..d61e386 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -28,14 +28,12 @@ "latestVersion": "已经是最新版本。", "unknownOption": "未知选项: {{arg}}。", "requiredUrl": "必须提供选项 url。", - "deprecatedOptionPlatform": "平台选项已被弃用。请使用 --client 选项。", "usage": "使用:", "option": "选项:", "example": "示例:", "option_help": "查看帮助信息。", "option_url": "远程地址或本地文件路径。", "option_out": "输出目录,默认为 stc 当前执行的目录下 {{out}}。", - "option_platform": "**已废弃** 平台,可选值:axios、wechat, [默认: \"axios\"]。", "option_client": "http 请求客户端。 当 lang 为 ts/js 时,可选值:axios、wechat、fetch。", "option_lang": "语言,用于输出文件的后缀名, [默认: \"ts\"]。", "option_filter": "过滤接口,符合过滤条件的接口会被生成。", diff --git a/src/swagger.ts b/src/swagger.ts index 7afe5aa..7e92e3a 100644 --- a/src/swagger.ts +++ b/src/swagger.ts @@ -304,12 +304,6 @@ export interface ISwaggerOptions { * 输出目录。默认:./stc_out */ readonly outDir: string; - /** - * @deprecated 请使用 `client` - * - * 平台。默认:axios - */ - readonly platform?: "axios" | "wechat" | "fetch"; /** * HTTP 请求的客户端。默认:axios */