relacher 0.0.4 → 0.0.5-rc.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/lib-types/index.d.ts +1 -0
- package/lib-types/prepare.d.ts +10 -14
- package/lib-types/run.d.ts +6 -4
- package/lib-types/types.d.ts +7 -80
- package/lib-types/updater/builder.d.ts +6 -5
- package/lib-types/updater/changelog.d.ts +1 -4
- package/lib-types/updater/json.d.ts +1 -3
- package/lib-types/updater/regex.d.ts +1 -4
- package/lib-types/updater/toml.d.ts +1 -3
- package/lib-types/updater/yaml.d.ts +1 -3
- package/lib-types/vcs/git.d.ts +7 -13
- package/lib-types/vcs/index.d.ts +6 -4
- package/lib-types/vcs/jj.d.ts +9 -13
- package/lib-types/versioning/index.d.ts +21 -0
- package/lib-types/versioning/rc-version-manager.d.ts +19 -0
- package/lib-types/versioning/types.d.ts +21 -0
- package/lib-types/versioning/utils.d.ts +3 -0
- package/lib-types/versioning/vcs-version-manager.d.ts +14 -0
- package/package.json +2 -1
- package/src/index.ts +1 -0
- package/src/prepare.ts +168 -202
- package/src/print.ts +50 -4
- package/src/run.ts +47 -36
- package/src/types.ts +12 -93
- package/src/updater/builder.ts +8 -3
- package/src/updater/changelog.ts +0 -1
- package/src/updater/regex.ts +0 -1
- package/src/vcs/git.ts +96 -84
- package/src/vcs/index.ts +15 -4
- package/src/vcs/jj.ts +104 -92
- package/src/versioning/index.ts +32 -0
- package/src/versioning/rc-version-manager.ts +138 -0
- package/src/versioning/types.ts +21 -0
- package/src/versioning/utils.ts +27 -0
- package/src/versioning/vcs-version-manager.ts +255 -0
- package/lib-types/src/builder/cargo.d.ts +0 -13
- package/lib-types/src/builder/index.d.ts +0 -3
- package/lib-types/src/builder/pnpm.d.ts +0 -13
- package/lib-types/src/builder/shared.d.ts +0 -11
- package/lib-types/src/default-data.d.ts +0 -3
- package/lib-types/src/index.d.ts +0 -6
- package/lib-types/src/prepare.d.ts +0 -15
- package/lib-types/src/print.d.ts +0 -2
- package/lib-types/src/run.d.ts +0 -12
- package/lib-types/src/types.d.ts +0 -71
- package/lib-types/src/updater/changelog.d.ts +0 -10
- package/lib-types/src/updater/index.d.ts +0 -26
- package/lib-types/src/updater/json.d.ts +0 -12
- package/lib-types/src/updater/regex.d.ts +0 -13
- package/lib-types/src/updater/toml.d.ts +0 -12
- package/lib-types/src/vcs/git.d.ts +0 -15
- package/lib-types/src/vcs/index.d.ts +0 -9
- package/lib-types/src/vcs/jj.d.ts +0 -15
- /package/lib-types/{default-data.d.ts → versioning/default-data.d.ts} +0 -0
- /package/src/{default-data.ts → versioning/default-data.ts} +0 -0
package/lib-types/index.d.ts
CHANGED
package/lib-types/prepare.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { Commit, DependencyConfig, DependencyUpdateReport, IntermediateReport, PrepareOptions } from './types';
|
|
2
3
|
import type { UpdateAction, UpdateActionResolved } from './updater';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}>;
|
|
8
|
-
export declare function matchBumpSize(message: string, sizes: SizePatterns): BumpSize;
|
|
9
|
-
export declare function evaluateCommitsBump(commits: Commit[], sizes: SizePatterns): BumpSize;
|
|
4
|
+
import { type VersionManager } from './versioning';
|
|
5
|
+
import type { BumpSize } from './versioning/types';
|
|
6
|
+
export declare function isBumpSizeMatch(actual: BumpSize, pattern: BumpSize): boolean;
|
|
7
|
+
export declare function isUpdateActive(bump: BumpSize, onlyOn?: BumpSize[]): boolean;
|
|
10
8
|
export declare function topologicalSort(items: IntermediateReport[]): IntermediateReport[];
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function finalizeReports(sorted: IntermediateReport[]): DependencyUpdateReport[];
|
|
16
|
-
export declare function mapResolvedUpdates(updates: UpdateAction[], newVersion: string, crateCommits: Commit[], globalCommits: Commit[]): UpdateActionResolved[];
|
|
9
|
+
export declare function initReportItems(cargoDeps: DependencyConfig[], cwd: string, excludeNestedWatches?: boolean): Effect.Effect<IntermediateReport[], Error, VersionManager>;
|
|
10
|
+
export declare function prepare(cargoDeps: DependencyConfig[], options?: PrepareOptions): Effect.Effect<DependencyUpdateReport[], Error, VersionManager>;
|
|
11
|
+
export declare function finalizeReports(sorted: IntermediateReport[], isRCMode: boolean, versionManager?: VersionManager): DependencyUpdateReport[];
|
|
12
|
+
export declare function mapResolvedUpdates(updates: UpdateAction[], newVersion: string, crateCommits: Commit[], globalCommits: Commit[], isRCMode?: boolean, bump?: BumpSize, commitsSincePreRelease?: Commit[]): UpdateActionResolved[];
|
package/lib-types/run.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { DependencyUpdateReport } from './types';
|
|
3
|
+
import { type VcsProvider } from './vcs';
|
|
2
4
|
/**
|
|
3
5
|
* Builds the multi-line commit message showcasing version bumps, included commits,
|
|
4
6
|
* cascade triggers, and first-release indicators.
|
|
5
7
|
*/
|
|
6
8
|
export declare function generateCommitMessage(reports: DependencyUpdateReport[]): string | null;
|
|
7
9
|
/**
|
|
8
|
-
* Applies calculated updates to files on disk, stages, commits, and tags using the
|
|
10
|
+
* Applies calculated updates to files on disk, stages, commits, and tags using the VcsProvider from context.
|
|
9
11
|
*/
|
|
10
|
-
export declare function run(reports: DependencyUpdateReport[],
|
|
12
|
+
export declare function run(reports: DependencyUpdateReport[], options: {
|
|
11
13
|
cwd: string;
|
|
12
|
-
}):
|
|
14
|
+
}): Effect.Effect<void, Error, VcsProvider>;
|
package/lib-types/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { UpdateAction, UpdateActionResolved, VersionFallback } from './updater';
|
|
2
|
-
import type {
|
|
3
|
-
export type BumpSize = 'major' | 'minor' | 'patch' | 'skip';
|
|
2
|
+
import type { BumpSize } from './versioning/types';
|
|
4
3
|
export interface Commit {
|
|
5
4
|
hash: string;
|
|
6
5
|
shortHash: string;
|
|
@@ -16,6 +15,7 @@ export interface ChangelogContext {
|
|
|
16
15
|
version: string;
|
|
17
16
|
date: string;
|
|
18
17
|
commits: Commit[];
|
|
18
|
+
commitsSincePreRelease?: Commit[];
|
|
19
19
|
}
|
|
20
20
|
export interface DependencyConfig {
|
|
21
21
|
name: string;
|
|
@@ -24,96 +24,22 @@ export interface DependencyConfig {
|
|
|
24
24
|
versionFallback?: VersionFallback;
|
|
25
25
|
depends?: string[];
|
|
26
26
|
}
|
|
27
|
-
export interface PatternConfig {
|
|
28
|
-
pattern: string;
|
|
29
|
-
}
|
|
30
|
-
export interface SizePatterns {
|
|
31
|
-
major: PatternConfig;
|
|
32
|
-
minor: PatternConfig;
|
|
33
|
-
patch: PatternConfig;
|
|
34
|
-
skip: PatternConfig;
|
|
35
|
-
}
|
|
36
|
-
export interface CascadeRules {
|
|
37
|
-
skip?: Record<BumpSize, BumpSize>;
|
|
38
|
-
patch?: Record<BumpSize, BumpSize>;
|
|
39
|
-
minor?: Record<BumpSize, BumpSize>;
|
|
40
|
-
major?: Record<BumpSize, BumpSize>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Configuration options for the `prepare` process.
|
|
44
|
-
*/
|
|
45
27
|
export interface PrepareOptions {
|
|
46
|
-
/**
|
|
47
|
-
* The directory from which to run VCS commands and locate repository files.
|
|
48
|
-
* Defaults to `process.cwd()`.
|
|
49
|
-
*
|
|
50
|
-
* @example
|
|
51
|
-
* ```typescript
|
|
52
|
-
* const options = { cwd: "/path/to/my-workspace" };
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
28
|
cwd?: string;
|
|
56
|
-
/**
|
|
57
|
-
* Custom regular expression patterns to match commit messages and categorize
|
|
58
|
-
* them into Semantic Versioning bump sizes (major, minor, patch, or skip).
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const options = {
|
|
63
|
-
* sizes: {
|
|
64
|
-
* major: { pattern: "^BREAKING CHANGE" },
|
|
65
|
-
* minor: { pattern: "^feat|^revert" },
|
|
66
|
-
* patch: { pattern: "^fix|^refactor" },
|
|
67
|
-
* skip: { pattern: "^chore|^docs" }
|
|
68
|
-
* }
|
|
69
|
-
* };
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
sizes?: SizePatterns;
|
|
73
|
-
/**
|
|
74
|
-
* Custom cascade rules defining how semver bumps propagate upwards from
|
|
75
|
-
* dependencies to parent packages.
|
|
76
|
-
*
|
|
77
|
-
* For example, this decides if a `minor` bump in a sub-crate should trigger a
|
|
78
|
-
* `patch` bump in the workspace root package.
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* ```typescript
|
|
82
|
-
* const options = {
|
|
83
|
-
* cascade: {
|
|
84
|
-
* skip: { major: "patch", minor: "patch", patch: "patch" },
|
|
85
|
-
* patch: { major: "patch", minor: "patch", patch: "patch" },
|
|
86
|
-
* minor: { major: "minor", minor: "minor", patch: "minor" },
|
|
87
|
-
* major: { major: "major", minor: "major", patch: "major" }
|
|
88
|
-
* }
|
|
89
|
-
* };
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
cascade?: CascadeRules;
|
|
93
|
-
/**
|
|
94
|
-
* Automatically subtract watch paths of sub-packages when they are physically nested
|
|
95
|
-
* inside a parent package's watch path (unless they are explicitly coupled).
|
|
96
|
-
*
|
|
97
|
-
* This prevents commits made strictly inside a sub-package (such as a procedural macro
|
|
98
|
-
* crate inside its parent crate folder) from incorrectly triggering a commit-based bump
|
|
99
|
-
* on the parent package itself.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* ```typescript
|
|
103
|
-
* const options = { excludeNestedWatches: true };
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
29
|
excludeNestedWatches?: boolean;
|
|
107
30
|
}
|
|
108
31
|
export interface DependencyUpdateReport {
|
|
109
32
|
name: string;
|
|
110
33
|
currentVersion: string;
|
|
34
|
+
lastStableVersion?: string | null;
|
|
111
35
|
newVersion: string;
|
|
112
36
|
bump: BumpSize;
|
|
113
37
|
originalBump?: BumpSize;
|
|
114
38
|
commits: Commit[];
|
|
39
|
+
commitsSincePreRelease?: Commit[];
|
|
115
40
|
updates: UpdateActionResolved[];
|
|
116
41
|
depends?: string[];
|
|
42
|
+
skipTag?: boolean;
|
|
117
43
|
isErroneous?: boolean;
|
|
118
44
|
isFirstRelease?: boolean;
|
|
119
45
|
}
|
|
@@ -122,11 +48,12 @@ export interface IntermediateReport {
|
|
|
122
48
|
currentVersion: string;
|
|
123
49
|
newVersion: string;
|
|
124
50
|
bump: BumpSize;
|
|
51
|
+
lastStableVersion?: string | null;
|
|
125
52
|
originalBump?: BumpSize;
|
|
126
53
|
commits: Commit[];
|
|
54
|
+
commitsSincePreRelease?: Commit[];
|
|
127
55
|
updates: UpdateAction[];
|
|
128
56
|
depends: string[];
|
|
129
57
|
isErroneous?: boolean;
|
|
130
58
|
isFirstRelease?: boolean;
|
|
131
59
|
}
|
|
132
|
-
export type { VcsProvider };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Commit, DependencyUpdateReport } from '../types';
|
|
2
|
+
import type { BumpSize } from '../versioning/types';
|
|
2
3
|
export type UpdateActionOptions = {
|
|
3
4
|
newVersion: string;
|
|
4
5
|
globalCommits: Commit[];
|
|
@@ -15,6 +16,7 @@ export interface UpdateAction {
|
|
|
15
16
|
kind: string;
|
|
16
17
|
path: string;
|
|
17
18
|
required?: boolean;
|
|
19
|
+
onlyOn?: BumpSize[];
|
|
18
20
|
params: any;
|
|
19
21
|
prepare(data: UpdateActionOptions): UpdateActionResolved;
|
|
20
22
|
skipIf(fn: (cwd: string) => boolean): this;
|
|
@@ -39,12 +41,11 @@ export type PrepareActionFnArgs<T> = {
|
|
|
39
41
|
options: UpdateActionOptions;
|
|
40
42
|
};
|
|
41
43
|
type PrepareActionFn<T, K> = (args: PrepareActionFnArgs<T>) => K;
|
|
44
|
+
type Layered<T> = Pick<UpdateAction, 'onlyOn' | 'required'> & T;
|
|
42
45
|
type UpdateBuilderParams<T, K = undefined> = {
|
|
43
46
|
kind: string;
|
|
44
|
-
apply: ApplyActionFn<T
|
|
45
|
-
prepare?: PrepareActionFn<T
|
|
47
|
+
apply: ApplyActionFn<Layered<T>, K>;
|
|
48
|
+
prepare?: PrepareActionFn<Layered<T>, K>;
|
|
46
49
|
};
|
|
47
|
-
export declare const updateBuilder: <T, K = undefined>({ kind, apply, prepare }: UpdateBuilderParams<T, K>) => (targetPath: string, params: T
|
|
48
|
-
required?: boolean;
|
|
49
|
-
}) => UpdateAction;
|
|
50
|
+
export declare const updateBuilder: <T, K = undefined>({ kind, apply, prepare }: UpdateBuilderParams<T, K>) => (targetPath: string, params: Layered<T>) => UpdateAction;
|
|
50
51
|
export {};
|
|
@@ -2,9 +2,6 @@ import { type ChangelogContext } from '../types';
|
|
|
2
2
|
export type ChangelogUpdateParams = {
|
|
3
3
|
global?: boolean;
|
|
4
4
|
template?: (ctx: ChangelogContext) => string;
|
|
5
|
-
required?: boolean;
|
|
6
5
|
};
|
|
7
|
-
export declare const changelogUpdate: (targetPath: string, params:
|
|
8
|
-
required?: boolean;
|
|
9
|
-
}) => import("./builder").UpdateAction;
|
|
6
|
+
export declare const changelogUpdate: (targetPath: string, params: Pick<import("./builder").UpdateAction, "onlyOn" | "required"> & ChangelogUpdateParams) => import("./builder").UpdateAction;
|
|
10
7
|
export declare function defaultChangelogTemplate({ version, date, commits }: ChangelogContext): string;
|
|
@@ -6,6 +6,4 @@ export type JsonFallbackParams = {
|
|
|
6
6
|
};
|
|
7
7
|
export type JsonUpdateParams = (parsed: any, report: DependencyUpdateReport, reports: DependencyUpdateReport[]) => void;
|
|
8
8
|
export declare const jsonFallback: (params: JsonFallbackParams) => VersionFallback;
|
|
9
|
-
export declare const jsonUpdate: (targetPath: string, params:
|
|
10
|
-
required?: boolean;
|
|
11
|
-
}) => import("./builder").UpdateAction;
|
|
9
|
+
export declare const jsonUpdate: (targetPath: string, params: Pick<import("./builder").UpdateAction, "onlyOn" | "required"> & JsonUpdateParams) => import("./builder").UpdateAction;
|
|
@@ -6,9 +6,6 @@ export type RegexFallbackParams = {
|
|
|
6
6
|
export type RegexUpdateParams = {
|
|
7
7
|
search: string;
|
|
8
8
|
replace: string;
|
|
9
|
-
required?: boolean;
|
|
10
9
|
};
|
|
11
10
|
export declare const regexFallback: (params: RegexFallbackParams) => VersionFallback;
|
|
12
|
-
export declare const regexUpdate: (targetPath: string, params:
|
|
13
|
-
required?: boolean;
|
|
14
|
-
}) => import("./builder").UpdateAction;
|
|
11
|
+
export declare const regexUpdate: (targetPath: string, params: Pick<import("./builder").UpdateAction, "onlyOn" | "required"> & RegexUpdateParams) => import("./builder").UpdateAction;
|
|
@@ -6,6 +6,4 @@ export type TomlFallbackParams = {
|
|
|
6
6
|
};
|
|
7
7
|
export type TomlUpdateParams = (parsed: any, report: DependencyUpdateReport, reports: DependencyUpdateReport[]) => void;
|
|
8
8
|
export declare const tomlFallback: (params: TomlFallbackParams) => VersionFallback;
|
|
9
|
-
export declare const tomlUpdate: (targetPath: string, params:
|
|
10
|
-
required?: boolean;
|
|
11
|
-
}) => import("./builder").UpdateAction;
|
|
9
|
+
export declare const tomlUpdate: (targetPath: string, params: Pick<import("./builder").UpdateAction, "onlyOn" | "required"> & TomlUpdateParams) => import("./builder").UpdateAction;
|
|
@@ -6,6 +6,4 @@ export type YamlFallbackParams = {
|
|
|
6
6
|
};
|
|
7
7
|
export type YamlUpdateParams = (parsed: any, report: DependencyUpdateReport, reports: DependencyUpdateReport[]) => void;
|
|
8
8
|
export declare const yamlFallback: (params: YamlFallbackParams) => VersionFallback;
|
|
9
|
-
export declare const yamlUpdate: (targetPath: string, params:
|
|
10
|
-
required?: boolean;
|
|
11
|
-
}) => import("./builder").UpdateAction;
|
|
9
|
+
export declare const yamlUpdate: (targetPath: string, params: Pick<import("./builder").UpdateAction, "onlyOn" | "required"> & YamlUpdateParams) => import("./builder").UpdateAction;
|
package/lib-types/vcs/git.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Effect, Layer } from 'effect';
|
|
2
|
+
import type { Commit } from '../types';
|
|
3
|
+
import { type VcsProvider } from './index';
|
|
4
|
+
export declare function runGit(cmd: string, cwd: string): Effect.Effect<string, never>;
|
|
3
5
|
export declare function findLatestTag(tags: string[], prefix: string): string | null;
|
|
4
6
|
export declare function resolveGitTag(name: string, allTags: string[]): string | null;
|
|
5
|
-
export declare function getGitCommits(name: string, watch: string[], allTags: string[], cwd: string, exclude?: string[]): Commit[]
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
private allTags;
|
|
9
|
-
constructor(cwd: string);
|
|
10
|
-
private getAllTags;
|
|
11
|
-
getCommits(name: string, watch: string[], exclude?: string[]): Promise<Commit[]>;
|
|
12
|
-
getLatestTag(name?: string): Promise<string | null>;
|
|
13
|
-
commit(message: string): Promise<void>;
|
|
14
|
-
tag(tagName: string): Promise<void>;
|
|
15
|
-
}
|
|
7
|
+
export declare function getGitCommits(name: string, watch: string[], allTags: string[], cwd: string, exclude?: string[]): Effect.Effect<Commit[], never>;
|
|
8
|
+
export declare function makeGitVcsProvider(cwd: string): VcsProvider;
|
|
9
|
+
export declare const GitVcsProviderLive: (cwd: string) => Layer.Layer<VcsProvider, never, never>;
|
package/lib-types/vcs/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { Context, Effect } from 'effect';
|
|
1
2
|
import type { Commit } from '../types';
|
|
2
3
|
export interface VcsProvider {
|
|
3
|
-
getCommits(name: string, watch: string[], exclude?: string[])
|
|
4
|
-
getLatestTag(name?: string)
|
|
5
|
-
commit(message: string)
|
|
6
|
-
tag(tagName: string)
|
|
4
|
+
readonly getCommits: (name: string, watch: string[], exclude?: string[]) => Effect.Effect<Commit[], Error>;
|
|
5
|
+
readonly getLatestTag: (name?: string) => Effect.Effect<string | null, Error>;
|
|
6
|
+
readonly commit: (message: string) => Effect.Effect<void, Error>;
|
|
7
|
+
readonly tag: (tagName: string) => Effect.Effect<void, Error>;
|
|
7
8
|
}
|
|
9
|
+
export declare const VcsProviderService: Context.Service<VcsProvider, VcsProvider>;
|
|
8
10
|
export * from './git';
|
|
9
11
|
export * from './jj';
|
package/lib-types/vcs/jj.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Effect, Layer } from 'effect';
|
|
2
|
+
import type { Commit } from '../types';
|
|
3
|
+
import { type VcsProvider } from './index';
|
|
4
|
+
export declare function runJj(cmd: string, cwd: string, opts?: {
|
|
5
|
+
withStdio: boolean;
|
|
6
|
+
}): Effect.Effect<string, never>;
|
|
3
7
|
export declare function findLatestJjTag(tags: string[], prefix: string): string | null;
|
|
4
8
|
export declare function resolveJjTag(name: string, allTags: string[]): string | null;
|
|
5
|
-
export declare function getJjCommits(name: string, watch: string[], allTags: string[], cwd: string, exclude?: string[]): Commit[]
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
private allTags;
|
|
9
|
-
constructor(cwd: string);
|
|
10
|
-
private getAllTags;
|
|
11
|
-
getCommits(name: string, watch: string[], exclude?: string[]): Promise<Commit[]>;
|
|
12
|
-
getLatestTag(name?: string): Promise<string | null>;
|
|
13
|
-
commit(message: string): Promise<void>;
|
|
14
|
-
tag(tagName: string): Promise<void>;
|
|
15
|
-
}
|
|
9
|
+
export declare function getJjCommits(name: string, watch: string[], allTags: string[], cwd: string, exclude?: string[]): Effect.Effect<Commit[], never>;
|
|
10
|
+
export declare function makeJjVcsProvider(cwd: string): VcsProvider;
|
|
11
|
+
export declare const JjVcsProviderLive: (cwd: string) => Layer.Layer<VcsProvider, never, never>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context, Effect } from 'effect';
|
|
2
|
+
import type { Commit, DependencyConfig, IntermediateReport } from '../types';
|
|
3
|
+
import type { BumpSize } from './types';
|
|
4
|
+
export interface VersionManager {
|
|
5
|
+
readonly isRCMode: boolean;
|
|
6
|
+
readonly tagPrereleases: boolean;
|
|
7
|
+
readonly getCurrentVersion: (dep: DependencyConfig, cwd: string) => Effect.Effect<{
|
|
8
|
+
version: string | null;
|
|
9
|
+
isFallback: boolean;
|
|
10
|
+
lastStableVersion?: string | null;
|
|
11
|
+
}, Error>;
|
|
12
|
+
readonly getCommits: (dep: DependencyConfig, excludePaths: string[]) => Effect.Effect<Commit[], Error>;
|
|
13
|
+
readonly evaluateCommitsBump: (commits: Commit[]) => BumpSize;
|
|
14
|
+
readonly propagateBumps: (sorted: IntermediateReport[]) => void;
|
|
15
|
+
readonly propagateCoupledBumps: (sorted: IntermediateReport[]) => void;
|
|
16
|
+
readonly bumpVersion: (currentVersion: string, size: BumpSize) => string;
|
|
17
|
+
readonly shouldTag: (version: string) => boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const VersionManagerService: Context.Service<VersionManager, VersionManager>;
|
|
20
|
+
export * from './vcs-version-manager';
|
|
21
|
+
export * from './rc-version-manager';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Layer } from 'effect';
|
|
2
|
+
import { type VcsProvider } from '../vcs';
|
|
3
|
+
import type { CascadeRules, SizePatterns } from './types';
|
|
4
|
+
type RcVersionManagerOptions = {
|
|
5
|
+
sizes?: SizePatterns;
|
|
6
|
+
cascade?: CascadeRules;
|
|
7
|
+
rcIdentifier?: string;
|
|
8
|
+
upgradeReady?: boolean;
|
|
9
|
+
tagPrereleases?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const makeRCVersionManager: (vcs: VcsProvider, options?: RcVersionManagerOptions) => import(".").VersionManager;
|
|
12
|
+
export declare const RCVersionManagerLive: (options?: {
|
|
13
|
+
sizes?: SizePatterns;
|
|
14
|
+
cascade?: CascadeRules;
|
|
15
|
+
rcIdentifier?: string;
|
|
16
|
+
upgradeReady?: boolean;
|
|
17
|
+
tagPrereleases?: boolean;
|
|
18
|
+
}) => Layer.Layer<import(".").VersionManager, never, VcsProvider>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type PreRelease = {
|
|
2
|
+
kind: 'pre';
|
|
3
|
+
size?: string;
|
|
4
|
+
};
|
|
5
|
+
export type BumpSize = 'major' | 'minor' | 'patch' | PreRelease | 'skip';
|
|
6
|
+
export interface PatternConfig {
|
|
7
|
+
pattern: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SizePatterns {
|
|
10
|
+
major: PatternConfig;
|
|
11
|
+
minor: PatternConfig;
|
|
12
|
+
patch: PatternConfig;
|
|
13
|
+
skip: PatternConfig;
|
|
14
|
+
}
|
|
15
|
+
export interface CascadeRules {
|
|
16
|
+
skip?: Record<string, BumpSize>;
|
|
17
|
+
patch?: Record<string, BumpSize>;
|
|
18
|
+
minor?: Record<string, BumpSize>;
|
|
19
|
+
major?: Record<string, BumpSize>;
|
|
20
|
+
[key: string]: Record<string, BumpSize> | undefined;
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Layer } from 'effect';
|
|
2
|
+
import { type VcsProvider } from '../vcs';
|
|
3
|
+
import type { BumpSize, CascadeRules, SizePatterns } from './types';
|
|
4
|
+
export declare const makeVcsVersionManager: (vcs: VcsProvider, options?: {
|
|
5
|
+
sizes?: SizePatterns;
|
|
6
|
+
cascade?: CascadeRules;
|
|
7
|
+
bumpVersionImpl?: (version: string, size: BumpSize) => string;
|
|
8
|
+
isRCMode?: boolean;
|
|
9
|
+
tagPrereleases?: boolean;
|
|
10
|
+
}) => import(".").VersionManager;
|
|
11
|
+
export declare const VcsVersionManagerLive: (options?: {
|
|
12
|
+
sizes?: SizePatterns;
|
|
13
|
+
cascade?: CascadeRules;
|
|
14
|
+
}) => Layer.Layer<import(".").VersionManager, never, VcsProvider>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relacher",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5-rc.0",
|
|
4
4
|
"description": "Scriptable release orchestration library for monorepos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@decimalturn/toml-patch": "^2.0.0",
|
|
63
|
+
"effect": "^4.0.0-beta.78",
|
|
63
64
|
"jsonc-parser": "^3.3.1",
|
|
64
65
|
"smol-toml": "^1.6.1",
|
|
65
66
|
"yaml": "^2.9.0"
|
package/src/index.ts
CHANGED