ol-base-components 2.1.5 → 2.1.7
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/package.json +2 -2
- package/src/api/{runApi.js → api.js} +7 -4
- package/src/api/run.js +8 -2
- package/src/package/index.js +0 -4
- package/src/globalData.js +0 -7
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ol-base-components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "src/package/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"run": "src/api/run.js",
|
|
8
|
-
"runApi": "src/api/
|
|
8
|
+
"runApi": "src/api/api.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"serve": "vue-cli-service serve --no-verify",
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
const fs = require("fs");
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const SwaggerClient = require("swagger-client");
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
// eg:node api http://220.179.249.140:20019 ./modules
|
|
7
7
|
|
|
8
8
|
// const swaggerUrl = "http://220.179.249.140:20019/swagger/v1/swagger.json";
|
|
9
|
-
const swaggerUrl =
|
|
10
|
-
|
|
9
|
+
const swaggerUrl = process.argv[2]
|
|
10
|
+
? `${process.argv[2]}/swagger/v1/swagger.json`
|
|
11
|
+
: "";
|
|
12
|
+
const modulesDir = process.argv[3] ? process.argv[3] : "src/api/modules";
|
|
13
|
+
// process.argv[3] || "src/api/modules" || path.join(__dirname, "./modules");
|
|
11
14
|
|
|
12
15
|
SwaggerClient(swaggerUrl)
|
|
13
16
|
.then((client) => {
|
package/src/api/run.js
CHANGED
|
@@ -3,7 +3,13 @@ const http = require("http");
|
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// eg:node api http://220.179.249.140:20019 swagger.js
|
|
7
|
+
|
|
8
|
+
// const swaggerUrl = "http://220.179.249.140:20019/swagger/v1/swagger.json";
|
|
9
|
+
const swaggerUrl = process.argv[2]
|
|
10
|
+
? `${process.argv[2]}/swagger/v1/swagger.json`
|
|
11
|
+
: "";
|
|
12
|
+
const outputPath = process.argv[3] || path.join(__dirname, "swagger.js");
|
|
7
13
|
|
|
8
14
|
http
|
|
9
15
|
.get(swaggerUrl, (response) => {
|
|
@@ -20,7 +26,7 @@ http
|
|
|
20
26
|
const apiEndpoints = generateApiModules(swaggerData);
|
|
21
27
|
|
|
22
28
|
// 输出到文件
|
|
23
|
-
const outputPath = path.join(__dirname, "swagger.js");
|
|
29
|
+
// const outputPath = path.join(__dirname, "swagger.js");
|
|
24
30
|
fs.writeFileSync(outputPath, apiEndpoints, "utf-8");
|
|
25
31
|
console.log(`API地址对象已生成并保存到 ${outputPath}`);
|
|
26
32
|
});
|
package/src/package/index.js
CHANGED
|
@@ -2,7 +2,6 @@ import OlTable from "./table";
|
|
|
2
2
|
import OlSearch from "./formSearch";
|
|
3
3
|
import Dialog from "./dialog";
|
|
4
4
|
import SwaggerClient from "swagger-client";
|
|
5
|
-
import globalData from "../globalData";
|
|
6
5
|
|
|
7
6
|
const consoleTooltip = () => {
|
|
8
7
|
// 定义颜色和样式
|
|
@@ -192,9 +191,6 @@ const install = async function (
|
|
|
192
191
|
outputDir: "",
|
|
193
192
|
}
|
|
194
193
|
) {
|
|
195
|
-
if (options && options.swaggerUrl) globalData.swaggerUrl = options.swaggerUrl;
|
|
196
|
-
if (options && options.outputDir) globalData.outputDir = options.outputDir;
|
|
197
|
-
|
|
198
194
|
// 设置全局数据
|
|
199
195
|
components.map((item) => {
|
|
200
196
|
Vue.component(`ol-${item.name}`, item);
|