oipage 1.6.0-alpha.0 → 1.6.0-alpha.2

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
@@ -120,7 +120,10 @@ v1.6.0:
120
120
  changes:
121
121
  - 新增功能
122
122
  1、命令(oipage-cli)
123
- * disk --link 创建磁盘链接
123
+ * disk
124
+ --link 创建磁盘链接
125
+ --delempty 删除空文件夹
126
+ * network 网络相关
124
127
  2、API功能(Node.js)
125
128
  * disk 磁盘相关操作
126
129
  (包括:linkDisk)
package/bin/disk.js CHANGED
@@ -1,4 +1,6 @@
1
+ const { join } = require("path");
1
2
  const { deleteDisk, copyDisk, moveDisk, linkDisk } = require("../nodejs/disk");
3
+ const deleteEmptyFolder = require("./tools/deleteEmptyFolder");
2
4
 
3
5
  module.exports = function (config) {
4
6
  let isForce = false;
@@ -32,5 +34,10 @@ module.exports = function (config) {
32
34
  else if (config.value[i].name === "--link") {
33
35
  linkDisk(config.value[i].value[0], config.value[i].value[1], isForce);
34
36
  }
37
+
38
+ // 删除空文件夹
39
+ else if (config.value[i].name === "--delempty") {
40
+ deleteEmptyFolder(join(process.cwd(), config.value[i].value[0]));
41
+ }
35
42
  }
36
43
  };
package/bin/help.js CHANGED
@@ -15,12 +15,16 @@ OIPage@v${packageValue.version}
15
15
  【2】oipage-cli disk 磁盘操作
16
16
  --force|-f 强制执行
17
17
  --delete|-d 删除文件或文件夹
18
+ --delempty 删除空文件夹
18
19
  --move|-m 移动文件或文件夹
19
20
  --copy|-c 复制文件或文件夹
20
- --linkDisk|-l 创建磁盘链接
21
+ --link|-l 创建磁盘链接
21
22
 
22
23
  【3】oipage-cli run "任务一" "任务二" ... 运行多命令
23
24
 
25
+ 【4】oipage-cli network 网络相关
26
+ --log 打印网络信息
27
+
24
28
  Powered by https://github.com/zxl20070701
25
29
  \x1b[0m`);
26
30
 
package/bin/network.js ADDED
@@ -0,0 +1,22 @@
1
+ const networkInfo = require("./tools/network");
2
+
3
+ module.exports = function (config) {
4
+ let info = networkInfo(true);
5
+
6
+ // 执行一个个任务
7
+ for (let i = 0; i < config.value.length; i++) {
8
+
9
+ // 打印信息
10
+ if (config.value[i].name === "--log") {
11
+
12
+ for (let iptype of ["IPv4", "IPv6"]) {
13
+ console.log("\n" + iptype);
14
+ for (let i = 0; i < info[iptype].length; i++) {
15
+ console.log(" \x1b[1m\x1b[32m" + info[iptype][i].address + "\x1b[0m " + info[iptype][i].mac);
16
+ }
17
+ }
18
+
19
+ console.log("");
20
+ }
21
+ }
22
+ };
package/bin/run CHANGED
@@ -94,6 +94,14 @@ else if (process.argv[2] === "run") {
94
94
 
95
95
  }
96
96
 
97
+ // 网络相关
98
+ else if (process.argv[2] === "network") {
99
+
100
+ let argvObj = formatArgv(process.argv, {}, true);
101
+
102
+ require("./network.js")(argvObj);
103
+ }
104
+
97
105
  // 默认,帮助
98
106
  else {
99
107
  require("./help.js")();
@@ -0,0 +1,24 @@
1
+ const { readdirSync, lstatSync, rmdirSync } = require("fs");
2
+ const { join } = require("path");
3
+
4
+ module.exports = function (rootPath) {
5
+ (function deleteEmptyFolder(folderPath) {
6
+ let subItems = readdirSync(folderPath);
7
+ if (subItems.length > 0) {
8
+ for (let i = 0; i < subItems.length; i++) {
9
+ let itemPath = join(folderPath, subItems[i]);
10
+ if (lstatSync(itemPath).isDirectory()) deleteEmptyFolder(itemPath);
11
+ }
12
+ } else {
13
+ rmdirSync(folderPath);
14
+
15
+ folderPath = join(folderPath, "..");
16
+ while (folderPath.length >= rootPath.length) {
17
+ subItems = readdirSync(folderPath);
18
+ if (readdirSync(folderPath).length > 0) break;
19
+ rmdirSync(folderPath);
20
+ folderPath = join(folderPath, "..");
21
+ }
22
+ }
23
+ })(params.path);
24
+ };
@@ -1,7 +1,7 @@
1
1
  const { networkInterfaces } = require("os");
2
2
 
3
3
  // 网络信息
4
- module.exports = function () {
4
+ module.exports = function (isAll) {
5
5
 
6
6
  let infomation = {
7
7
  IPv4: [],
@@ -15,8 +15,8 @@ module.exports = function () {
15
15
  for (let typeName in networks) {
16
16
  let network = networks[typeName]
17
17
  for (let index = 0; index < network.length; index++) {
18
- if (network[index].mac != "00:00:00:00:00:00") {
19
- if (network[index].family == 'IPv4' && network[index].address != '127.0.0.1') {
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)) {
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 () {
25
25
 
26
26
  IPv4Had[network[index].mac] = true;
27
27
  }
28
- } else if (network[index].family == 'IPv6' && network[index].address != '::1') {
28
+ } else if (network[index].family == 'IPv6' && network[index].address != '::1' || isAll) {
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.0
2
+ * animation of OIPage v1.6.0-alpha.2
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.0
2
+ * cmdlog of OIPage v1.6.0-alpha.2
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.0
2
+ * disk of OIPage v1.6.0-alpha.2
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.0
2
+ * format of OIPage v1.6.0-alpha.2
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.0
2
+ * json of OIPage v1.6.0-alpha.2
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.0
2
+ * logform of OIPage v1.6.0-alpha.2
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.0
2
+ * reader of OIPage v1.6.0-alpha.2
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.0
2
+ * throttle of OIPage v1.6.0-alpha.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oipage",
3
- "version": "1.6.0-alpha.0",
3
+ "version": "1.6.0-alpha.2",
4
4
  "description": "前端网页或应用快速开发助手,包括开发服务器、辅助命令、实用API等",
5
5
  "sideEffects": false,
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * XMLHttpRequest of OIPage v1.6.0-alpha.0
2
+ * XMLHttpRequest of OIPage v1.6.0-alpha.2
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.0
2
+ * animation of OIPage v1.6.0-alpha.2
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.0
2
+ * format of OIPage v1.6.0-alpha.2
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.0
2
+ * json of OIPage v1.6.0-alpha.2
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.0
2
+ * onReady of OIPage v1.6.0-alpha.2
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.0
2
+ * performChunk of OIPage v1.6.0-alpha.2
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.0
2
+ * reader of OIPage v1.6.0-alpha.2
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.0
2
+ * style of OIPage v1.6.0-alpha.2
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.0
2
+ * throttle of OIPage v1.6.0-alpha.2
3
3
  * git+https://github.com/oi-contrib/OIPage.git
4
4
  */
5
5