@clerc/plugin-version 0.25.0 → 0.26.0

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 CHANGED
@@ -1,39 +1 @@
1
- import { definePlugin } from '@clerc/core';
2
-
3
- const gracefulVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
4
-
5
- const versionPlugin = ({
6
- alias = ["V"],
7
- command = true
8
- } = {}) => definePlugin({
9
- setup: (cli) => {
10
- const gracefullyVersion = gracefulVersion(cli._version);
11
- if (command) {
12
- cli = cli.command("version", "Show version", {
13
- notes: ['The version string begins with a "v".']
14
- }).on("version", () => {
15
- process.stdout.write(gracefullyVersion);
16
- });
17
- }
18
- return cli.inspector({
19
- enforce: "pre",
20
- fn: (ctx, next) => {
21
- let hasVersionFlag = false;
22
- const versionFlags = ["version", ...alias];
23
- for (const k of Object.keys(ctx.raw.mergedFlags)) {
24
- if (versionFlags.includes(k)) {
25
- hasVersionFlag = true;
26
- break;
27
- }
28
- }
29
- if (!hasVersionFlag) {
30
- next();
31
- } else {
32
- process.stdout.write(gracefullyVersion);
33
- }
34
- }
35
- });
36
- }
37
- });
38
-
39
- export { versionPlugin };
1
+ import{definePlugin as g}from"@clerc/core";const v=e=>e.length===0?"":e.startsWith("v")?e:`v${e}`,c=({alias:e=["V"],command:n=!0}={})=>g({setup:s=>{const r=v(s._version);return n&&(s=s.command("version","Show version",{notes:['The version string begins with a "v".']}).on("version",()=>{process.stdout.write(r)})),s.inspector({enforce:"pre",fn:(t,i)=>{let o=!1;const a=["version",...e];for(const f of Object.keys(t.raw.mergedFlags))if(a.includes(f)){o=!0;break}o?process.stdout.write(r):i()}})}});export{c as versionPlugin};
package/dist/index.mjs CHANGED
@@ -1,39 +1 @@
1
- import { definePlugin } from '@clerc/core';
2
-
3
- const gracefulVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
4
-
5
- const versionPlugin = ({
6
- alias = ["V"],
7
- command = true
8
- } = {}) => definePlugin({
9
- setup: (cli) => {
10
- const gracefullyVersion = gracefulVersion(cli._version);
11
- if (command) {
12
- cli = cli.command("version", "Show version", {
13
- notes: ['The version string begins with a "v".']
14
- }).on("version", () => {
15
- process.stdout.write(gracefullyVersion);
16
- });
17
- }
18
- return cli.inspector({
19
- enforce: "pre",
20
- fn: (ctx, next) => {
21
- let hasVersionFlag = false;
22
- const versionFlags = ["version", ...alias];
23
- for (const k of Object.keys(ctx.raw.mergedFlags)) {
24
- if (versionFlags.includes(k)) {
25
- hasVersionFlag = true;
26
- break;
27
- }
28
- }
29
- if (!hasVersionFlag) {
30
- next();
31
- } else {
32
- process.stdout.write(gracefullyVersion);
33
- }
34
- }
35
- });
36
- }
37
- });
38
-
39
- export { versionPlugin };
1
+ import{definePlugin as g}from"@clerc/core";const v=e=>e.length===0?"":e.startsWith("v")?e:`v${e}`,c=({alias:e=["V"],command:n=!0}={})=>g({setup:s=>{const r=v(s._version);return n&&(s=s.command("version","Show version",{notes:['The version string begins with a "v".']}).on("version",()=>{process.stdout.write(r)})),s.inspector({enforce:"pre",fn:(t,i)=>{let o=!1;const a=["version",...e];for(const f of Object.keys(t.raw.mergedFlags))if(a.includes(f)){o=!0;break}o?process.stdout.write(r):i()}})}});export{c as versionPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-version",
3
- "version": "0.25.0",
3
+ "version": "0.26.0",
4
4
  "author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
5
5
  "description": "Clerc plugin version",
6
6
  "keywords": [
@@ -43,10 +43,11 @@
43
43
  "@clerc/core": "*"
44
44
  },
45
45
  "devDependencies": {
46
- "@clerc/core": "0.25.0"
46
+ "@clerc/core": "0.26.0",
47
+ "@clerc/utils": "0.26.0"
47
48
  },
48
49
  "scripts": {
49
- "build": "puild",
50
+ "build": "puild --minify",
50
51
  "watch": "puild --watch"
51
52
  }
52
53
  }