@fxri/swagger2api 1.0.11 → 1.0.12

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/dist/index.js CHANGED
@@ -73,11 +73,18 @@ function onGenerate(data) {
73
73
  console.log("就绪:", ...Object.entries(datas.enum).map((item) => item.join("-")));
74
74
  // 保存文档
75
75
  saveFile(datas.file, JSON.stringify(data));
76
+ // 获取移除文件参数
77
+ const rd = getParam(["--remove-d.ts", "-rd"], false);
76
78
  // 生成接口
77
79
  const param = ["generate", "-n", `${confs.param.name}.ts`, "-o", path.resolve(confs.param.output), "-p", datas.file, ...getParamList(false)];
78
80
  console.log("执行:", execSync(`${datas.script} ${param.join(" ")}`, { cwd: datas.home }).toString());
79
81
  // 删除文档
80
82
  fs.unlinkSync(datas.file);
83
+ // 移除使用--js参数时生成的d.ts文件
84
+ if (rd) {
85
+ console.log("移除:", path.resolve(confs.param.output, `${confs.param.name}.d.ts`));
86
+ execSync(`npx rimraf ${path.resolve(confs.param.output, `${confs.param.name}.d.ts`)}`, { cwd: datas.home }).toString();
87
+ }
81
88
  // 保存配置
82
89
  saveFile(confs.file, JSON.stringify(confs.param, null, 4));
83
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fxri/swagger2api",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "基于 swagger-typescript-api,将 Swagger 文档自动转为 TypeScript 格式的 API 文件。",
5
5
  "license": "MIT",
6
6
  "author": {