@gunshi/plugin-global 0.29.3 → 0.29.5
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/lib/index.js +7 -23
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { plugin } from "@gunshi/plugin";
|
|
2
|
-
|
|
3
|
-
//#region ../shared/src/constants.ts
|
|
4
|
-
/**
|
|
5
|
-
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
6
|
-
* @license MIT
|
|
7
|
-
*/
|
|
8
|
-
const BUILT_IN_PREFIX = "_";
|
|
9
|
-
const PLUGIN_PREFIX = "g";
|
|
10
|
-
const ARG_PREFIX = "arg";
|
|
11
|
-
const BUILT_IN_KEY_SEPARATOR = ":";
|
|
12
|
-
const BUILD_IN_PREFIX_AND_KEY_SEPARATOR = `${BUILT_IN_PREFIX}${BUILT_IN_KEY_SEPARATOR}`;
|
|
13
|
-
const ARG_PREFIX_AND_KEY_SEPARATOR = `${ARG_PREFIX}${BUILT_IN_KEY_SEPARATOR}`;
|
|
14
2
|
const COMMON_ARGS = {
|
|
15
3
|
help: {
|
|
16
4
|
type: "boolean",
|
|
@@ -23,7 +11,6 @@ const COMMON_ARGS = {
|
|
|
23
11
|
description: "Display this version"
|
|
24
12
|
}
|
|
25
13
|
};
|
|
26
|
-
|
|
27
14
|
//#endregion
|
|
28
15
|
//#region ../shared/src/utils.ts
|
|
29
16
|
/**
|
|
@@ -35,9 +22,8 @@ const COMMON_ARGS = {
|
|
|
35
22
|
* @returns A namespaced key for the plugin.
|
|
36
23
|
*/
|
|
37
24
|
function namespacedId(id) {
|
|
38
|
-
return
|
|
25
|
+
return `g:${id}`;
|
|
39
26
|
}
|
|
40
|
-
|
|
41
27
|
//#endregion
|
|
42
28
|
//#region src/types.ts
|
|
43
29
|
/**
|
|
@@ -48,7 +34,6 @@ function namespacedId(id) {
|
|
|
48
34
|
* The unique identifier for the global options plugin.
|
|
49
35
|
*/
|
|
50
36
|
const pluginId = namespacedId("global");
|
|
51
|
-
|
|
52
37
|
//#endregion
|
|
53
38
|
//#region src/decorator.ts
|
|
54
39
|
/**
|
|
@@ -75,11 +60,12 @@ const decorator = (baseRunner) => async (ctx) => {
|
|
|
75
60
|
}
|
|
76
61
|
return;
|
|
77
62
|
}
|
|
78
|
-
if (validationError)
|
|
63
|
+
if (validationError) {
|
|
64
|
+
await showValidationErrors(validationError);
|
|
65
|
+
throw validationError;
|
|
66
|
+
}
|
|
79
67
|
return baseRunner(ctx);
|
|
80
68
|
};
|
|
81
|
-
var decorator_default = decorator;
|
|
82
|
-
|
|
83
69
|
//#endregion
|
|
84
70
|
//#region src/extension.ts
|
|
85
71
|
/**
|
|
@@ -125,7 +111,6 @@ function extension(ctx) {
|
|
|
125
111
|
}
|
|
126
112
|
};
|
|
127
113
|
}
|
|
128
|
-
|
|
129
114
|
//#endregion
|
|
130
115
|
//#region src/index.ts
|
|
131
116
|
/**
|
|
@@ -169,10 +154,9 @@ function global() {
|
|
|
169
154
|
extension,
|
|
170
155
|
setup(ctx) {
|
|
171
156
|
for (const [name, schema] of Object.entries(COMMON_ARGS)) ctx.addGlobalOption(name, schema);
|
|
172
|
-
ctx.decorateCommand(
|
|
157
|
+
ctx.decorateCommand(decorator);
|
|
173
158
|
}
|
|
174
159
|
});
|
|
175
160
|
}
|
|
176
|
-
|
|
177
161
|
//#endregion
|
|
178
|
-
export { global as default, pluginId };
|
|
162
|
+
export { global as default, pluginId };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gunshi/plugin-global",
|
|
3
3
|
"description": "global options plugin for gunshi",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.5",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@gunshi/plugin": "0.29.
|
|
54
|
+
"@gunshi/plugin": "0.29.5"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"deno": "^2.7.
|
|
58
|
-
"jsr": "^0.
|
|
57
|
+
"deno": "^2.7.11",
|
|
58
|
+
"jsr": "^0.14.3",
|
|
59
59
|
"jsr-exports-lint": "^0.4.2",
|
|
60
60
|
"publint": "^0.3.18",
|
|
61
61
|
"tsdown": "0.15.12",
|
|
62
|
-
"typedoc": "^0.28.
|
|
63
|
-
"typedoc-plugin-markdown": "^4.
|
|
64
|
-
"@gunshi/shared": "0.29.
|
|
62
|
+
"typedoc": "^0.28.18",
|
|
63
|
+
"typedoc-plugin-markdown": "^4.11.0",
|
|
64
|
+
"@gunshi/shared": "0.29.5"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsdown",
|