@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/README.md +9 -3
- package/dist/api/index.d.ts +1217 -1217
- package/dist/api/index.js +1214 -1214
- package/dist/index.js +7 -0
- package/package.json +1 -1
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
|
}
|