@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/dist/index.d.cts DELETED
@@ -1,211 +0,0 @@
1
- import { LoadOptions } from '@releasekit/config';
2
- import { ReleaseType } from 'semver';
3
- import { Packages, Package } from '@manypkg/get-packages';
4
- import { ReleaseKitError, VersionPackageChangelog } from '@releasekit/core';
5
-
6
- interface VersionConfigBase {
7
- versionPrefix: string;
8
- type?: ReleaseType;
9
- prereleaseIdentifier?: string;
10
- branchPattern?: string[];
11
- baseBranch?: string;
12
- path?: string;
13
- name?: string;
14
- strictReachable?: boolean;
15
- }
16
- interface Config extends VersionConfigBase {
17
- tagTemplate: string;
18
- packageSpecificTags?: boolean;
19
- preset: string;
20
- sync: boolean;
21
- packages: string[];
22
- mainPackage?: string;
23
- updateInternalDependencies: 'major' | 'minor' | 'patch' | 'no-internal-update';
24
- skip?: string[];
25
- commitMessage?: string;
26
- versionStrategy?: 'branchPattern' | 'commitMessage';
27
- branchPatterns?: BranchPattern[];
28
- defaultReleaseType?: ReleaseType;
29
- skipHooks?: boolean;
30
- dryRun?: boolean;
31
- latestTag?: string;
32
- isPrerelease?: boolean;
33
- mismatchStrategy?: 'error' | 'warn' | 'ignore' | 'prefer-package' | 'prefer-git';
34
- strictReachable?: boolean;
35
- cargo?: {
36
- enabled?: boolean;
37
- paths?: string[];
38
- };
39
- }
40
- interface BranchPattern {
41
- pattern: string;
42
- releaseType: ReleaseType;
43
- }
44
- interface VersionOptions extends VersionConfigBase {
45
- latestTag: string;
46
- }
47
-
48
- declare function loadConfig(options?: LoadOptions): Config;
49
-
50
- /**
51
- * Version calculation logic
52
- */
53
-
54
- /**
55
- * Calculates the next version number based on the current version and options
56
- */
57
- declare function calculateVersion(config: Config, options: VersionOptions): Promise<string>;
58
-
59
- /**
60
- * Strategy functions for versioning using the higher-order function pattern
61
- */
62
-
63
- /**
64
- * Available strategy types
65
- */
66
- type StrategyType = 'sync' | 'single' | 'async';
67
- /**
68
- * Strategy function type
69
- */
70
- type StrategyFunction = (packages: PackagesWithRoot, targets?: string[]) => Promise<void>;
71
- /**
72
- * Create a sync versioning strategy function
73
- */
74
- declare function createSyncStrategy(config: Config): StrategyFunction;
75
- /**
76
- * Create a single package versioning strategy function
77
- */
78
- declare function createSingleStrategy(config: Config): StrategyFunction;
79
- /**
80
- * Create an async package versioning strategy function
81
- */
82
- declare function createAsyncStrategy(config: Config): StrategyFunction;
83
-
84
- interface PackagesWithRoot extends Packages {
85
- root: string;
86
- }
87
- /**
88
- * Main versioning engine that uses functional strategies
89
- */
90
- declare class VersionEngine {
91
- private config;
92
- private workspaceCache;
93
- private strategies;
94
- private currentStrategy;
95
- constructor(config: Config, _jsonMode?: boolean);
96
- /**
97
- * Get workspace packages information - with caching for performance
98
- */
99
- getWorkspacePackages(): Promise<PackagesWithRoot>;
100
- /**
101
- * Run the current strategy
102
- * @param packages Workspace packages to process
103
- * @param targets Optional package targets to process (only used by async strategy)
104
- */
105
- run(packages: PackagesWithRoot, targets?: string[]): Promise<void>;
106
- /**
107
- * Change the current strategy
108
- * @param strategyType The strategy type to use: 'sync', 'single', or 'async'
109
- */
110
- setStrategy(strategyType: StrategyType): void;
111
- }
112
-
113
- /**
114
- * Version-specific base error that bridges the factory pattern
115
- * used by @releasekit/version with the abstract ReleaseKitError base.
116
- */
117
- declare class BaseVersionError extends ReleaseKitError {
118
- readonly code: string;
119
- readonly suggestions: string[];
120
- constructor(message: string, code: string, suggestions?: string[]);
121
- static isVersionError(error: unknown): error is BaseVersionError;
122
- }
123
-
124
- /**
125
- * Custom error class for versioning operations
126
- */
127
- declare class VersionError extends BaseVersionError {
128
- }
129
- /**
130
- * Error codes for versioning operations
131
- */
132
- declare enum VersionErrorCode {
133
- CONFIG_REQUIRED = "CONFIG_REQUIRED",
134
- PACKAGES_NOT_FOUND = "PACKAGES_NOT_FOUND",
135
- WORKSPACE_ERROR = "WORKSPACE_ERROR",
136
- INVALID_CONFIG = "INVALID_CONFIG",
137
- PACKAGE_NOT_FOUND = "PACKAGE_NOT_FOUND",
138
- VERSION_CALCULATION_ERROR = "VERSION_CALCULATION_ERROR"
139
- }
140
- /**
141
- * Creates a VersionError with standard error message for common failure scenarios
142
- * @param code Error code
143
- * @param details Additional error details
144
- * @returns VersionError instance
145
- */
146
- declare function createVersionError(code: VersionErrorCode, details?: string): VersionError;
147
-
148
- interface PackageProcessorOptions {
149
- skip?: string[];
150
- versionPrefix?: string;
151
- tagTemplate?: string;
152
- commitMessageTemplate?: string;
153
- dryRun?: boolean;
154
- skipHooks?: boolean;
155
- getLatestTag: () => Promise<string | null>;
156
- config: Omit<VersionConfigBase, 'versionPrefix' | 'path' | 'name'>;
157
- fullConfig: Config;
158
- }
159
- interface ProcessResult {
160
- updatedPackages: Array<{
161
- name: string;
162
- version: string;
163
- path: string;
164
- }>;
165
- commitMessage?: string;
166
- tags: string[];
167
- }
168
- declare class PackageProcessor {
169
- private skip;
170
- private versionPrefix;
171
- private tagTemplate?;
172
- private commitMessageTemplate;
173
- private dryRun;
174
- private skipHooks;
175
- private getLatestTag;
176
- private config;
177
- private fullConfig;
178
- constructor(options: PackageProcessorOptions);
179
- /**
180
- * Process packages based on skip list only (targeting handled at discovery time)
181
- */
182
- processPackages(packages: Package[]): Promise<ProcessResult>;
183
- }
184
-
185
- /**
186
- * JSON Output service for releasekit-version
187
- * Centralizes all JSON output handling
188
- */
189
-
190
- interface JsonOutputData {
191
- dryRun: boolean;
192
- updates: Array<{
193
- packageName: string;
194
- newVersion: string;
195
- filePath: string;
196
- }>;
197
- changelogs: VersionPackageChangelog[];
198
- commitMessage?: string;
199
- tags: string[];
200
- }
201
- /**
202
- * Enable JSON output mode
203
- * @param dryRun Whether this is a dry run
204
- */
205
- declare function enableJsonOutput(dryRun?: boolean): void;
206
- /**
207
- * Get the current JSON output data (for testing)
208
- */
209
- declare function getJsonData(): JsonOutputData;
210
-
211
- export { BaseVersionError, type Config, type JsonOutputData, PackageProcessor, type VersionConfigBase, VersionEngine, VersionErrorCode, calculateVersion, createAsyncStrategy, createSingleStrategy, createSyncStrategy, createVersionError, enableJsonOutput, getJsonData, loadConfig };