@aiot-toolkit/shared-utils 2.0.2-beta.18 → 2.0.2-beta.19

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
@@ -1,11 +1,11 @@
1
- # `shared-utils`
2
-
3
- > TODO: description
4
-
5
- ## Usage
6
-
7
- ```
8
- const sharedUtils = require('shared-utils');
9
-
10
- // TODO: DEMONSTRATE API
11
- ```
1
+ # `shared-utils`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const sharedUtils = require('shared-utils');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -98,7 +98,7 @@ class CommonUtil {
98
98
  if (ajv.errors) {
99
99
  const errors = ajv.errors.map((item) => {
100
100
  const { message, instancePath, keyword } = item;
101
- const errorMessage = `${instancePath ? `${instancePath}: ` : ''} ${message}`;
101
+ const errorMessage = `${instancePath ? `${instancePath}: ` : ''}${message}`;
102
102
  if (keyword === 'required') {
103
103
  return new TypeError(errorMessage);
104
104
  }
@@ -16,6 +16,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const rimraf_1 = require("rimraf");
18
18
  const fswin_1 = __importDefault(require("fswin"));
19
+ const minimatch_1 = require("minimatch");
19
20
  /**
20
21
  * FileUtil
21
22
  */
@@ -51,7 +52,7 @@ class FileUtil {
51
52
  case 'function':
52
53
  return matchType(value);
53
54
  case 'string':
54
- return matchType === value;
55
+ return (0, minimatch_1.minimatch)(value, matchType, { dot: true });
55
56
  case 'object':
56
57
  if (matchType instanceof RegExp) {
57
58
  return matchType.test(value);
@@ -78,9 +79,12 @@ class FileUtil {
78
79
  const result = [];
79
80
  files.forEach((item) => {
80
81
  const itemPath = path_1.default.join(dir, item.name);
81
- if (item.isDirectory() && item) {
82
- const children = this.readAlldirSync(itemPath, includes, excludes);
83
- result.push(...children);
82
+ if (item.isDirectory()) {
83
+ // 当目录不被排除时,递归获取子目录
84
+ if (this.include(itemPath, undefined, excludes)) {
85
+ const children = this.readAlldirSync(itemPath, includes, excludes);
86
+ result.push(...children);
87
+ }
84
88
  }
85
89
  else {
86
90
  if (this.include(itemPath, includes, excludes)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/shared-utils",
3
- "version": "2.0.2-beta.18",
3
+ "version": "2.0.2-beta.19",
4
4
  "description": "The common method functions of the aiot-toolkit.",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -24,8 +24,9 @@
24
24
  "fs-extra": "^11.2.0",
25
25
  "fswin": "^3.24.829",
26
26
  "koa": "^2.15.3",
27
- "koa-router": "^12.0.1",
27
+ "koa-router": "^13.0.1",
28
28
  "koa-static": "^5.0.0",
29
+ "minimatch": "^10.0.1",
29
30
  "portfinder": "^1.0.32",
30
31
  "qrcode": "^1.5.4",
31
32
  "rimraf": "^5.0.9",
@@ -37,7 +38,8 @@
37
38
  "@types/koa": "^2.15.0",
38
39
  "@types/koa-router": "^7.4.8",
39
40
  "@types/koa-static": "^4.0.4",
41
+ "@types/minimatch": "^5.1.2",
40
42
  "@types/qrcode": "^1.5.5"
41
43
  },
42
- "gitHead": "e39f0ad4fe3bfe8e733499742c5a39ab80fa2cd0"
44
+ "gitHead": "7c6ed600fe84ee9de9b00c6e95dfabf3bfb3ad65"
43
45
  }