@releasekit/version 0.4.1 → 0.6.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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseVersionError,
|
|
3
|
-
ReleaseKitError
|
|
4
|
-
|
|
3
|
+
ReleaseKitError,
|
|
4
|
+
sanitizePackageName
|
|
5
|
+
} from "./chunk-Q3FHZORY.js";
|
|
5
6
|
import {
|
|
6
7
|
execAsync,
|
|
7
8
|
execSync
|
|
@@ -129,7 +130,13 @@ var GitHubReleaseConfigSchema = z.object({
|
|
|
129
130
|
* - 'generated': Use GitHub's auto-generated notes.
|
|
130
131
|
* - 'none': No body.
|
|
131
132
|
*/
|
|
132
|
-
body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto")
|
|
133
|
+
body: z.enum(["auto", "releaseNotes", "changelog", "generated", "none"]).default("auto"),
|
|
134
|
+
/**
|
|
135
|
+
* Template string for the GitHub release title when a package name is resolved.
|
|
136
|
+
* Available variables: ${packageName} (original scoped name), ${version} (e.g. "v1.0.0").
|
|
137
|
+
* Version-only tags (e.g. "v1.0.0") always use the tag as-is.
|
|
138
|
+
*/
|
|
139
|
+
titleTemplate: z.string().default("${packageName}: ${version}")
|
|
133
140
|
});
|
|
134
141
|
var VerifyRegistryConfigSchema = z.object({
|
|
135
142
|
enabled: z.boolean().default(true),
|
|
@@ -173,7 +180,8 @@ var PublishConfigSchema = z.object({
|
|
|
173
180
|
draft: true,
|
|
174
181
|
perPackage: true,
|
|
175
182
|
prerelease: "auto",
|
|
176
|
-
body: "auto"
|
|
183
|
+
body: "auto",
|
|
184
|
+
titleTemplate: "${packageName}: ${version}"
|
|
177
185
|
}),
|
|
178
186
|
verify: VerifyConfigSchema.default({
|
|
179
187
|
npm: {
|
|
@@ -632,7 +640,7 @@ function formatVersionPrefix(prefix) {
|
|
|
632
640
|
return prefix.endsWith("/") ? prefix.slice(0, -1) : prefix;
|
|
633
641
|
}
|
|
634
642
|
function formatTag(version, prefix, packageName, template, packageSpecificTags) {
|
|
635
|
-
const sanitizedPackageName = packageName
|
|
643
|
+
const sanitizedPackageName = packageName ? sanitizePackageName(packageName) : packageName;
|
|
636
644
|
if (template?.includes("${packageName}") && !packageName) {
|
|
637
645
|
log(
|
|
638
646
|
`Warning: Your tagTemplate contains \${packageName} but no package name is available.
|
|
@@ -1138,6 +1146,7 @@ async function calculateVersion(config, options) {
|
|
|
1138
1146
|
latestTag,
|
|
1139
1147
|
name,
|
|
1140
1148
|
path: pkgPath,
|
|
1149
|
+
commitCheckPath,
|
|
1141
1150
|
type: optionsType,
|
|
1142
1151
|
prereleaseIdentifier: optionsPrereleaseIdentifier
|
|
1143
1152
|
} = options;
|
|
@@ -1147,13 +1156,12 @@ async function calculateVersion(config, options) {
|
|
|
1147
1156
|
const hasNoTags = !latestTag || latestTag.trim() === "";
|
|
1148
1157
|
const normalizedPrereleaseId = normalizePrereleaseIdentifier(prereleaseIdentifier, config);
|
|
1149
1158
|
try {
|
|
1150
|
-
let
|
|
1151
|
-
if (!packageName)
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1159
|
+
let buildTagStripPattern2 = function(packageName, prefix) {
|
|
1160
|
+
if (!packageName) return escapeRegExp(prefix);
|
|
1161
|
+
const sanitized = sanitizePackageName(packageName);
|
|
1162
|
+
const escapedRaw = escapeRegExp(`${packageName}@${prefix}`);
|
|
1163
|
+
const escapedDash = escapeRegExp(`${sanitized}-${prefix}`);
|
|
1164
|
+
return `(?:${escapedRaw}|${escapedDash})`;
|
|
1157
1165
|
}, getCurrentVersionFromSource2 = function() {
|
|
1158
1166
|
if (!versionSource) {
|
|
1159
1167
|
if (hasNoTags) {
|
|
@@ -1168,10 +1176,9 @@ async function calculateVersion(config, options) {
|
|
|
1168
1176
|
}
|
|
1169
1177
|
return versionSource.version;
|
|
1170
1178
|
};
|
|
1171
|
-
var
|
|
1179
|
+
var buildTagStripPattern = buildTagStripPattern2, getCurrentVersionFromSource = getCurrentVersionFromSource2;
|
|
1172
1180
|
const originalPrefix = versionPrefix || "";
|
|
1173
|
-
const
|
|
1174
|
-
const escapedTagPattern = escapeRegExp3(tagSearchPattern);
|
|
1181
|
+
const escapedTagPattern = buildTagStripPattern2(name, originalPrefix);
|
|
1175
1182
|
let versionSource;
|
|
1176
1183
|
if (pkgPath) {
|
|
1177
1184
|
const packageDir = pkgPath || cwd();
|
|
@@ -1237,7 +1244,7 @@ async function calculateVersion(config, options) {
|
|
|
1237
1244
|
const releaseTypeFromCommits = recommendedBump && "releaseType" in recommendedBump ? recommendedBump.releaseType : void 0;
|
|
1238
1245
|
const currentVersion = getCurrentVersionFromSource2();
|
|
1239
1246
|
if (versionSource && versionSource.source === "git") {
|
|
1240
|
-
const checkPath = pkgPath || cwd();
|
|
1247
|
+
const checkPath = commitCheckPath || pkgPath || cwd();
|
|
1241
1248
|
const commitsLength = getCommitsLength(checkPath, versionSource.version);
|
|
1242
1249
|
if (commitsLength === 0) {
|
|
1243
1250
|
log(
|
|
@@ -1841,6 +1848,7 @@ function createSyncStrategy(config) {
|
|
|
1841
1848
|
} = config;
|
|
1842
1849
|
const formattedPrefix = formatVersionPrefix(versionPrefix || "v");
|
|
1843
1850
|
let latestTag = await getLatestTag();
|
|
1851
|
+
const repoRoot = packages.root ?? process.cwd();
|
|
1844
1852
|
let mainPkgPath = packages.root;
|
|
1845
1853
|
let mainPkgName;
|
|
1846
1854
|
let versionSourcePath = mainPkgPath;
|
|
@@ -1884,6 +1892,7 @@ function createSyncStrategy(config) {
|
|
|
1884
1892
|
baseBranch,
|
|
1885
1893
|
prereleaseIdentifier,
|
|
1886
1894
|
path: versionSourcePath,
|
|
1895
|
+
commitCheckPath: repoRoot,
|
|
1887
1896
|
name: versionSourceName,
|
|
1888
1897
|
type: config.type
|
|
1889
1898
|
});
|
|
@@ -1972,15 +1981,28 @@ function createSyncStrategy(config) {
|
|
|
1972
1981
|
}
|
|
1973
1982
|
];
|
|
1974
1983
|
}
|
|
1975
|
-
addChangelogData({
|
|
1976
|
-
packageName: mainPkgName || "monorepo",
|
|
1977
|
-
version: nextVersion,
|
|
1978
|
-
previousVersion: latestTag || null,
|
|
1979
|
-
revisionRange,
|
|
1980
|
-
repoUrl: null,
|
|
1981
|
-
entries: changelogEntries
|
|
1982
|
-
});
|
|
1983
1984
|
const workspaceNames = updatedPackages.filter((n) => n !== "root");
|
|
1985
|
+
if (config.packageSpecificTags && workspaceNames.length > 0) {
|
|
1986
|
+
for (const pkgName of workspaceNames) {
|
|
1987
|
+
addChangelogData({
|
|
1988
|
+
packageName: pkgName,
|
|
1989
|
+
version: nextVersion,
|
|
1990
|
+
previousVersion: latestTag || null,
|
|
1991
|
+
revisionRange,
|
|
1992
|
+
repoUrl: null,
|
|
1993
|
+
entries: changelogEntries
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
} else {
|
|
1997
|
+
addChangelogData({
|
|
1998
|
+
packageName: mainPkgName || "monorepo",
|
|
1999
|
+
version: nextVersion,
|
|
2000
|
+
previousVersion: latestTag || null,
|
|
2001
|
+
revisionRange,
|
|
2002
|
+
repoUrl: null,
|
|
2003
|
+
entries: changelogEntries
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
1984
2006
|
const commitPackageName = workspaceNames.length > 0 ? workspaceNames.join(", ") : void 0;
|
|
1985
2007
|
const nextTags = config.packageSpecificTags && workspaceNames.length > 0 ? workspaceNames.map((pkgName) => formatTag(nextVersion, formattedPrefix, pkgName, tagTemplate, true)) : [formatTag(nextVersion, formattedPrefix, null, void 0, false)];
|
|
1986
2008
|
let formattedCommitMessage;
|
|
@@ -63,6 +63,9 @@ var ReleaseKitError = class _ReleaseKitError extends Error {
|
|
|
63
63
|
return error2 instanceof _ReleaseKitError;
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
+
function sanitizePackageName(name) {
|
|
67
|
+
return name.startsWith("@") ? name.slice(1).replace(/\//g, "-") : name;
|
|
68
|
+
}
|
|
66
69
|
|
|
67
70
|
// src/errors/baseError.ts
|
|
68
71
|
var BaseVersionError = class _BaseVersionError extends ReleaseKitError {
|
|
@@ -81,5 +84,6 @@ var BaseVersionError = class _BaseVersionError extends ReleaseKitError {
|
|
|
81
84
|
export {
|
|
82
85
|
readPackageVersion,
|
|
83
86
|
ReleaseKitError,
|
|
87
|
+
sanitizePackageName,
|
|
84
88
|
BaseVersionError
|
|
85
89
|
};
|
package/dist/cli.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
loadConfig,
|
|
6
6
|
log,
|
|
7
7
|
printJsonOutput
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NP6C2DJ2.js";
|
|
9
9
|
import {
|
|
10
10
|
readPackageVersion
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Q3FHZORY.js";
|
|
12
12
|
import "./chunk-LMPZV35Z.js";
|
|
13
13
|
|
|
14
14
|
// src/cli.ts
|
|
@@ -76,7 +76,7 @@ function createVersionCommand() {
|
|
|
76
76
|
log("Versioning process completed.", "success");
|
|
77
77
|
printJsonOutput();
|
|
78
78
|
} catch (error) {
|
|
79
|
-
const { BaseVersionError } = await import("./baseError-
|
|
79
|
+
const { BaseVersionError } = await import("./baseError-DQHIJACF.js");
|
|
80
80
|
if (BaseVersionError.isVersionError(error)) {
|
|
81
81
|
error.logError();
|
|
82
82
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
flushPendingWrites,
|
|
12
12
|
getJsonData,
|
|
13
13
|
loadConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NP6C2DJ2.js";
|
|
15
15
|
import {
|
|
16
16
|
BaseVersionError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-Q3FHZORY.js";
|
|
18
18
|
import "./chunk-LMPZV35Z.js";
|
|
19
19
|
export {
|
|
20
20
|
BaseVersionError,
|