@versu/core 0.6.15 → 0.6.17
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/adapters/project-information.d.ts +1 -1
- package/dist/adapters/project-information.d.ts.map +1 -1
- package/dist/changelog/index.d.ts +1 -1
- package/dist/changelog/index.d.ts.map +1 -1
- package/dist/changelog/index.js.map +1 -1
- package/dist/config/defaults.d.ts +7 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +73 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +6 -320
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +14 -183
- package/dist/config/index.js.map +1 -1
- package/dist/config/schema.d.ts +520 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +161 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +35 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/factories/adapter-identifier-registry.d.ts +1 -1
- package/dist/factories/adapter-identifier-registry.d.ts.map +1 -1
- package/dist/factories/adapter-identifier-registry.js.map +1 -1
- package/dist/factories/module-system-factory.d.ts +1 -1
- package/dist/factories/module-system-factory.d.ts.map +1 -1
- package/dist/git/index.d.ts +3 -76
- package/dist/git/index.d.ts.map +1 -1
- package/dist/git/index.js +8 -5
- package/dist/git/index.js.map +1 -1
- package/dist/git/types.d.ts +76 -0
- package/dist/git/types.d.ts.map +1 -0
- package/dist/git/types.js +2 -0
- package/dist/git/types.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugins/plugin-loader.d.ts +5 -16
- package/dist/plugins/plugin-loader.d.ts.map +1 -1
- package/dist/plugins/plugin-loader.js +64 -8
- package/dist/plugins/plugin-loader.js.map +1 -1
- package/dist/plugins/{plugin-schema.d.ts → schema.d.ts} +1 -1
- package/dist/plugins/schema.d.ts.map +1 -0
- package/dist/plugins/{plugin-schema.js → schema.js} +1 -1
- package/dist/plugins/schema.js.map +1 -0
- package/dist/plugins/types.d.ts +16 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +2 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/semver/index.d.ts +13 -32
- package/dist/semver/index.d.ts.map +1 -1
- package/dist/semver/index.js +33 -70
- package/dist/semver/index.js.map +1 -1
- package/dist/semver/types.d.ts +12 -0
- package/dist/semver/types.d.ts.map +1 -0
- package/dist/semver/types.js +2 -0
- package/dist/semver/types.js.map +1 -0
- package/dist/services/changelog-generator.d.ts +1 -1
- package/dist/services/configuration-loader.d.ts +3 -3
- package/dist/services/configuration-loader.d.ts.map +1 -1
- package/dist/services/configuration-loader.js +1 -1
- package/dist/services/configuration-loader.js.map +1 -1
- package/dist/services/git-operations.js.map +1 -1
- package/dist/services/version-applier.d.ts +2 -2
- package/dist/services/version-applier.d.ts.map +1 -1
- package/dist/services/version-applier.js.map +1 -1
- package/dist/services/version-bumper.d.ts +4 -4
- package/dist/services/version-bumper.d.ts.map +1 -1
- package/dist/services/version-bumper.js +12 -25
- package/dist/services/version-bumper.js.map +1 -1
- package/dist/services/version-manager.d.ts +1 -1
- package/dist/services/version-manager.d.ts.map +1 -1
- package/dist/services/version-manager.js.map +1 -1
- package/dist/services/versu-runner.d.ts.map +1 -1
- package/dist/services/versu-runner.js +3 -3
- package/dist/services/versu-runner.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/properties.js +2 -2
- package/dist/utils/properties.js.map +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
- package/dist/plugins/plugin-schema.d.ts.map +0 -1
- package/dist/plugins/plugin-schema.js.map +0 -1
- package/dist/utils/commits.d.ts +0 -12
- package/dist/utils/commits.d.ts.map +0 -1
- package/dist/utils/commits.js +0 -25
- package/dist/utils/commits.js.map +0 -1
package/dist/config/index.js
CHANGED
|
@@ -1,206 +1,37 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
1
|
import { isBreakingCommit } from "../git/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* Zod schema for BumpType values.
|
|
5
|
-
* Used for validation in configuration files.
|
|
6
|
-
*/
|
|
7
|
-
const bumpTypeSchema = z.enum(["major", "minor", "patch", "none"]);
|
|
8
|
-
/**
|
|
9
|
-
* Zod schema for BumpType or 'ignore' values.
|
|
10
|
-
* Used for commit type mappings where 'ignore' is allowed.
|
|
11
|
-
*/
|
|
12
|
-
const bumpTypeOrIgnoreSchema = z.union([bumpTypeSchema, z.literal("ignore")]);
|
|
13
|
-
/**
|
|
14
|
-
* Zod schema for DependencyRules configuration.
|
|
15
|
-
* Validates that dependency cascade rules use valid bump types.
|
|
16
|
-
*/
|
|
17
|
-
const dependencyRulesSchema = z.object({
|
|
18
|
-
major: bumpTypeSchema,
|
|
19
|
-
minor: bumpTypeSchema,
|
|
20
|
-
patch: bumpTypeSchema,
|
|
21
|
-
});
|
|
22
|
-
const commitNoteSchema = z.object({
|
|
23
|
-
title: z.string(),
|
|
24
|
-
text: z.string(),
|
|
25
|
-
});
|
|
26
|
-
const commitReferenceSchema = z.object({
|
|
27
|
-
raw: z.string(),
|
|
28
|
-
action: z.string().nullable(),
|
|
29
|
-
owner: z.string().nullable(),
|
|
30
|
-
repository: z.string().nullable(),
|
|
31
|
-
issue: z.string(),
|
|
32
|
-
prefix: z.string(),
|
|
33
|
-
});
|
|
34
|
-
const commitBaseSchema = z.object({
|
|
35
|
-
merge: z.string().nullable(),
|
|
36
|
-
revert: z.record(z.string(), z.string().nullable()).nullable(),
|
|
37
|
-
header: z.string().nullable(),
|
|
38
|
-
body: z.string().nullable(),
|
|
39
|
-
footer: z.string().nullable(),
|
|
40
|
-
notes: z.array(commitNoteSchema),
|
|
41
|
-
mentions: z.array(z.string()),
|
|
42
|
-
references: z.array(commitReferenceSchema),
|
|
43
|
-
type: z.string().nullable().optional(),
|
|
44
|
-
version: z.string().nullable().optional(),
|
|
45
|
-
hash: z.string().nullable().optional(),
|
|
46
|
-
committerDate: z.string().nullable().optional(),
|
|
47
|
-
});
|
|
48
|
-
const commitSchema = z.intersection(commitBaseSchema, z.record(z.string(), z.string().nullable()));
|
|
49
|
-
const commitGroupSchema = z.object({
|
|
50
|
-
title: z.string(),
|
|
51
|
-
commits: z.array(commitSchema),
|
|
52
|
-
});
|
|
53
|
-
const noteGroupSchema = z.object({
|
|
54
|
-
title: z.string(),
|
|
55
|
-
notes: z.array(commitNoteSchema),
|
|
56
|
-
});
|
|
57
|
-
const contextSchema = z.object({
|
|
58
|
-
prependPlaceholder: z.string(),
|
|
59
|
-
version: z.string().optional(),
|
|
60
|
-
isPatch: z.boolean().optional(),
|
|
61
|
-
title: z.string().optional(),
|
|
62
|
-
date: z.string().optional(),
|
|
63
|
-
linkReferences: z.boolean().optional(),
|
|
64
|
-
commit: z.string().optional(),
|
|
65
|
-
issue: z.string().optional(),
|
|
66
|
-
repository: z.string().optional(),
|
|
67
|
-
host: z.string().optional(),
|
|
68
|
-
owner: z.string().optional(),
|
|
69
|
-
repoUrl: z.string().optional(),
|
|
70
|
-
commitGroups: z.array(commitGroupSchema).optional(),
|
|
71
|
-
noteGroups: z.array(noteGroupSchema).optional(),
|
|
72
|
-
linkCompare: z.boolean().optional(),
|
|
73
|
-
});
|
|
74
|
-
const optionsSchema = z.object({
|
|
75
|
-
groupBy: z.string().optional(), // not accurate
|
|
76
|
-
commitsSort: z.any().optional(),
|
|
77
|
-
commitGroupsSort: z.any().optional(),
|
|
78
|
-
notesSort: z.any().optional(),
|
|
79
|
-
noteGroupsSort: z.any().optional(),
|
|
80
|
-
ignoreReverted: z.boolean().optional(),
|
|
81
|
-
reverse: z.boolean().optional(),
|
|
82
|
-
doFlush: z.boolean().optional(),
|
|
83
|
-
transform: z
|
|
84
|
-
.function({ input: [z.any(), z.any(), z.any()], output: z.any() })
|
|
85
|
-
.optional(),
|
|
86
|
-
generateOn: z
|
|
87
|
-
.union([
|
|
88
|
-
z.function({
|
|
89
|
-
input: [z.any(), z.any(), z.any(), z.any()],
|
|
90
|
-
output: z.boolean(),
|
|
91
|
-
}),
|
|
92
|
-
z.string(),
|
|
93
|
-
])
|
|
94
|
-
.nullable()
|
|
95
|
-
.optional(),
|
|
96
|
-
finalizeContext: z
|
|
97
|
-
.function({
|
|
98
|
-
input: [z.any(), z.any(), z.any(), z.any(), z.any()],
|
|
99
|
-
output: z.any(),
|
|
100
|
-
})
|
|
101
|
-
.optional(),
|
|
102
|
-
debug: z.function({ input: [z.string()], output: z.void() }).optional(),
|
|
103
|
-
formatDate: z
|
|
104
|
-
.function({ input: [z.union([z.string(), z.date()])], output: z.string() })
|
|
105
|
-
.optional(),
|
|
106
|
-
skip: z.function({ input: [z.any()], output: z.boolean() }).optional(),
|
|
107
|
-
mainTemplate: z.string().optional(),
|
|
108
|
-
headerPartial: z.string().optional(),
|
|
109
|
-
commitPartial: z.string().optional(),
|
|
110
|
-
footerPartial: z.string().optional(),
|
|
111
|
-
partials: z.record(z.string(), z.string().nullable()).optional(),
|
|
112
|
-
});
|
|
113
|
-
/**
|
|
114
|
-
* Zod schema for Changelog configuration.
|
|
115
|
-
* Validates the structure of changelog options and context.
|
|
116
|
-
*/
|
|
117
|
-
export const changelogSchema = z.object({
|
|
118
|
-
context: contextSchema.optional(),
|
|
119
|
-
options: optionsSchema.optional(),
|
|
120
|
-
});
|
|
121
|
-
/**
|
|
122
|
-
* Zod schema for the main Config object.
|
|
123
|
-
* This schema is used by ConfigurationValidator to ensure type-safe
|
|
124
|
-
* configuration with detailed error messages for invalid configurations.
|
|
125
|
-
*/
|
|
126
|
-
export const configSchema = z.object({
|
|
127
|
-
versionRules: z.object({
|
|
128
|
-
defaultBump: bumpTypeSchema,
|
|
129
|
-
commitTypeBumps: z.record(z.string(), bumpTypeOrIgnoreSchema),
|
|
130
|
-
dependencyBumps: dependencyRulesSchema,
|
|
131
|
-
}),
|
|
132
|
-
plugins: z.array(z.string()).optional().default([]),
|
|
133
|
-
changelog: z
|
|
134
|
-
.object({
|
|
135
|
-
root: changelogSchema.optional(),
|
|
136
|
-
module: changelogSchema.optional(),
|
|
137
|
-
})
|
|
138
|
-
.optional(),
|
|
139
|
-
});
|
|
140
|
-
/**
|
|
141
|
-
* Default configuration following Conventional Commits specification.
|
|
142
|
-
* Maps common commit types to semantic version bumps and defines dependency cascade rules.
|
|
143
|
-
*/
|
|
144
|
-
export const DEFAULT_CONFIG = {
|
|
145
|
-
plugins: [],
|
|
146
|
-
versionRules: {
|
|
147
|
-
defaultBump: "patch",
|
|
148
|
-
commitTypeBumps: {
|
|
149
|
-
feat: "minor",
|
|
150
|
-
fix: "patch",
|
|
151
|
-
perf: "patch",
|
|
152
|
-
refactor: "patch",
|
|
153
|
-
docs: "ignore",
|
|
154
|
-
test: "ignore",
|
|
155
|
-
chore: "ignore",
|
|
156
|
-
style: "ignore",
|
|
157
|
-
ci: "ignore",
|
|
158
|
-
build: "ignore",
|
|
159
|
-
},
|
|
160
|
-
dependencyBumps: {
|
|
161
|
-
major: "major",
|
|
162
|
-
minor: "minor",
|
|
163
|
-
patch: "patch",
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
};
|
|
167
2
|
/**
|
|
168
3
|
* Determines the bump type for a commit based on its type and breaking change flag.
|
|
169
4
|
* @param commit - The commit to evaluate
|
|
170
5
|
* @param config - Configuration containing commit type mappings
|
|
171
6
|
* @returns The bump type to apply ('major', 'minor', 'patch', or 'none')
|
|
172
7
|
*/
|
|
173
|
-
export function getBumpTypeForCommit(commit, config) {
|
|
8
|
+
export function getBumpTypeForCommit(commit, config, prerelease) {
|
|
9
|
+
const key = prerelease ? "prerelease" : "stable";
|
|
174
10
|
const isBreaking = isBreakingCommit(commit);
|
|
175
11
|
if (isBreaking) {
|
|
176
|
-
return
|
|
12
|
+
return config.versioning.breakingChange[key];
|
|
177
13
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (configuredBump === "ignore") {
|
|
181
|
-
return "none";
|
|
14
|
+
if (!commit.type) {
|
|
15
|
+
return config.versioning.unknownCommitType[key];
|
|
182
16
|
}
|
|
183
|
-
|
|
17
|
+
const configuredBump = config.versioning.commitTypes[commit.type]?.[key];
|
|
18
|
+
return configuredBump || config.versioning.unknownCommitType[key];
|
|
184
19
|
}
|
|
185
20
|
/**
|
|
186
21
|
* Determines how a module should be bumped when one of its dependencies changes.
|
|
187
22
|
* Uses dependency cascade rules from configuration to propagate version changes.
|
|
188
23
|
* @param dependencyBumpType - The bump type applied to the dependency
|
|
189
24
|
* @param config - Configuration containing dependency cascade rules
|
|
25
|
+
* @param prerelease - Whether the bump is a prerelease or stable release
|
|
190
26
|
* @returns The bump type to apply to the dependent module
|
|
191
27
|
*/
|
|
192
|
-
export function getDependencyBumpType(dependencyBumpType, config) {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
case "minor":
|
|
198
|
-
return rules.minor;
|
|
199
|
-
case "patch":
|
|
200
|
-
return rules.patch;
|
|
201
|
-
default:
|
|
202
|
-
return "none";
|
|
28
|
+
export function getDependencyBumpType(dependencyBumpType, config, prerelease) {
|
|
29
|
+
const key = prerelease ? "prerelease" : "stable";
|
|
30
|
+
const rules = config.versioning.cascadeRules[key];
|
|
31
|
+
if (typeof rules === "string" && rules === "match") {
|
|
32
|
+
return dependencyBumpType;
|
|
203
33
|
}
|
|
34
|
+
return rules?.[dependencyBumpType] || "none";
|
|
204
35
|
}
|
|
205
36
|
/**
|
|
206
37
|
* Retrieves adapter-specific configuration from the main config object.
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+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