@clerc/plugin-strict-flags 1.0.3 → 1.1.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/README.md +2 -16
- package/dist/index.mjs +1 -0
- package/package.json +8 -15
- package/dist/index.js +0 -14
- /package/dist/{index.d.ts → index.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -2,23 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@clerc/plugin-strict-flags)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Documenation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
$ npm install @clerc/plugin-strict-flags
|
|
11
|
-
$ yarn add @clerc/plugin-strict-flags
|
|
12
|
-
$ pnpm add @clerc/plugin-strict-flags
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 🚀 Usage
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { strictFlagsPlugin } from "@clerc/plugin-strict-flags";
|
|
19
|
-
|
|
20
|
-
cli.use(strictFlagsPlugin());
|
|
21
|
-
```
|
|
7
|
+
Read the [documentation](https://clerc.so1ve.dev/official-plugins/plugin-strict-flags.html) for more details.
|
|
22
8
|
|
|
23
9
|
## 📝 License
|
|
24
10
|
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{definePlugin as e}from"@clerc/core";import{joinWithAnd as t}from"@clerc/utils";const n=()=>e({setup:e=>{e.interceptor(async(e,n)=>{let r=Object.keys(e.rawParsed.unknown);if(!e.command||r.length===0)await n();else throw r.length>1?Error(`Unexpected flags: ${t(r)}`):Error(`Unexpected flag: ${r[0]}`)})}});export{n as strictFlagsPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/plugin-strict-flags",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Clerc plugin strict flags",
|
|
@@ -25,19 +25,12 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"exports": {
|
|
28
|
-
".": "./dist/index.
|
|
29
|
-
|
|
30
|
-
"main": "./dist/index.js",
|
|
31
|
-
"module": "./dist/index.js",
|
|
32
|
-
"types": "dist/index.d.ts",
|
|
33
|
-
"typesVersions": {
|
|
34
|
-
"*": {
|
|
35
|
-
"*": [
|
|
36
|
-
"./dist/*",
|
|
37
|
-
"./dist/index.d.ts"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
28
|
+
".": "./dist/index.mjs",
|
|
29
|
+
"./package.json": "./package.json"
|
|
40
30
|
},
|
|
31
|
+
"main": "./dist/index.mjs",
|
|
32
|
+
"module": "./dist/index.mjs",
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
41
34
|
"files": [
|
|
42
35
|
"dist"
|
|
43
36
|
],
|
|
@@ -45,10 +38,10 @@
|
|
|
45
38
|
"access": "public"
|
|
46
39
|
},
|
|
47
40
|
"dependencies": {
|
|
48
|
-
"@clerc/utils": "1.
|
|
41
|
+
"@clerc/utils": "1.1.1"
|
|
49
42
|
},
|
|
50
43
|
"devDependencies": {
|
|
51
|
-
"@clerc/core": "1.
|
|
44
|
+
"@clerc/core": "1.1.1"
|
|
52
45
|
},
|
|
53
46
|
"peerDependencies": {
|
|
54
47
|
"@clerc/core": "*"
|
package/dist/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { definePlugin } from "@clerc/core";
|
|
2
|
-
import { joinWithAnd } from "@clerc/utils";
|
|
3
|
-
|
|
4
|
-
//#region src/index.ts
|
|
5
|
-
const strictFlagsPlugin = () => definePlugin({ setup: (cli) => {
|
|
6
|
-
cli.interceptor(async (ctx, next) => {
|
|
7
|
-
const keys = Object.keys(ctx.rawParsed.unknown);
|
|
8
|
-
if (!ctx.command || keys.length === 0) await next();
|
|
9
|
-
else throw keys.length > 1 ? /* @__PURE__ */ new Error(`Unexpected flags: ${joinWithAnd(keys)}`) : /* @__PURE__ */ new Error(`Unexpected flag: ${keys[0]}`);
|
|
10
|
-
});
|
|
11
|
-
} });
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
export { strictFlagsPlugin };
|
|
File without changes
|