utilium 2.5.0 → 2.5.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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "utilium",
|
3
|
-
"version": "2.5.
|
3
|
+
"version": "2.5.2",
|
4
4
|
"description": "Typescript utilities",
|
5
5
|
"funding": {
|
6
6
|
"type": "individual",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"./typedoc-no-ref": "./scripts/typedoc-no-ref.js"
|
17
17
|
},
|
18
18
|
"bin": {
|
19
|
-
"lice": "./scripts/
|
19
|
+
"lice": "./scripts/lice.js"
|
20
20
|
},
|
21
21
|
"files": [
|
22
22
|
"dist",
|
@@ -4,12 +4,12 @@
|
|
4
4
|
|
5
5
|
import { readdirSync } from 'node:fs';
|
6
6
|
import { readFile, writeFile } from 'node:fs/promises';
|
7
|
-
import { join, relative } from 'node:path';
|
7
|
+
import { join, matchesGlob, relative } from 'node:path';
|
8
8
|
import { parseArgs, styleText } from 'node:util';
|
9
9
|
|
10
10
|
const {
|
11
11
|
positionals: dirs,
|
12
|
-
values: { license: expectedLicense, write, verbose, force },
|
12
|
+
values: { license: expectedLicense, write, verbose, force, exclude },
|
13
13
|
} = parseArgs({
|
14
14
|
allowPositionals: true,
|
15
15
|
options: {
|
@@ -17,6 +17,7 @@ const {
|
|
17
17
|
write: { type: 'boolean', short: 'w', default: false },
|
18
18
|
verbose: { type: 'boolean', short: 'v', default: false },
|
19
19
|
force: { type: 'boolean', short: 'f', default: false },
|
20
|
+
exclude: { type: 'string', short: 'x', default: '' },
|
20
21
|
},
|
21
22
|
});
|
22
23
|
|
@@ -28,6 +29,11 @@ if (write && !expectedLicense) {
|
|
28
29
|
const licenseSpec = /^\s*\/(?:\/|\*) SPDX-License-Identifier: (.+)/;
|
29
30
|
|
30
31
|
async function check_file(path, display) {
|
32
|
+
if (matchesGlob(path, exclude)) {
|
33
|
+
console.log(styleText('whiteBright', 'Skipped:'), display);
|
34
|
+
return 'skipped';
|
35
|
+
}
|
36
|
+
|
31
37
|
const content = await readFile(path, 'utf-8');
|
32
38
|
|
33
39
|
const match = licenseSpec.exec(content);
|
@@ -38,14 +44,14 @@ async function check_file(path, display) {
|
|
38
44
|
}
|
39
45
|
|
40
46
|
if (!expectedLicense) {
|
41
|
-
if (verbose) console.log(styleText(['dim'], 'Found:
|
47
|
+
if (verbose) console.log(styleText(['dim'], 'Found:'), display);
|
42
48
|
return 'with license';
|
43
49
|
}
|
44
50
|
|
45
51
|
const [, license] = match;
|
46
52
|
|
47
53
|
if (license == expectedLicense) {
|
48
|
-
if (verbose) console.log(styleText(['green', 'dim'], 'Correct:
|
54
|
+
if (verbose) console.log(styleText(['green', 'dim'], 'Correct:'), display);
|
49
55
|
return 'correct';
|
50
56
|
}
|
51
57
|
|
@@ -54,6 +60,11 @@ async function check_file(path, display) {
|
|
54
60
|
}
|
55
61
|
|
56
62
|
async function write_file(path, display) {
|
63
|
+
if (matchesGlob(path, exclude)) {
|
64
|
+
console.log(styleText('whiteBright', 'Skipped:'), display);
|
65
|
+
return 'skipped';
|
66
|
+
}
|
67
|
+
|
57
68
|
const content = await readFile(path, 'utf-8');
|
58
69
|
|
59
70
|
const match = licenseSpec.exec(content);
|
@@ -68,7 +79,7 @@ async function write_file(path, display) {
|
|
68
79
|
const [, license] = match;
|
69
80
|
|
70
81
|
if (license == expectedLicense) {
|
71
|
-
if (verbose) console.log(styleText(['green', 'dim'], 'Correct:
|
82
|
+
if (verbose) console.log(styleText(['green', 'dim'], 'Correct:'), display);
|
72
83
|
return 'correct';
|
73
84
|
}
|
74
85
|
|