relacher 0.0.1 → 0.0.3

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 (52) hide show
  1. package/README.md +12 -16
  2. package/lib-types/builder/cargo.d.ts +6 -6
  3. package/lib-types/builder/shared.d.ts +2 -3
  4. package/lib-types/default-data.d.ts +3 -0
  5. package/lib-types/index.d.ts +1 -0
  6. package/lib-types/prepare.d.ts +7 -6
  7. package/lib-types/run.d.ts +5 -0
  8. package/lib-types/src/builder/cargo.d.ts +13 -0
  9. package/lib-types/src/builder/index.d.ts +3 -0
  10. package/lib-types/src/builder/pnpm.d.ts +13 -0
  11. package/lib-types/src/builder/shared.d.ts +11 -0
  12. package/lib-types/src/default-data.d.ts +3 -0
  13. package/lib-types/src/index.d.ts +6 -0
  14. package/lib-types/src/prepare.d.ts +15 -0
  15. package/lib-types/src/print.d.ts +2 -0
  16. package/lib-types/src/run.d.ts +12 -0
  17. package/lib-types/src/types.d.ts +71 -0
  18. package/lib-types/src/updater/changelog.d.ts +10 -0
  19. package/lib-types/src/updater/index.d.ts +26 -0
  20. package/lib-types/src/updater/json.d.ts +12 -0
  21. package/lib-types/src/updater/regex.d.ts +13 -0
  22. package/lib-types/src/updater/toml.d.ts +12 -0
  23. package/lib-types/src/vcs/git.d.ts +15 -0
  24. package/lib-types/src/vcs/index.d.ts +9 -0
  25. package/lib-types/src/vcs/jj.d.ts +15 -0
  26. package/lib-types/types.d.ts +9 -25
  27. package/lib-types/updater/changelog.d.ts +10 -0
  28. package/lib-types/updater/index.d.ts +26 -0
  29. package/lib-types/updater/json.d.ts +12 -0
  30. package/lib-types/updater/regex.d.ts +13 -0
  31. package/lib-types/updater/toml.d.ts +12 -0
  32. package/lib-types/vcs/git.d.ts +1 -0
  33. package/lib-types/vcs/index.d.ts +1 -0
  34. package/lib-types/vcs/jj.d.ts +1 -0
  35. package/package.json +2 -2
  36. package/src/builder/cargo.ts +81 -18
  37. package/src/builder/pnpm.ts +14 -12
  38. package/src/builder/shared.ts +2 -9
  39. package/src/default-data.ts +15 -0
  40. package/src/index.ts +1 -0
  41. package/src/prepare.ts +68 -108
  42. package/src/print.ts +9 -4
  43. package/src/run.ts +50 -56
  44. package/src/types.ts +14 -46
  45. package/src/updater/changelog.ts +76 -0
  46. package/src/updater/index.ts +31 -0
  47. package/src/updater/json.ts +95 -0
  48. package/src/updater/regex.ts +48 -0
  49. package/src/updater/toml.ts +57 -0
  50. package/src/vcs/git.ts +24 -3
  51. package/src/vcs/index.ts +1 -0
  52. package/src/vcs/jj.ts +23 -6
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Relache
1
+ # Relacher
2
2
 
3
- ![NPM Version](https://img.shields.io/npm/v/relache?color=green)
4
- ![NPM Downloads](https://img.shields.io/npm/dw/relache?label=npm)
3
+ ![NPM Version](https://img.shields.io/npm/v/relacher?color=green)
4
+ ![NPM Downloads](https://img.shields.io/npm/dw/relacher?label=npm)
5
5
  [![License](https://img.shields.io/github/license/emilien-jegou/oyui)](./LICENSE)
6
6
 
7
- **Relache** is a scriptable, workspace-aware release orchestration library and CLI tool designed specifically for multi-package workspaces.
7
+ **Relacher** is a scriptable, workspace-aware release orchestration library designed for monorepos.
8
8
 
9
9
  ```
10
10
  📦 cli_tool 3.1.2 → 3.3.0 [minor]
@@ -22,15 +22,11 @@
22
22
 
23
23
  ---
24
24
 
25
- ### Why relache?
25
+ ### Why another Versionning tool?
26
26
 
27
- Most releases tools are configuration based, they often run as "all-or-nothing" CI black boxes. You execute the command, and it commits, tags, and publishes automatically.
27
+ Most releases tools are configuration based, they often run as "all-or-nothing" CI black boxes. You execute the command, and it commits, tags, and publishes automatically. Think of them as large functions that take your whole toml config and repo state as arguments.
28
28
 
29
- Think of them as large functions that take your whole toml config and repo state as arguments.
30
-
31
- Since relache is exposed as a typescript library you have full control of each step of the release lifecycle, you can replace or extends blocks as-needed without needing an extensive plugin system.
32
-
33
- It's also meant to be used to update thoses annoying tasks of updating the version in deeply nested places. e.g. a frontend component, a readme...
29
+ Since relacher is exposed as a typescript library you have full control of each step of the release lifecycle, you can replace or extends blocks as-needed without needing an extensive plugin system.
34
30
 
35
31
  ```typescript
36
32
  // cargoDeps will analyzer your workspace and form a graph of every crates
@@ -115,12 +111,12 @@ It's also meant to be used to update thoses annoying tasks of updating the versi
115
111
 
116
112
  ## 📦 Installation
117
113
 
118
- Add `relache` to your JavaScript or TypeScript workspace:
114
+ Add `relacher` to your JavaScript or TypeScript workspace:
119
115
 
120
116
  ```sh
121
- bun add relache --dev
117
+ bun add relacher --dev
122
118
  # or
123
- pnpm install relache --save-dev
119
+ pnpm install relacher --save-dev
124
120
  ```
125
121
 
126
122
  ---
@@ -128,10 +124,10 @@ pnpm install relache --save-dev
128
124
  ## 🛠️ Configuration & Customization
129
125
 
130
126
  ### Designing Custom Changelogs
131
- You can supply your own renderer directly through the `template` option in `changelogUpdate`, bypassing rigid markdown configurations:
127
+ You can supply your own renderer directly through the `template` option in `changelogUpdate`:
132
128
 
133
129
  ```typescript
134
- import type { ChangelogContext } from "relache";
130
+ import type { ChangelogContext } from "relacher";
135
131
 
136
132
  function customTemplate({ version, date, commits }: ChangelogContext): string {
137
133
  let lines = [`## [${version}] - ${date}\n`];
@@ -1,13 +1,13 @@
1
1
  import { type DependencyList } from './shared';
2
+ export interface CargoBuilderOptions {
3
+ syncWorkspaceDeps?: boolean;
4
+ }
2
5
  /**
3
6
  * Loads a single Cargo project from a target Cargo.toml.
4
7
  */
5
8
  export declare function cargoProject(cwd: string): DependencyList;
6
9
  /**
7
- * Loads a Cargo workspace, tracking member paths and dependency links.
10
+ * Loads a Cargo workspace, tracking member paths, dependency links, and recursive nested paths.
8
11
  */
9
- export declare function cargoWorkspace(cwd: string): DependencyList;
10
- /**
11
- * Auto-detects whether the directory corresponds to a workspace or single-project setup.
12
- */
13
- export declare function cargoDeps(cwd: string): DependencyList;
12
+ export declare function cargoWorkspace(cwd: string, options?: CargoBuilderOptions): DependencyList;
13
+ export declare function cargoDeps(cwd: string, options?: CargoBuilderOptions): DependencyList;
@@ -1,6 +1,5 @@
1
- import type { ChangelogUpdate, RegexUpdate, DependencyConfig, UpdateAction } from '../types';
2
- export declare function changelogUpdate(options: Omit<ChangelogUpdate, 'kind'>): ChangelogUpdate;
3
- export declare function regexUpdate(options: Omit<RegexUpdate, 'kind'>): RegexUpdate;
1
+ import type { DependencyConfig } from '../types';
2
+ import type { UpdateAction } from '../updater';
4
3
  export declare class SingleDependencyBuilder {
5
4
  private config;
6
5
  constructor(config: DependencyConfig);
@@ -0,0 +1,3 @@
1
+ import type { CascadeRules, SizePatterns } from './types';
2
+ export declare const defaultSizes: SizePatterns;
3
+ export declare const defaultCascadeRules: Required<CascadeRules>;
@@ -4,3 +4,4 @@ export * from './vcs';
4
4
  export * from './builder';
5
5
  export * from './print';
6
6
  export * from './types';
7
+ export * from './updater';
@@ -1,14 +1,15 @@
1
- import { type BumpSize, type Commit, type VcsProvider, type DependencyConfig, type DependencyUpdateReport, type IntermediateReport, type PrepareOptions, type SizePatterns, type CascadeRules, type UpdateAction, type ChangelogContext } from './types';
2
- export declare function getTomlValue(content: string): string | null;
1
+ import type { BumpSize, Commit, VcsProvider, DependencyConfig, DependencyUpdateReport, IntermediateReport, PrepareOptions, SizePatterns, CascadeRules } from './types';
2
+ import type { UpdateAction, UpdateActionResolved } from './updater';
3
3
  export declare function bumpVersion(version: string, size: BumpSize): string;
4
- export declare function getCurrentVersion(dep: DependencyConfig, cwd: string): string;
4
+ export declare function getCurrentVersion(dep: DependencyConfig, vcs: VcsProvider, cwd: string): Promise<{
5
+ version: string | null;
6
+ isFallback: boolean;
7
+ }>;
5
8
  export declare function matchBumpSize(message: string, sizes: SizePatterns): BumpSize;
6
9
  export declare function evaluateCommitsBump(commits: Commit[], sizes: SizePatterns): BumpSize;
7
10
  export declare function topologicalSort(items: IntermediateReport[]): IntermediateReport[];
8
11
  export declare function propagateBumps(sorted: IntermediateReport[], rules?: CascadeRules): void;
9
12
  export declare function initReportItems(cargoDeps: DependencyConfig[], vcs: VcsProvider, sizes: SizePatterns, cwd: string): Promise<IntermediateReport[]>;
10
13
  export declare function prepare(cargoDeps: DependencyConfig[], vcs: VcsProvider, options?: PrepareOptions): Promise<DependencyUpdateReport[]>;
11
- export declare function buildChangelogBlock(version: string, commits: Commit[]): string;
12
14
  export declare function finalizeReports(sorted: IntermediateReport[]): DependencyUpdateReport[];
13
- export declare function defaultChangelogTemplate({ version, date, commits }: ChangelogContext): string;
14
- export declare function mapResolvedUpdates(updates: UpdateAction[], newVersion: string, crateCommits: Commit[], globalCommits: Commit[]): UpdateAction[];
15
+ export declare function mapResolvedUpdates(updates: UpdateAction[], newVersion: string, crateCommits: Commit[], globalCommits: Commit[]): UpdateActionResolved[];
@@ -1,4 +1,9 @@
1
1
  import type { DependencyUpdateReport, VcsProvider } from './types';
2
+ /**
3
+ * Builds the multi-line commit message showcasing version bumps, included commits,
4
+ * cascade triggers, and first-release indicators.
5
+ */
6
+ export declare function generateCommitMessage(reports: DependencyUpdateReport[]): string | null;
2
7
  /**
3
8
  * Applies calculated updates to files on disk, stages, commits, and tags using the provided VcsProvider.
4
9
  */
@@ -0,0 +1,13 @@
1
+ import { type DependencyList } from './shared';
2
+ export interface CargoBuilderOptions {
3
+ syncWorkspaceDeps?: boolean;
4
+ }
5
+ /**
6
+ * Loads a single Cargo project from a target Cargo.toml.
7
+ */
8
+ export declare function cargoProject(cwd: string): DependencyList;
9
+ /**
10
+ * Loads a Cargo workspace, tracking member paths, dependency links, and recursive nested paths.
11
+ */
12
+ export declare function cargoWorkspace(cwd: string, options?: CargoBuilderOptions): DependencyList;
13
+ export declare function cargoDeps(cwd: string, options?: CargoBuilderOptions): DependencyList;
@@ -0,0 +1,3 @@
1
+ export * from './shared';
2
+ export * from './cargo';
3
+ export * from './pnpm';
@@ -0,0 +1,13 @@
1
+ import { type DependencyList } from './shared';
2
+ /**
3
+ * Loads a single project package configuration from package.json.
4
+ */
5
+ export declare function pnpmProject(cwd: string): DependencyList;
6
+ /**
7
+ * Parses pnpm-workspace.yaml to identify target members and versioning topologies.
8
+ */
9
+ export declare function pnpmWorkspace(cwd: string): DependencyList;
10
+ /**
11
+ * Auto-detects whether the workspace configuration exists, reverting to single packages.
12
+ */
13
+ export declare function pnpmDeps(cwd: string): DependencyList;
@@ -0,0 +1,11 @@
1
+ import type { DependencyConfig } from '../types';
2
+ import type { UpdateAction } from '../updater';
3
+ export declare class SingleDependencyBuilder {
4
+ private config;
5
+ constructor(config: DependencyConfig);
6
+ update(action: UpdateAction): this;
7
+ }
8
+ export interface DependencyList extends Array<DependencyConfig> {
9
+ on(name: string, cb: (builder: SingleDependencyBuilder) => void): this;
10
+ }
11
+ export declare function decorateList(configs: DependencyConfig[]): DependencyList;
@@ -0,0 +1,3 @@
1
+ import type { CascadeRules, SizePatterns } from './types';
2
+ export declare const defaultSizes: SizePatterns;
3
+ export declare const defaultCascadeRules: Required<CascadeRules>;
@@ -0,0 +1,6 @@
1
+ export * from './prepare';
2
+ export * from './run';
3
+ export * from './vcs';
4
+ export * from './builder';
5
+ export * from './print';
6
+ export * from './types';
@@ -0,0 +1,15 @@
1
+ import type { BumpSize, Commit, VcsProvider, DependencyConfig, DependencyUpdateReport, IntermediateReport, PrepareOptions, SizePatterns, CascadeRules } from './types';
2
+ import type { UpdateAction, UpdateActionResolved } from './updater';
3
+ export declare function bumpVersion(version: string, size: BumpSize): string;
4
+ export declare function getCurrentVersion(dep: DependencyConfig, vcs: VcsProvider, cwd: string): Promise<{
5
+ version: string | null;
6
+ isFallback: boolean;
7
+ }>;
8
+ export declare function matchBumpSize(message: string, sizes: SizePatterns): BumpSize;
9
+ export declare function evaluateCommitsBump(commits: Commit[], sizes: SizePatterns): BumpSize;
10
+ export declare function topologicalSort(items: IntermediateReport[]): IntermediateReport[];
11
+ export declare function propagateBumps(sorted: IntermediateReport[], rules?: CascadeRules): void;
12
+ export declare function initReportItems(cargoDeps: DependencyConfig[], vcs: VcsProvider, sizes: SizePatterns, cwd: string): Promise<IntermediateReport[]>;
13
+ export declare function prepare(cargoDeps: DependencyConfig[], vcs: VcsProvider, options?: PrepareOptions): Promise<DependencyUpdateReport[]>;
14
+ export declare function finalizeReports(sorted: IntermediateReport[]): DependencyUpdateReport[];
15
+ export declare function mapResolvedUpdates(updates: UpdateAction[], newVersion: string, crateCommits: Commit[], globalCommits: Commit[]): UpdateActionResolved[];
@@ -0,0 +1,2 @@
1
+ import type { DependencyUpdateReport } from './types';
2
+ export declare function prettyPrint(reports: DependencyUpdateReport[]): void;
@@ -0,0 +1,12 @@
1
+ import type { DependencyUpdateReport, VcsProvider } from './types';
2
+ /**
3
+ * Builds the multi-line commit message showcasing version bumps, included commits,
4
+ * cascade triggers, and first-release indicators.
5
+ */
6
+ export declare function generateCommitMessage(reports: DependencyUpdateReport[]): string | null;
7
+ /**
8
+ * Applies calculated updates to files on disk, stages, commits, and tags using the provided VcsProvider.
9
+ */
10
+ export declare function run(reports: DependencyUpdateReport[], vcs: VcsProvider, options: {
11
+ cwd: string;
12
+ }): Promise<void>;
@@ -0,0 +1,71 @@
1
+ import type { UpdateAction, UpdateActionResolved, VersionFallback } from './updater';
2
+ import type { VcsProvider } from './vcs';
3
+ export type BumpSize = 'major' | 'minor' | 'patch' | 'skip';
4
+ export interface Commit {
5
+ hash: string;
6
+ shortHash: string;
7
+ author: string;
8
+ date: string;
9
+ message: string;
10
+ type: string;
11
+ scope: string | null;
12
+ isBreaking: boolean;
13
+ description: string;
14
+ }
15
+ export interface ChangelogContext {
16
+ version: string;
17
+ date: string;
18
+ commits: Commit[];
19
+ }
20
+ export interface DependencyConfig {
21
+ name: string;
22
+ watch?: string[];
23
+ updates: UpdateAction[];
24
+ versionFallback?: VersionFallback;
25
+ depends?: string[];
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
+ export interface PrepareOptions {
43
+ sizes?: SizePatterns;
44
+ cascade?: CascadeRules;
45
+ cwd?: string;
46
+ }
47
+ export interface DependencyUpdateReport {
48
+ name: string;
49
+ currentVersion: string;
50
+ newVersion: string;
51
+ bump: BumpSize;
52
+ originalBump?: BumpSize;
53
+ commits: Commit[];
54
+ updates: UpdateActionResolved[];
55
+ depends?: string[];
56
+ isErroneous?: boolean;
57
+ isFirstRelease?: boolean;
58
+ }
59
+ export interface IntermediateReport {
60
+ name: string;
61
+ currentVersion: string;
62
+ newVersion: string;
63
+ bump: BumpSize;
64
+ originalBump?: BumpSize;
65
+ commits: Commit[];
66
+ updates: UpdateAction[];
67
+ depends: string[];
68
+ isErroneous?: boolean;
69
+ isFirstRelease?: boolean;
70
+ }
71
+ export type { VcsProvider };
@@ -0,0 +1,10 @@
1
+ import type { ChangelogContext } from '../types';
2
+ import type { UpdateAction } from '.';
3
+ export type ChangelogUpdateParams = {
4
+ path: string;
5
+ global?: boolean;
6
+ template?: (ctx: ChangelogContext) => string;
7
+ required?: boolean;
8
+ };
9
+ export declare const changelogUpdate: (params: ChangelogUpdateParams) => UpdateAction;
10
+ export declare function defaultChangelogTemplate({ version, date, commits }: ChangelogContext): string;
@@ -0,0 +1,26 @@
1
+ import type { Commit, DependencyUpdateReport } from '../types';
2
+ export * from './changelog';
3
+ export * from './json';
4
+ export * from './regex';
5
+ export * from './toml';
6
+ export type UpdateActionOptions = {
7
+ newVersion: string;
8
+ globalCommits: Commit[];
9
+ crateCommits: Commit[];
10
+ };
11
+ export interface UpdateActionResolved {
12
+ kind: string;
13
+ path: string;
14
+ apply(report: DependencyUpdateReport, reports: DependencyUpdateReport[], cwd: string): void;
15
+ params: any;
16
+ }
17
+ export interface UpdateAction {
18
+ kind: string;
19
+ path: string;
20
+ required?: boolean;
21
+ params: any;
22
+ prepare(data: UpdateActionOptions): UpdateActionResolved;
23
+ }
24
+ export interface VersionFallback {
25
+ readFallback(cwd: string): string | null;
26
+ }
@@ -0,0 +1,12 @@
1
+ import type { VersionFallback, UpdateAction } from '.';
2
+ export type JsonFallbackParams = {
3
+ path: string;
4
+ json: string;
5
+ };
6
+ export type JsonUpdateParams = {
7
+ path: string;
8
+ json: string;
9
+ required?: boolean;
10
+ };
11
+ export declare const jsonFallback: (params: JsonFallbackParams) => VersionFallback;
12
+ export declare const jsonUpdate: (params: JsonUpdateParams) => UpdateAction;
@@ -0,0 +1,13 @@
1
+ import type { VersionFallback, UpdateAction } from '.';
2
+ export type RegexFallbackParams = {
3
+ path: string;
4
+ search: string;
5
+ };
6
+ export type RegexUpdateParams = {
7
+ path: string;
8
+ search: string;
9
+ replace: string;
10
+ required?: boolean;
11
+ };
12
+ export declare const regexFallback: (params: RegexFallbackParams) => VersionFallback;
13
+ export declare const regexUpdate: (params: RegexUpdateParams) => UpdateAction;
@@ -0,0 +1,12 @@
1
+ import type { VersionFallback, UpdateAction } from '.';
2
+ export type TomlFallbackParams = {
3
+ path: string;
4
+ toml: string;
5
+ };
6
+ export type TomlUpdateParams = {
7
+ path: string;
8
+ toml: string;
9
+ required?: boolean;
10
+ };
11
+ export declare const tomlFallback: (params: TomlFallbackParams) => VersionFallback;
12
+ export declare const tomlUpdate: (params: TomlUpdateParams) => UpdateAction;
@@ -0,0 +1,15 @@
1
+ import type { Commit, VcsProvider } from '../types';
2
+ export declare function runGit(cmd: string, cwd: string): string;
3
+ export declare function findLatestTag(tags: string[], prefix: string): string | null;
4
+ export declare function resolveGitTag(name: string, allTags: string[]): string | null;
5
+ export declare function getGitCommits(name: string, watch: string[], allTags: string[], cwd: string): Commit[];
6
+ export declare class GitVcsProvider implements VcsProvider {
7
+ private cwd;
8
+ private allTags;
9
+ constructor(cwd: string);
10
+ private getAllTags;
11
+ getCommits(name: string, watch: string[]): Promise<Commit[]>;
12
+ getLatestTag(name?: string): Promise<string | null>;
13
+ commit(message: string): Promise<void>;
14
+ tag(tagName: string): Promise<void>;
15
+ }
@@ -0,0 +1,9 @@
1
+ import type { Commit } from '../types';
2
+ export interface VcsProvider {
3
+ getCommits(name: string, watch: string[]): Promise<Commit[]>;
4
+ getLatestTag(name?: string): Promise<string | null>;
5
+ commit(message: string): Promise<void>;
6
+ tag(tagName: string): Promise<void>;
7
+ }
8
+ export * from './git';
9
+ export * from './jj';
@@ -0,0 +1,15 @@
1
+ import type { Commit, VcsProvider } from '../types';
2
+ export declare function runJj(cmd: string, cwd: string): string;
3
+ export declare function findLatestJjTag(tags: string[], prefix: string): string | null;
4
+ export declare function resolveJjTag(name: string, allTags: string[]): string | null;
5
+ export declare function getJjCommits(name: string, watch: string[], allTags: string[], cwd: string): Commit[];
6
+ export declare class JjVcsProvider implements VcsProvider {
7
+ private cwd;
8
+ private allTags;
9
+ constructor(cwd: string);
10
+ private getAllTags;
11
+ getCommits(name: string, watch: string[]): Promise<Commit[]>;
12
+ getLatestTag(name?: string): Promise<string | null>;
13
+ commit(message: string): Promise<void>;
14
+ tag(tagName: string): Promise<void>;
15
+ }
@@ -1,5 +1,6 @@
1
+ import type { UpdateAction, UpdateActionResolved, VersionFallback } from './updater';
1
2
  import type { VcsProvider } from './vcs';
2
- export type BumpSize = "major" | "minor" | "patch" | "skip";
3
+ export type BumpSize = 'major' | 'minor' | 'patch' | 'skip';
3
4
  export interface Commit {
4
5
  hash: string;
5
6
  shortHash: string;
@@ -16,30 +17,11 @@ export interface ChangelogContext {
16
17
  date: string;
17
18
  commits: Commit[];
18
19
  }
19
- export interface ChangelogUpdate {
20
- kind: "changelog";
21
- path: string;
22
- global?: boolean;
23
- template?: (ctx: ChangelogContext) => string;
24
- resolvedBlock?: string;
25
- }
26
- export interface TomlUpdate {
27
- kind: "toml";
28
- path: string;
29
- toml: string;
30
- }
31
- export interface RegexUpdate {
32
- kind: "regex";
33
- path: string;
34
- search: string;
35
- replace: string;
36
- resolvedReplace?: string;
37
- }
38
- export type UpdateAction = TomlUpdate | RegexUpdate | ChangelogUpdate;
39
20
  export interface DependencyConfig {
40
21
  name: string;
41
22
  watch?: string[];
42
- updates?: UpdateAction[];
23
+ updates: UpdateAction[];
24
+ versionFallback?: VersionFallback;
43
25
  depends?: string[];
44
26
  }
45
27
  export interface PatternConfig {
@@ -69,8 +51,10 @@ export interface DependencyUpdateReport {
69
51
  bump: BumpSize;
70
52
  originalBump?: BumpSize;
71
53
  commits: Commit[];
72
- updates: UpdateAction[];
54
+ updates: UpdateActionResolved[];
73
55
  depends?: string[];
56
+ isErroneous?: boolean;
57
+ isFirstRelease?: boolean;
74
58
  }
75
59
  export interface IntermediateReport {
76
60
  name: string;
@@ -81,7 +65,7 @@ export interface IntermediateReport {
81
65
  commits: Commit[];
82
66
  updates: UpdateAction[];
83
67
  depends: string[];
68
+ isErroneous?: boolean;
69
+ isFirstRelease?: boolean;
84
70
  }
85
- export declare const defaultSizes: SizePatterns;
86
- export declare const defaultCascadeRules: Required<CascadeRules>;
87
71
  export type { VcsProvider };
@@ -0,0 +1,10 @@
1
+ import type { ChangelogContext } from '../types';
2
+ import type { UpdateAction } from '.';
3
+ export type ChangelogUpdateParams = {
4
+ path: string;
5
+ global?: boolean;
6
+ template?: (ctx: ChangelogContext) => string;
7
+ required?: boolean;
8
+ };
9
+ export declare const changelogUpdate: (params: ChangelogUpdateParams) => UpdateAction;
10
+ export declare function defaultChangelogTemplate({ version, date, commits }: ChangelogContext): string;
@@ -0,0 +1,26 @@
1
+ import type { Commit, DependencyUpdateReport } from '../types';
2
+ export * from './changelog';
3
+ export * from './json';
4
+ export * from './regex';
5
+ export * from './toml';
6
+ export type UpdateActionOptions = {
7
+ newVersion: string;
8
+ globalCommits: Commit[];
9
+ crateCommits: Commit[];
10
+ };
11
+ export interface UpdateActionResolved {
12
+ kind: string;
13
+ path: string;
14
+ apply(report: DependencyUpdateReport, reports: DependencyUpdateReport[], cwd: string): void;
15
+ params: any;
16
+ }
17
+ export interface UpdateAction {
18
+ kind: string;
19
+ path: string;
20
+ required?: boolean;
21
+ params: any;
22
+ prepare(data: UpdateActionOptions): UpdateActionResolved;
23
+ }
24
+ export interface VersionFallback {
25
+ readFallback(cwd: string): string | null;
26
+ }
@@ -0,0 +1,12 @@
1
+ import type { VersionFallback, UpdateAction } from '.';
2
+ export type JsonFallbackParams = {
3
+ path: string;
4
+ json: string;
5
+ };
6
+ export type JsonUpdateParams = {
7
+ path: string;
8
+ json: string;
9
+ required?: boolean;
10
+ };
11
+ export declare const jsonFallback: (params: JsonFallbackParams) => VersionFallback;
12
+ export declare const jsonUpdate: (params: JsonUpdateParams) => UpdateAction;
@@ -0,0 +1,13 @@
1
+ import type { VersionFallback, UpdateAction } from '.';
2
+ export type RegexFallbackParams = {
3
+ path: string;
4
+ search: string;
5
+ };
6
+ export type RegexUpdateParams = {
7
+ path: string;
8
+ search: string;
9
+ replace: string;
10
+ required?: boolean;
11
+ };
12
+ export declare const regexFallback: (params: RegexFallbackParams) => VersionFallback;
13
+ export declare const regexUpdate: (params: RegexUpdateParams) => UpdateAction;
@@ -0,0 +1,12 @@
1
+ import type { VersionFallback, UpdateAction } from '.';
2
+ export type TomlFallbackParams = {
3
+ path: string;
4
+ toml: string;
5
+ };
6
+ export type TomlUpdateParams = {
7
+ path: string;
8
+ toml: string;
9
+ required?: boolean;
10
+ };
11
+ export declare const tomlFallback: (params: TomlFallbackParams) => VersionFallback;
12
+ export declare const tomlUpdate: (params: TomlUpdateParams) => UpdateAction;
@@ -9,6 +9,7 @@ export declare class GitVcsProvider implements VcsProvider {
9
9
  constructor(cwd: string);
10
10
  private getAllTags;
11
11
  getCommits(name: string, watch: string[]): Promise<Commit[]>;
12
+ getLatestTag(name?: string): Promise<string | null>;
12
13
  commit(message: string): Promise<void>;
13
14
  tag(tagName: string): Promise<void>;
14
15
  }
@@ -1,6 +1,7 @@
1
1
  import type { Commit } from '../types';
2
2
  export interface VcsProvider {
3
3
  getCommits(name: string, watch: string[]): Promise<Commit[]>;
4
+ getLatestTag(name?: string): Promise<string | null>;
4
5
  commit(message: string): Promise<void>;
5
6
  tag(tagName: string): Promise<void>;
6
7
  }
@@ -9,6 +9,7 @@ export declare class JjVcsProvider implements VcsProvider {
9
9
  constructor(cwd: string);
10
10
  private getAllTags;
11
11
  getCommits(name: string, watch: string[]): Promise<Commit[]>;
12
+ getLatestTag(name?: string): Promise<string | null>;
12
13
  commit(message: string): Promise<void>;
13
14
  tag(tagName: string): Promise<void>;
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relacher",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Scriptable release orchestration library for monorepos",
5
5
  "type": "module",
6
6
  "private": false,
@@ -56,6 +56,6 @@
56
56
  "oxfmt": "^0.19.0",
57
57
  "oxlint": "^1.64.0",
58
58
  "prettier": "^3.8.3",
59
- "typescript": "^5.0.0"
59
+ "typescript": "^6.0.3"
60
60
  }
61
61
  }