@clerc/plugin-strict-flags 0.42.0 → 0.42.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/dist/index.js +7 -11
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8,16 +8,12 @@ const locales$1 = {
|
|
|
8
8
|
"utils.and": "%s \u548C %s"
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
function semanticArray(
|
|
11
|
+
function semanticArray(arr, { add, t }) {
|
|
12
12
|
add(locales$1);
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
13
|
+
if (arr.length <= 1) {
|
|
14
|
+
return arr[0];
|
|
15
15
|
}
|
|
16
|
-
return t(
|
|
17
|
-
"utils.and",
|
|
18
|
-
array.slice(0, -1).join(", "),
|
|
19
|
-
array[array.length - 1]
|
|
20
|
-
);
|
|
16
|
+
return t("utils.and", arr.slice(0, -1).join(", "), arr[arr.length - 1]);
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
const locales = {
|
|
@@ -37,9 +33,9 @@ const strictFlagsPlugin = () => definePlugin({
|
|
|
37
33
|
setup: (cli) => {
|
|
38
34
|
const { add, t } = cli.i18n;
|
|
39
35
|
add(locales);
|
|
40
|
-
return cli.inspector((
|
|
41
|
-
const keys = Object.keys(
|
|
42
|
-
if (!
|
|
36
|
+
return cli.inspector((ctx, next) => {
|
|
37
|
+
const keys = Object.keys(ctx.unknownFlags);
|
|
38
|
+
if (!ctx.resolved || keys.length === 0) {
|
|
43
39
|
next();
|
|
44
40
|
} else {
|
|
45
41
|
const error = keys.length > 1 ? new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/plugin-strict-flags",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Clerc plugin strict flags",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@clerc/
|
|
52
|
-
"@clerc/
|
|
51
|
+
"@clerc/core": "0.42.1",
|
|
52
|
+
"@clerc/utils": "0.42.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@clerc/core": "*"
|