ol-base-components 2.2.6 → 2.2.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api/api.js +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/api/api.js CHANGED
@@ -29,11 +29,23 @@ SwaggerClient(swaggerUrl)
29
29
  fs.writeFileSync(outputPath, apiModules[fileName], "utf-8");
30
30
  console.log(`API接口已生成并保存到 ${outputPath}`);
31
31
  });
32
+
33
+ // 生成index.js入口文件
34
+ createIndexFile(apiModules);
32
35
  })
33
36
  .catch((err) => {
34
37
  console.error("获取 Swagger 数据时出错:", err);
35
38
  });
36
39
 
40
+ function createIndexFile(apiModules) {
41
+ let str = "";
42
+ Object.keys(apiModules).forEach((fileName) => {
43
+ str += `export * from "./${fileName}";\n`;
44
+ });
45
+ const outputPath = path.join(modulesDir, `index.js`);
46
+ fs.writeFileSync(outputPath, str, "utf-8");
47
+ }
48
+
37
49
  // url转成键名规则
38
50
  function generateKeyName(url, method) {
39
51
  // 移除前缀 "/api/app"