Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 移除选项 platform #83

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ App<IAppOption>({
| ----------- | ----- | -------- | --------- | ------------------------------------------------------------------------------------------------------------ |
| 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. |
Expand Down
10 changes: 0 additions & 10 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)")}
Expand All @@ -180,7 +179,6 @@ export const main = async (): Promise<ISwaggerOptions> => {
string: [
"url",
"outDir",
"platform",
"client",
"lang",
"tag",
Expand All @@ -190,7 +188,6 @@ export const main = async (): Promise<ISwaggerOptions> => {
alias: {
h: "help",
o: "outDir",
p: "platform",
l: "lang",
v: "version",
f: "filter",
Expand All @@ -200,7 +197,6 @@ export const main = async (): Promise<ISwaggerOptions> => {
default: {
outDir: "./stc_out",
lang: "ts",
platform: "axios",
client: "axios",
conjunction: "By",
},
Expand Down Expand Up @@ -236,15 +232,9 @@ export const main = async (): Promise<ISwaggerOptions> => {
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,
Expand Down
11 changes: 0 additions & 11 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 - 对象
Expand Down
2 changes: 0 additions & 2 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 0 additions & 2 deletions src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "过滤接口,符合过滤条件的接口会被生成。",
Expand Down
6 changes: 0 additions & 6 deletions src/swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,6 @@ export interface ISwaggerOptions {
* 输出目录。默认:./stc_out
*/
readonly outDir: string;
/**
* @deprecated 请使用 `client`
*
* 平台。默认:axios
*/
readonly platform?: "axios" | "wechat" | "fetch";
/**
* HTTP 请求的客户端。默认:axios
*/
Expand Down