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