ol-base-components 2.3.3 → 2.4.1

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 CHANGED
@@ -103,7 +103,7 @@ npx run http://192.168.xxx.xxx [outputPath]
103
103
 
104
104
  ![Local demo](./src/assets/run.png "Local demo")
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-base-components",
3
- "version": "2.3.3",
3
+ "version": "2.4.1",
4
4
  "private": false,
5
5
  "main": "src/package/index.js",
6
6
  "bin": {
package/src/api/api.js CHANGED
@@ -149,7 +149,9 @@ const generateApiModules = (swagger) => {
149
149
  const apiModules = {};
150
150
  // 初始化模块对象
151
151
  tags.forEach((tag) => {
152
- apiModules[tag.name] = `${defaultRemark}import { api } from "@/api/request/sendRuest"\n`;
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
@@ -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
  });
package/src/bin/add.js CHANGED
@@ -40,18 +40,18 @@ try {
40
40
  "BusinessReport"
41
41
  )
42
42
  .action((moduleName, options) => {
43
- console.log(111, options);
44
-
45
43
  const dir = path.join(options.path || process.cwd(), moduleName);
46
44
  // 启动加载动画
47
45
  if (!fs.existsSync(dir)) {
48
46
  fs.mkdirSync(dir);
49
- console.log(`创建文件夹: ${dir}`);
50
-
47
+ // console.log(`创建文件夹: ${dir}`);
51
48
  const templateContent = vue2Template(moduleName, options);
52
- fs.writeFileSync(path.join(dir, `index.vue`), templateContent);
49
+ const outputPath = path.join(dir, `index.vue`)
50
+ fs.writeFileSync(outputPath, templateContent);
51
+ console.log(`✅ 模板 已生成并保存到 ${outputPath}`);
52
+
53
53
  } else {
54
- console.log(`创建失败,文件夹 ${dir} 已存在`);
54
+ console.log(`❌ 创建失败,文件夹 ${dir} 已存在`);
55
55
  }
56
56
  if (options.debug) {
57
57
  console.log("调试信息:", options);