@clerc/plugin-version 1.0.0-beta.8 → 1.0.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -5
  2. package/package.json +3 -9
package/dist/index.js CHANGED
@@ -1,20 +1,22 @@
1
1
  import { definePlugin } from "@clerc/core";
2
- import { formatVersion } from "@clerc/utils";
3
2
 
3
+ //#region ../utils/src/index.ts
4
+ const formatVersion = (v) => v.length === 0 ? "" : v.startsWith("v") ? v : `v${v}`;
5
+
6
+ //#endregion
4
7
  //#region src/index.ts
5
8
  const versionPlugin = ({ command = true, flag = true } = {}) => definePlugin({ setup: (cli) => {
6
- const formattedVersion = formatVersion(cli._version);
7
9
  if (command) cli.command("version", "Prints current version", {}).on("version", () => {
8
- console.log(formattedVersion);
10
+ console.log(formatVersion(cli._version));
9
11
  });
10
12
  if (flag) cli.globalFlag("version", "Prints current version", {
11
- alias: "V",
13
+ short: "V",
12
14
  type: Boolean,
13
15
  default: false
14
16
  }).interceptor({
15
17
  enforce: "pre",
16
18
  handler: async (ctx, next) => {
17
- if (ctx.flags.version) console.log(formattedVersion);
19
+ if (ctx.flags.version) console.log(formatVersion(cli._version));
18
20
  else await next();
19
21
  }
20
22
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/plugin-version",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.0",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc plugin version",
@@ -44,17 +44,11 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "dependencies": {
48
- "@clerc/utils": "1.0.0-beta.8"
49
- },
50
47
  "devDependencies": {
51
- "@clerc/core": "1.0.0-beta.8"
48
+ "@clerc/core": "1.0.0",
49
+ "@clerc/utils": "1.0.0"
52
50
  },
53
51
  "peerDependencies": {
54
52
  "@clerc/core": "*"
55
- },
56
- "scripts": {
57
- "build": "tsdown",
58
- "watch": "tsdown --watch"
59
53
  }
60
54
  }