@fuzdev/fuz_gitops 0.72.0 → 0.74.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/README.md +15 -8
- package/dist/PageHeader.svelte +3 -3
- package/dist/PageHeader.svelte.d.ts +3 -3
- package/dist/PageHeader.svelte.d.ts.map +1 -1
- package/dist/changeset_generator.d.ts.map +1 -1
- package/dist/changeset_generator.js +2 -16
- package/dist/changeset_reader.d.ts +1 -1
- package/dist/changeset_reader.d.ts.map +1 -1
- package/dist/changeset_reader.js +1 -1
- package/dist/dependency_graph.d.ts.map +1 -1
- package/dist/dependency_graph.js +6 -6
- package/dist/fetch_repo_data.d.ts.map +1 -1
- package/dist/fetch_repo_data.js +3 -2
- package/dist/git_operations.d.ts +5 -0
- package/dist/git_operations.d.ts.map +1 -1
- package/dist/git_operations.js +5 -0
- package/dist/gitops_analyze.task.d.ts +1 -0
- package/dist/gitops_analyze.task.d.ts.map +1 -1
- package/dist/gitops_analyze.task.js +12 -17
- package/dist/gitops_plan.task.d.ts +1 -0
- package/dist/gitops_plan.task.d.ts.map +1 -1
- package/dist/gitops_plan.task.js +9 -2
- package/dist/gitops_publish.task.d.ts +2 -2
- package/dist/gitops_publish.task.d.ts.map +1 -1
- package/dist/gitops_publish.task.js +83 -28
- package/dist/gitops_run.task.d.ts +2 -1
- package/dist/gitops_run.task.d.ts.map +1 -1
- package/dist/gitops_run.task.js +40 -7
- package/dist/gitops_sync.task.d.ts +1 -0
- package/dist/gitops_sync.task.d.ts.map +1 -1
- package/dist/gitops_sync.task.js +16 -2
- package/dist/gitops_task_helpers.d.ts +16 -2
- package/dist/gitops_task_helpers.d.ts.map +1 -1
- package/dist/gitops_task_helpers.js +11 -3
- package/dist/gitops_validate.task.d.ts +1 -0
- package/dist/gitops_validate.task.d.ts.map +1 -1
- package/dist/gitops_validate.task.js +20 -20
- package/dist/graph_validation.d.ts +16 -1
- package/dist/graph_validation.d.ts.map +1 -1
- package/dist/graph_validation.js +15 -0
- package/dist/local_repo.d.ts +25 -12
- package/dist/local_repo.d.ts.map +1 -1
- package/dist/local_repo.js +99 -79
- package/dist/log_helpers.d.ts +0 -5
- package/dist/log_helpers.d.ts.map +1 -1
- package/dist/log_helpers.js +8 -19
- package/dist/multi_repo_publisher.d.ts +21 -2
- package/dist/multi_repo_publisher.d.ts.map +1 -1
- package/dist/multi_repo_publisher.js +279 -287
- package/dist/operations.d.ts +6 -26
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations_defaults.d.ts.map +1 -1
- package/dist/operations_defaults.js +4 -20
- package/dist/output_helpers.d.ts.map +1 -1
- package/dist/output_helpers.js +7 -6
- package/dist/paths.d.ts +0 -4
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -4
- package/dist/publish_gate.d.ts +44 -0
- package/dist/publish_gate.d.ts.map +1 -0
- package/dist/publish_gate.js +32 -0
- package/dist/publish_steps.d.ts +60 -0
- package/dist/publish_steps.d.ts.map +1 -0
- package/dist/publish_steps.js +113 -0
- package/dist/publishing_event.d.ts +12 -19
- package/dist/publishing_event.d.ts.map +1 -1
- package/dist/publishing_event.js +16 -25
- package/dist/publishing_plan.d.ts +1 -2
- package/dist/publishing_plan.d.ts.map +1 -1
- package/dist/publishing_plan.js +21 -4
- package/dist/publishing_plan_helpers.d.ts +1 -1
- package/dist/publishing_plan_helpers.d.ts.map +1 -1
- package/dist/publishing_plan_helpers.js +2 -15
- package/dist/publishing_plan_logging.d.ts.map +1 -1
- package/dist/publishing_plan_logging.js +15 -23
- package/dist/repo.svelte.d.ts +10 -6
- package/dist/repo.svelte.d.ts.map +1 -1
- package/dist/repo.svelte.js +6 -14
- package/dist/version_utils.d.ts +17 -3
- package/dist/version_utils.d.ts.map +1 -1
- package/dist/version_utils.js +22 -0
- package/package.json +14 -15
- package/src/lib/changeset_generator.ts +10 -19
- package/src/lib/changeset_reader.ts +2 -3
- package/src/lib/dependency_graph.ts +6 -8
- package/src/lib/fetch_repo_data.ts +3 -2
- package/src/lib/git_operations.ts +5 -0
- package/src/lib/gitops_analyze.task.ts +18 -23
- package/src/lib/gitops_plan.task.ts +10 -2
- package/src/lib/gitops_publish.task.ts +92 -27
- package/src/lib/gitops_run.task.ts +39 -7
- package/src/lib/gitops_sync.task.ts +18 -3
- package/src/lib/gitops_task_helpers.ts +20 -3
- package/src/lib/gitops_validate.task.ts +30 -22
- package/src/lib/graph_validation.ts +26 -0
- package/src/lib/local_repo.ts +124 -88
- package/src/lib/log_helpers.ts +8 -26
- package/src/lib/multi_repo_publisher.ts +336 -353
- package/src/lib/operations.ts +6 -22
- package/src/lib/operations_defaults.ts +4 -20
- package/src/lib/output_helpers.ts +7 -6
- package/src/lib/paths.ts +0 -5
- package/src/lib/publish_gate.ts +53 -0
- package/src/lib/publish_steps.ts +149 -0
- package/src/lib/publishing_event.ts +16 -25
- package/src/lib/publishing_plan.ts +26 -6
- package/src/lib/publishing_plan_helpers.ts +5 -18
- package/src/lib/publishing_plan_logging.ts +19 -39
- package/src/lib/repo.svelte.ts +12 -15
- package/src/lib/version_utils.ts +30 -9
- package/dist/npm_install_helpers.d.ts +0 -23
- package/dist/npm_install_helpers.d.ts.map +0 -1
- package/dist/npm_install_helpers.js +0 -60
- package/dist/semver.d.ts +0 -26
- package/dist/semver.d.ts.map +0 -1
- package/dist/semver.js +0 -137
- package/dist/serialization_types.d.ts +0 -59
- package/dist/serialization_types.d.ts.map +0 -1
- package/dist/serialization_types.js +0 -42
- package/src/lib/npm_install_helpers.ts +0 -85
- package/src/lib/semver.ts +0 -170
- package/src/lib/serialization_types.ts +0 -92
package/src/lib/semver.ts
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
// TODO: candidate for extraction to `@fuzdev/fuz_util`
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Semantic Versioning 2.0.0 utilities
|
|
5
|
-
* @see https://semver.org/
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export type BumpType = 'major' | 'minor' | 'patch';
|
|
11
|
-
|
|
12
|
-
export interface Semver {
|
|
13
|
-
major: number;
|
|
14
|
-
minor: number;
|
|
15
|
-
patch: number;
|
|
16
|
-
prerelease?: string;
|
|
17
|
-
build?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* SemVer 2.0.0 validation regex.
|
|
22
|
-
* @see https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
|
|
23
|
-
*/
|
|
24
|
-
const SEMVER_REGEX =
|
|
25
|
-
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Parses a semver version string.
|
|
29
|
-
* Accepts optional 'v' prefix for convenience.
|
|
30
|
-
*/
|
|
31
|
-
const semver_parse = (version: string): Semver => {
|
|
32
|
-
// Remove leading 'v' if present (common in git tags)
|
|
33
|
-
const clean = version.replace(/^v/, '');
|
|
34
|
-
|
|
35
|
-
// Validate the cleaned version
|
|
36
|
-
if (!SEMVER_REGEX.test(clean)) {
|
|
37
|
-
throw new Error(`Invalid semver: ${version}`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const match = SEMVER_REGEX.exec(clean)!;
|
|
41
|
-
return {
|
|
42
|
-
major: parseInt(match[1]!, 10),
|
|
43
|
-
minor: parseInt(match[2]!, 10),
|
|
44
|
-
patch: parseInt(match[3]!, 10),
|
|
45
|
-
prerelease: match[4],
|
|
46
|
-
build: match[5],
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const semver_to_string = (semver: Semver): string => {
|
|
51
|
-
let version = `${semver.major}.${semver.minor}.${semver.patch}`;
|
|
52
|
-
if (semver.prerelease) {
|
|
53
|
-
version += `-${semver.prerelease}`;
|
|
54
|
-
}
|
|
55
|
-
if (semver.build) {
|
|
56
|
-
version += `+${semver.build}`;
|
|
57
|
-
}
|
|
58
|
-
return version;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Compares two prerelease versions according to SemVer 2.0.0 spec.
|
|
63
|
-
* Returns -1 if a < b, 0 if a === b, 1 if a > b.
|
|
64
|
-
*/
|
|
65
|
-
const semver_compare_prerelease = (a: string | undefined, b: string | undefined): number => {
|
|
66
|
-
// Handle missing prereleases
|
|
67
|
-
if (!a && !b) return 0;
|
|
68
|
-
if (!a) return 1; // normal version > prerelease
|
|
69
|
-
if (!b) return -1; // prerelease < normal version
|
|
70
|
-
|
|
71
|
-
// Split into identifiers
|
|
72
|
-
const a_parts = a.split('.');
|
|
73
|
-
const b_parts = b.split('.');
|
|
74
|
-
|
|
75
|
-
// Compare each identifier
|
|
76
|
-
const min_length = Math.min(a_parts.length, b_parts.length);
|
|
77
|
-
for (let i = 0; i < min_length; i++) {
|
|
78
|
-
const a_part = a_parts[i]!;
|
|
79
|
-
const b_part = b_parts[i]!;
|
|
80
|
-
|
|
81
|
-
// Check if numeric
|
|
82
|
-
const a_is_numeric = /^\d+$/.test(a_part);
|
|
83
|
-
const b_is_numeric = /^\d+$/.test(b_part);
|
|
84
|
-
|
|
85
|
-
if (a_is_numeric && b_is_numeric) {
|
|
86
|
-
// Both numeric - compare numerically
|
|
87
|
-
const a_num = parseInt(a_part, 10);
|
|
88
|
-
const b_num = parseInt(b_part, 10);
|
|
89
|
-
if (a_num !== b_num) {
|
|
90
|
-
return a_num < b_num ? -1 : 1;
|
|
91
|
-
}
|
|
92
|
-
} else if (a_is_numeric && !b_is_numeric) {
|
|
93
|
-
// Numeric identifiers always have lower precedence
|
|
94
|
-
return -1;
|
|
95
|
-
} else if (!a_is_numeric && b_is_numeric) {
|
|
96
|
-
// Numeric identifiers always have lower precedence
|
|
97
|
-
return 1;
|
|
98
|
-
} else {
|
|
99
|
-
// Both alphanumeric - compare lexically
|
|
100
|
-
const cmp = a_part.localeCompare(b_part);
|
|
101
|
-
if (cmp !== 0) {
|
|
102
|
-
return cmp < 0 ? -1 : 1;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// All identifiers equal - larger set has higher precedence
|
|
108
|
-
if (a_parts.length !== b_parts.length) {
|
|
109
|
-
return a_parts.length < b_parts.length ? -1 : 1;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return 0;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Compares two semver versions according to SemVer 2.0.0 spec.
|
|
117
|
-
* Returns -1 if a < b, 0 if a === b, 1 if a > b.
|
|
118
|
-
* Build metadata is ignored in precedence comparison.
|
|
119
|
-
*/
|
|
120
|
-
export const semver_compare_versions = (a: string, b: string): number => {
|
|
121
|
-
const v1 = semver_parse(a);
|
|
122
|
-
const v2 = semver_parse(b);
|
|
123
|
-
|
|
124
|
-
// Compare major
|
|
125
|
-
if (v1.major !== v2.major) {
|
|
126
|
-
return v1.major < v2.major ? -1 : 1;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Compare minor
|
|
130
|
-
if (v1.minor !== v2.minor) {
|
|
131
|
-
return v1.minor < v2.minor ? -1 : 1;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Compare patch
|
|
135
|
-
if (v1.patch !== v2.patch) {
|
|
136
|
-
return v1.patch < v2.patch ? -1 : 1;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Compare prerelease (build metadata is ignored)
|
|
140
|
-
return semver_compare_prerelease(v1.prerelease, v2.prerelease);
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Bumps a version according to the specified type.
|
|
145
|
-
* Resets lower version numbers per SemVer spec.
|
|
146
|
-
*/
|
|
147
|
-
export const semver_bump_version = (version: string, type: BumpType): string => {
|
|
148
|
-
const semver = semver_parse(version);
|
|
149
|
-
|
|
150
|
-
switch (type) {
|
|
151
|
-
case 'major':
|
|
152
|
-
semver.major++;
|
|
153
|
-
semver.minor = 0;
|
|
154
|
-
semver.patch = 0;
|
|
155
|
-
break;
|
|
156
|
-
case 'minor':
|
|
157
|
-
semver.minor++;
|
|
158
|
-
semver.patch = 0;
|
|
159
|
-
break;
|
|
160
|
-
case 'patch':
|
|
161
|
-
semver.patch++;
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Remove prerelease and build when bumping
|
|
166
|
-
semver.prerelease = undefined;
|
|
167
|
-
semver.build = undefined;
|
|
168
|
-
|
|
169
|
-
return semver_to_string(semver);
|
|
170
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON-serializable types for command output formats.
|
|
3
|
-
*
|
|
4
|
-
* Gitops commands support `--format json` and `--format markdown` output modes
|
|
5
|
-
* in addition to styled terminal output. These types define the JSON schema for:
|
|
6
|
-
* - Dependency graph structures (`SerializedGraph`)
|
|
7
|
-
* - Publishing plan predictions (`SerializedPublishingPlan`)
|
|
8
|
-
*
|
|
9
|
-
* Used by `gitops_analyze`, `gitops_plan`, and `gitops_publish` (dry run) when
|
|
10
|
-
* `--format json` or `--outfile` is specified.
|
|
11
|
-
*
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import type {DependencyGraph} from './dependency_graph.js';
|
|
16
|
-
|
|
17
|
-
export interface SerializedNode {
|
|
18
|
-
name: string;
|
|
19
|
-
version: string;
|
|
20
|
-
dependencies: Array<{
|
|
21
|
-
name: string;
|
|
22
|
-
type: string;
|
|
23
|
-
version: string;
|
|
24
|
-
}>;
|
|
25
|
-
dependents: Array<string>;
|
|
26
|
-
publishable: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface SerializedGraph {
|
|
30
|
-
nodes: Array<SerializedNode>;
|
|
31
|
-
edges: Array<[string, string]>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface SerializedPublishingPlan {
|
|
35
|
-
publishing_order: Array<string>;
|
|
36
|
-
version_changes: Array<{
|
|
37
|
-
package_name: string;
|
|
38
|
-
from: string;
|
|
39
|
-
to: string;
|
|
40
|
-
bump_type: string;
|
|
41
|
-
breaking: boolean;
|
|
42
|
-
has_changesets: boolean;
|
|
43
|
-
will_generate_changeset?: boolean;
|
|
44
|
-
needs_bump_escalation?: boolean;
|
|
45
|
-
existing_bump?: string;
|
|
46
|
-
required_bump?: string;
|
|
47
|
-
}>;
|
|
48
|
-
dependency_updates: Array<{
|
|
49
|
-
dependent_package: string;
|
|
50
|
-
updated_dependency: string;
|
|
51
|
-
new_version: string;
|
|
52
|
-
type: string;
|
|
53
|
-
causes_republish: boolean;
|
|
54
|
-
}>;
|
|
55
|
-
breaking_cascades: Record<string, Array<string>>;
|
|
56
|
-
warnings: Array<string>;
|
|
57
|
-
errors: Array<string>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Serializes a dependency graph to a JSON-safe format.
|
|
62
|
-
*/
|
|
63
|
-
export const serialize_graph = (graph: DependencyGraph): SerializedGraph => {
|
|
64
|
-
const nodes: Array<SerializedNode> = [];
|
|
65
|
-
const edges: Array<[string, string]> = [];
|
|
66
|
-
|
|
67
|
-
// Serialize nodes
|
|
68
|
-
for (const node of graph.nodes.values()) {
|
|
69
|
-
const dependencies = Array.from(node.dependencies, ([dep_name, spec]) => ({
|
|
70
|
-
name: dep_name,
|
|
71
|
-
type: spec.type,
|
|
72
|
-
version: spec.version,
|
|
73
|
-
}));
|
|
74
|
-
|
|
75
|
-
nodes.push({
|
|
76
|
-
name: node.name,
|
|
77
|
-
version: node.version,
|
|
78
|
-
dependencies,
|
|
79
|
-
dependents: Array.from(node.dependents),
|
|
80
|
-
publishable: node.publishable,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Serialize edges
|
|
85
|
-
for (const [from, tos] of graph.edges) {
|
|
86
|
-
for (const to of tos) {
|
|
87
|
-
edges.push([from, to]);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return {nodes, edges};
|
|
92
|
-
};
|