ol-base-components 2.3.3 → 2.4.0
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 +2 -2
- package/package.json +1 -1
- package/src/api/api.js +4 -2
- package/src/api/run.js +3 -3
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ npx run http://192.168.xxx.xxx [outputPath]
|
|
|
103
103
|
|
|
104
104
|

|
|
105
105
|
|
|
106
|
-
### 3 `init.js` 命令(推荐)
|
|
106
|
+
### 3. `init.js` 命令(推荐)
|
|
107
107
|
|
|
108
108
|
`init.js` 就是同时执行 api.js 和 run.js 的命令。生成的文件路径为默认路径(不支持自定义输出路径)
|
|
109
109
|
|
|
@@ -112,7 +112,7 @@ npx run http://192.168.xxx.xxx [outputPath]
|
|
|
112
112
|
npx init http://192.168.xxx.xxx:20019
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
### 4 `add.js` 命令
|
|
115
|
+
### 4. `add.js` 命令
|
|
116
116
|
|
|
117
117
|
`add.js` 脚本用于创建新的模块。它会根据提供的模块名称在指定路径下生成一个新的文件夹,并在其中创建一个 Vue 组件文件。
|
|
118
118
|
|
package/package.json
CHANGED
package/src/api/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
const fs = require("fs");
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const SwaggerClient = require("swagger-client");
|
|
@@ -149,7 +149,9 @@ const generateApiModules = (swagger) => {
|
|
|
149
149
|
const apiModules = {};
|
|
150
150
|
// 初始化模块对象
|
|
151
151
|
tags.forEach((tag) => {
|
|
152
|
-
apiModules[
|
|
152
|
+
apiModules[
|
|
153
|
+
tag.name
|
|
154
|
+
] = `${defaultRemark}import { api } from "@/api/request/sendRuest"\n`;
|
|
153
155
|
});
|
|
154
156
|
|
|
155
157
|
for (const [url, methods] of Object.entries(paths)) {
|
package/src/api/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
const http = require("http");
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
@@ -24,9 +24,9 @@ const spinner = setInterval(() => {
|
|
|
24
24
|
// 设置文件为只读权限
|
|
25
25
|
function setFileReadOnly(filePath) {
|
|
26
26
|
try {
|
|
27
|
+
const stats = fs.statSync(filePath);
|
|
27
28
|
// 设置只读权限 (444: 所有者、组、其他用户都只有读权限)
|
|
28
29
|
fs.chmodSync(filePath, 0o444);
|
|
29
|
-
console.log(`🔒 已设置文件为只读: ${filePath}`);
|
|
30
30
|
} catch (error) {
|
|
31
31
|
console.warn(`⚠️ 设置文件权限失败: ${filePath}`, error.message);
|
|
32
32
|
}
|
|
@@ -51,7 +51,7 @@ http
|
|
|
51
51
|
fs.writeFileSync(outputPath, apiEndpoints, "utf-8");
|
|
52
52
|
clearInterval(spinner);
|
|
53
53
|
process.stdout.write("\r");
|
|
54
|
-
console.log(`API地址对象已生成并保存到 ${outputPath}
|
|
54
|
+
console.log(`API地址对象已生成并保存到 ${outputPath}(只读)`);
|
|
55
55
|
// 设置文件为只读
|
|
56
56
|
setFileReadOnly(outputPath);
|
|
57
57
|
});
|