oipage 1.6.0-alpha.2 → 1.6.0-beta.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/CHANGELOG CHANGED
@@ -118,12 +118,19 @@ v1.5.0:
118
118
  v1.6.0:
119
119
  date:
120
120
  changes:
121
+ - 修复bug
122
+ 1、修复logform在run下无法正常使用问题
123
+ (关联issue: https://github.com/oi-contrib/OIPage/issues/4 )
124
+ - 优化改造
125
+ 1、命令行帮助打印更可读
121
126
  - 新增功能
122
127
  1、命令(oipage-cli)
123
128
  * disk
124
129
  --link 创建磁盘链接
125
130
  --delempty 删除空文件夹
126
131
  * network 网络相关
132
+ * run 支持动态参数
133
+ (关联issue: https://github.com/oi-contrib/OIPage/issues/5 )
127
134
  2、API功能(Node.js)
128
135
  * disk 磁盘相关操作
129
136
  (包括:linkDisk)
package/README.md CHANGED
@@ -86,10 +86,10 @@ oipage-cli serve -p 8080
86
86
 
87
87
  <img src="./snipping/image-editor.png" />
88
88
 
89
- 已有功能或更多功能我们将根据实际情况逐步完善和维护,当然,你可以通过 [issue](https://github.com/oi-contrib/VISLite/issues) 给我们留言,告诉我们你的改进意见。
89
+ 已有功能或更多功能我们将根据实际情况逐步完善和维护,当然,你可以通过 [issue](https://github.com/oi-contrib/OIPage/issues) 给我们留言,告诉我们你的改进意见。
90
90
 
91
91
  ## 版权
92
92
 
93
93
  MIT License
94
94
 
95
- Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) 走一步,再走一步
95
+ Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) 走一步,再走一步
package/bin/help.js CHANGED
@@ -7,25 +7,38 @@ OIPage@v${packageValue.version}
7
7
  可以使用的命令如下:
8
8
 
9
9
  【1】oipage-cli serve 开发服务器
10
- --port|-p 端口号
11
- --baseUrl 服务器根目录
12
- --config|-c 设置配置文件
13
- --cache 是否启用304(默认true表示开启)
10
+ --port|-p [端口号]
11
+ 默认8080
12
+ --baseUrl [文件夹地址]
13
+ 服务器根目录
14
+ --config|-c [配置文件地址]
15
+ 设置配置文件,相对地址是相对当前命令行
16
+ --cache [true|false]
17
+ 是否启用304(默认true表示开启)
18
+ (eg: oipage-cli serve -p 20000 )
14
19
 
15
20
  【2】oipage-cli disk 磁盘操作
16
- --force|-f 强制执行
17
- --delete|-d 删除文件或文件夹
18
- --delempty 删除空文件夹
19
- --move|-m 移动文件或文件夹
20
- --copy|-c 复制文件或文件夹
21
- --link|-l 创建磁盘链接
21
+ --force|-f
22
+ 强制执行,如果目标地址已有内容,会直接强制删除已有内容
23
+ --delete|-d [文件或文件夹地址]
24
+ 删除文件或文件夹
25
+ --delempty [文件夹地址]
26
+ 删除空文件夹
27
+ --move|-m [源地址] [软链接地址]
28
+ 移动文件或文件夹
29
+ --copy|-c [源地址] [目标地址]
30
+ 复制文件或文件夹
31
+ --link|-l [源地址] [软链接地址]
32
+ 创建磁盘链接
33
+ (eg: oipage-cli disk -m ./test.js ~/test.js -f )
22
34
 
23
35
  【3】oipage-cli run "任务一" "任务二" ... 运行多命令
36
+ ( 如果希望动态给任务传递参数,可以查看: https://github.com/oi-contrib/OIPage/issues/5 )
24
37
 
25
38
  【4】oipage-cli network 网络相关
26
- --log 打印网络信息
27
-
28
- Powered by https://github.com/zxl20070701
39
+ --log
40
+ 打印网络信息
41
+ (eg: oipage-cli network --log )
29
42
  \x1b[0m`);
30
43
 
31
44
  };
package/bin/run CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  process.title = 'OIPage';
6
6
 
7
- const { exec } = require('child_process');
7
+ const { spawn } = require('child_process');
8
8
  const { join } = require("path");
9
9
  const { existsSync, lstatSync } = require("fs");
10
10
  const { mergeOption } = require("vislite");
@@ -68,27 +68,35 @@ else if (process.argv[2] === "run") {
68
68
 
69
69
  let argvObj = formatArgv(process.argv, {});
70
70
 
71
+ let tasks = [], runArgs = [];
71
72
  for (let index = 0; index < argvObj.args.length; index++) {
72
- const child = exec(argvObj.args[index]);
73
73
 
74
- // 监听子线程的stdout
75
- child.stdout.on('data', (data) => {
76
- process.stdout.write(`${data}`);
77
- });
74
+ // 参数
75
+ if (/^:/.test(argvObj.args[index])) {
76
+ runArgs.push(argvObj.args[index].replace(/^:/, ""));
77
+ }
78
78
 
79
- // 监听子线程的stderr
80
- child.stderr.on('data', (data) => {
81
- process.stdout.write(`${data}`);
82
- });
79
+ // 任务
80
+ else {
81
+ tasks.push(argvObj.args[index]);
82
+ }
83
+ }
83
84
 
84
- // 子线程结束处理
85
- child.on('close', (code) => {
86
- console.log(`子线程${index + 1}结束,退出码 ${code}`);
87
- });
85
+ for (let index = 0; index < tasks.length; index++) {
86
+
87
+ // 补充动态参数的支持
88
+ // npm run bug:issue5 ":-p 9090"
89
+ // 2025年12月1日 于南京
90
+ let task = (tasks[index] + (runArgs[index] ? (" " + runArgs[index]) : "")).split(" ");
91
+ let command = task.shift();
92
+
93
+ // 修复exec无法正常使用logform问题
94
+ // npm run bug:issue4
95
+ // 2025年12月2日 于南京
96
+ spawn(command, task, {
88
97
 
89
- // 子线程出错处理
90
- child.on('error', (error) => {
91
- console.error(`子线程${index + 1}错误: ${error.message}`);
98
+ // https://nodejs.org/api/child_process.html#child_process_options_stdio
99
+ stdio: 'inherit'
92
100
  });
93
101
  }
94
102
 
@@ -16,7 +16,7 @@ module.exports = function (isAll) {
16
16
  let network = networks[typeName]
17
17
  for (let index = 0; index < network.length; index++) {
18
18
  if (network[index].mac != "00:00:00:00:00:00" || isAll) {
19
- if (network[index].family == 'IPv4' && (network[index].address != '127.0.0.1' || isAll)) {
19
+ if (network[index].family == 'IPv4') {
20
20
  if (!IPv4Had[network[index].mac]) {
21
21
  infomation.IPv4.push({
22
22
  address: network[index].address,
@@ -25,7 +25,7 @@ module.exports = function (isAll) {
25
25
 
26
26
  IPv4Had[network[index].mac] = true;
27
27
  }
28
- } else if (network[index].family == 'IPv6' && network[index].address != '::1' || isAll) {
28
+ } else if (network[index].family == 'IPv6') {
29
29
  if (!IPv6Had[network[index].mac]) {
30
30
  infomation.IPv6.push({
31
31
  address: network[index].address,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * animation of OIPage v1.6.0-alpha.2
2
+ * animation of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * cmdlog of OIPage v1.6.0-alpha.2
2
+ * cmdlog of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * disk of OIPage v1.6.0-alpha.2
2
+ * disk of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * format of OIPage v1.6.0-alpha.2
2
+ * format of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * json of OIPage v1.6.0-alpha.2
2
+ * json of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  const {reader} = require("../reader/index.js");
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * logform of OIPage v1.6.0-alpha.2
2
+ * logform of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  const {linelog} = require("../cmdlog/index.js");
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * reader of OIPage v1.6.0-alpha.2
2
+ * reader of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * throttle of OIPage v1.6.0-alpha.2
2
+ * throttle of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "oipage",
3
- "version": "1.6.0-alpha.2",
3
+ "version": "1.6.0-beta.1",
4
4
  "description": "前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等",
5
5
  "sideEffects": false,
6
6
  "scripts": {
7
7
  "dev": "node ./build/index.js watch",
8
8
  "build": "node ./build/index.js",
9
- "serve": "node ./bin/run serve --config ./oipage.config.js"
9
+ "serve": "node ./bin/run serve --config ./oipage.config.js",
10
+ "bug:issue5": "node ./bin/run run \"node ./bin/run serve\"",
11
+ "bug:issue4": "node ./bin/run run \"node ./test/logform/index.spec.js\""
10
12
  },
11
13
  "bin": {
12
14
  "oipage-cli": "bin/run"
@@ -39,4 +41,4 @@
39
41
  "xhtml-to-json": "^0.1.0",
40
42
  "zipaper": "^0.2.0"
41
43
  }
42
- }
44
+ }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * XMLHttpRequest of OIPage v1.6.0-alpha.2
2
+ * XMLHttpRequest of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * animation of OIPage v1.6.0-alpha.2
2
+ * animation of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * format of OIPage v1.6.0-alpha.2
2
+ * format of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/web/json/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * json of OIPage v1.6.0-alpha.2
2
+ * json of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
  import {reader} from "../reader/index.js";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * onReady of OIPage v1.6.0-alpha.2
2
+ * onReady of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * performChunk of OIPage v1.6.0-alpha.2
2
+ * performChunk of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * reader of OIPage v1.6.0-alpha.2
2
+ * reader of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * style of OIPage v1.6.0-alpha.2
2
+ * style of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * throttle of OIPage v1.6.0-alpha.2
2
+ * throttle of OIPage v1.6.0-beta.1
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5