@fxri/swagger2api 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.swaggerrc CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "url": "http://develop-daggoo-technology.daggoo-k8s.com/backend/pub/v3/api-docs",
3
- "output": "D:\\Work\\Dev-Space\\fxri\\0001.base\\fxri-swagger2api\\src\\api",
3
+ "output": "./src/api",
4
4
  "name": "index"
5
5
  }
package/dist/index.js CHANGED
@@ -27,8 +27,6 @@ if ([confs.param.url, confs.param.output, confs.param.name].includes(undefined))
27
27
  console.log("失败:手动退出");
28
28
  process.exit();
29
29
  }
30
- // 补全路径
31
- confs.param.output = path.resolve(confs.param.output);
32
30
  /** 数据集合 */
33
31
  let datas = {
34
32
  /** 用户目录 */
@@ -67,7 +65,7 @@ function onGenerate(data) {
67
65
  // 保存文档
68
66
  saveFile(datas.file, JSON.stringify(data));
69
67
  // 生成接口
70
- const param = ["generate", "--axios", "-n", `${confs.param.name}.ts`, "-o", confs.param.output, "-p", datas.file, ...datas.param];
68
+ const param = ["generate", "--axios", "-n", `${confs.param.name}.ts`, "-o", path.resolve(confs.param.output), "-p", datas.file, ...datas.param];
71
69
  console.log("执行:", execSync(`${datas.script} ${param.join(" ")}`, { cwd: datas.home }).toString());
72
70
  // 删除文档
73
71
  fs.unlinkSync(datas.file);
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  /** 获取参数 */
4
4
  export function getParam(name) {
5
5
  !Array.isArray(name) && (name = [name]);
6
- const index = process.argv.findIndex((item) => name.includes(item));
6
+ const index = process.argv.findLastIndex((item) => name.includes(item));
7
7
  return index >= 0 ? process.argv[index + 1] : undefined;
8
8
  }
9
9
  /** 保存文件 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fxri/swagger2api",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "基于 swagger-typescript-api,将 Swagger 文档自动转为 TypeScript 格式的 API 文件",
5
5
  "license": "MIT",
6
6
  "author": {