File tree Expand file tree Collapse file tree 6 files changed +147
-48
lines changed
Expand file tree Collapse file tree 6 files changed +147
-48
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,30 @@ export const fooClient = new OpenapiClientFoo(adapter1);
9494export const barClient = new OpenapiClientBar (adapter2 );
9595```
9696
97+ # 环境变量
98+
99+ 不同运行环境下,可能需要使用不同的服务端,比如开发一套服务,生产一套服务。因此执行指令时可以传入` -env ` 参数
100+
101+ ``` bash
102+ npx foca-openapi --env development
103+ npx foca-openapi --env production
104+ ```
105+
106+ 配置文件使用回调函数的形式接收环境变量,并返回配置
107+
108+ ``` typescript
109+ import { defineConfig } from ' foca-openapi' ;
110+
111+ export default defineConfig ((env ) => {
112+ return {
113+ path:
114+ env === ' production'
115+ ? ' https://api.com/openapi.json'
116+ : ' http://localhost:3000/openapi.json' ,
117+ };
118+ });
119+ ```
120+
97121# 参数
98122
99123### path
Original file line number Diff line number Diff line change 8080 "dependencies" : {
8181 "listr2" : " ^8.2.3" ,
8282 "lodash-es" : " ^4.17.21" ,
83+ "minimist" : " ^1.2.8" ,
8384 "object-to-formdata" : " ^4.5.1" ,
8485 "openapi-types" : " ^12.1.3" ,
8586 "prettier" : " ^3.2.5" ,
8687 "query-string" : " ^9.0.0" ,
8788 "tsx" : " ^4.16.2" ,
88- "yaml" : " ^2.4.5"
89+ "yaml" : " ^2.4.5" ,
90+ "yoctocolors" : " ^2.1.1"
8991 },
9092 "devDependencies" : {
9193 "@aomex/console" : " ^2.0.2" ,
98100 "@release-it/conventional-changelog" : " ^8.0.1" ,
99101 "@tarojs/taro" : " ^3.6.34" ,
100102 "@types/lodash-es" : " ^4.17.12" ,
103+ "@types/minimist" : " ^1.2.5" ,
101104 "@types/node" : " ^20.14.10" ,
102105 "@types/qs" : " ^6.9.15" ,
103106 "@vitest/coverage-v8" : " ^2.0.3" ,
You can’t perform that action at this time.
0 commit comments