@clerc/plugin-version 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 -23
- /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-version)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Documenation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
$ npm install @clerc/plugin-version
|
|
11
|
-
$ yarn add @clerc/plugin-version
|
|
12
|
-
$ pnpm add @clerc/plugin-version
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## 🚀 Usage
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { versionPlugin } from "@clerc/plugin-version";
|
|
19
|
-
|
|
20
|
-
cli.use(versionPlugin());
|
|
21
|
-
```
|
|
7
|
+
Read the [documentation](https://clerc.so1ve.dev/official-plugins/plugin-version.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{formatVersion as t}from"@clerc/utils";const n=({command:n=!0,flag:r=!0}={})=>e({setup:e=>{n&&e.command(`version`,`Prints current version`,{}).on(`version`,()=>{console.log(t(e._version))}),r&&e.globalFlag(`version`,`Prints current version`,{short:`V`,type:Boolean,default:!1}).interceptor({enforce:`pre`,handler:async(n,r)=>{n.flags.version?console.log(t(e._version)):await r()}})}});export{n as versionPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clerc/plugin-version",
|
|
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 version",
|
|
@@ -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,23 +0,0 @@
|
|
|
1
|
-
import { definePlugin } from "@clerc/core";
|
|
2
|
-
import { formatVersion } from "@clerc/utils";
|
|
3
|
-
|
|
4
|
-
//#region src/index.ts
|
|
5
|
-
const versionPlugin = ({ command = true, flag = true } = {}) => definePlugin({ setup: (cli) => {
|
|
6
|
-
if (command) cli.command("version", "Prints current version", {}).on("version", () => {
|
|
7
|
-
console.log(formatVersion(cli._version));
|
|
8
|
-
});
|
|
9
|
-
if (flag) cli.globalFlag("version", "Prints current version", {
|
|
10
|
-
short: "V",
|
|
11
|
-
type: Boolean,
|
|
12
|
-
default: false
|
|
13
|
-
}).interceptor({
|
|
14
|
-
enforce: "pre",
|
|
15
|
-
handler: async (ctx, next) => {
|
|
16
|
-
if (ctx.flags.version) console.log(formatVersion(cli._version));
|
|
17
|
-
else await next();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
} });
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
export { versionPlugin };
|
|
File without changes
|