@releasekit/version 0.2.0 → 0.2.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 CHANGED
@@ -22,6 +22,8 @@ npm install -g @releasekit/version
22
22
  pnpm add -g @releasekit/version
23
23
  ```
24
24
 
25
+ > **Note:** This package is ESM only and requires Node.js 20+.
26
+
25
27
  ## Quick Start
26
28
 
27
29
  ```bash
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseVersionError
3
- } from "./chunk-GQLJ7JQY.js";
3
+ } from "./chunk-PVBHVUZB.js";
4
4
  export {
5
5
  BaseVersionError as BasePackageVersionerError,
6
6
  BaseVersionError
@@ -0,0 +1,71 @@
1
+ // ../core/dist/index.js
2
+ import chalk from "chalk";
3
+ var LOG_LEVELS = {
4
+ error: 0,
5
+ warn: 1,
6
+ info: 2,
7
+ debug: 3,
8
+ trace: 4
9
+ };
10
+ var PREFIXES = {
11
+ error: "[ERROR]",
12
+ warn: "[WARN]",
13
+ info: "[INFO]",
14
+ debug: "[DEBUG]",
15
+ trace: "[TRACE]"
16
+ };
17
+ var COLORS = {
18
+ error: chalk.red,
19
+ warn: chalk.yellow,
20
+ info: chalk.blue,
21
+ debug: chalk.gray,
22
+ trace: chalk.dim
23
+ };
24
+ var currentLevel = "info";
25
+ var quietMode = false;
26
+ function shouldLog(level) {
27
+ if (quietMode && level !== "error") return false;
28
+ return LOG_LEVELS[level] <= LOG_LEVELS[currentLevel];
29
+ }
30
+ function log(message, level = "info") {
31
+ if (!shouldLog(level)) return;
32
+ const formatted = COLORS[level](`${PREFIXES[level]} ${message}`);
33
+ console.error(formatted);
34
+ }
35
+ var ReleaseKitError = class _ReleaseKitError extends Error {
36
+ constructor(message) {
37
+ super(message);
38
+ this.name = this.constructor.name;
39
+ }
40
+ logError() {
41
+ log(this.message, "error");
42
+ if (this.suggestions.length > 0) {
43
+ log("\nSuggested solutions:", "info");
44
+ for (const [i, suggestion] of this.suggestions.entries()) {
45
+ log(`${i + 1}. ${suggestion}`, "info");
46
+ }
47
+ }
48
+ }
49
+ static isReleaseKitError(error2) {
50
+ return error2 instanceof _ReleaseKitError;
51
+ }
52
+ };
53
+
54
+ // src/errors/baseError.ts
55
+ var BaseVersionError = class _BaseVersionError extends ReleaseKitError {
56
+ code;
57
+ suggestions;
58
+ constructor(message, code, suggestions) {
59
+ super(message);
60
+ this.code = code;
61
+ this.suggestions = suggestions ?? [];
62
+ }
63
+ static isVersionError(error) {
64
+ return error instanceof _BaseVersionError;
65
+ }
66
+ };
67
+
68
+ export {
69
+ ReleaseKitError,
70
+ BaseVersionError
71
+ };