@releasekit/version 0.4.1 → 0.5.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,6 +1,6 @@
1
1
  import {
2
2
  BaseVersionError
3
- } from "./chunk-2MN2VLZF.js";
3
+ } from "./chunk-Q3FHZORY.js";
4
4
  export {
5
5
  BaseVersionError
6
6
  };
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  BaseVersionError,
3
- ReleaseKitError
4
- } from "./chunk-2MN2VLZF.js";
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?.startsWith("@") ? packageName.slice(1).replace(/\//g, "-") : 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.
@@ -1147,13 +1155,12 @@ async function calculateVersion(config, options) {
1147
1155
  const hasNoTags = !latestTag || latestTag.trim() === "";
1148
1156
  const normalizedPrereleaseId = normalizePrereleaseIdentifier(prereleaseIdentifier, config);
1149
1157
  try {
1150
- let determineTagSearchPattern2 = function(packageName, prefix) {
1151
- if (!packageName) {
1152
- return prefix;
1153
- }
1154
- return `${packageName}@${prefix}`;
1155
- }, escapeRegExp3 = function(string) {
1156
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1158
+ let buildTagStripPattern2 = function(packageName, prefix) {
1159
+ if (!packageName) return escapeRegExp(prefix);
1160
+ const sanitized = sanitizePackageName(packageName);
1161
+ const escapedRaw = escapeRegExp(`${packageName}@${prefix}`);
1162
+ const escapedDash = escapeRegExp(`${sanitized}-${prefix}`);
1163
+ return `(?:${escapedRaw}|${escapedDash})`;
1157
1164
  }, getCurrentVersionFromSource2 = function() {
1158
1165
  if (!versionSource) {
1159
1166
  if (hasNoTags) {
@@ -1168,10 +1175,9 @@ async function calculateVersion(config, options) {
1168
1175
  }
1169
1176
  return versionSource.version;
1170
1177
  };
1171
- var determineTagSearchPattern = determineTagSearchPattern2, escapeRegExp2 = escapeRegExp3, getCurrentVersionFromSource = getCurrentVersionFromSource2;
1178
+ var buildTagStripPattern = buildTagStripPattern2, getCurrentVersionFromSource = getCurrentVersionFromSource2;
1172
1179
  const originalPrefix = versionPrefix || "";
1173
- const tagSearchPattern = determineTagSearchPattern2(name, originalPrefix);
1174
- const escapedTagPattern = escapeRegExp3(tagSearchPattern);
1180
+ const escapedTagPattern = buildTagStripPattern2(name, originalPrefix);
1175
1181
  let versionSource;
1176
1182
  if (pkgPath) {
1177
1183
  const packageDir = pkgPath || cwd();
@@ -1972,15 +1978,28 @@ function createSyncStrategy(config) {
1972
1978
  }
1973
1979
  ];
1974
1980
  }
1975
- addChangelogData({
1976
- packageName: mainPkgName || "monorepo",
1977
- version: nextVersion,
1978
- previousVersion: latestTag || null,
1979
- revisionRange,
1980
- repoUrl: null,
1981
- entries: changelogEntries
1982
- });
1983
1981
  const workspaceNames = updatedPackages.filter((n) => n !== "root");
1982
+ if (config.packageSpecificTags && workspaceNames.length > 0) {
1983
+ for (const pkgName of workspaceNames) {
1984
+ addChangelogData({
1985
+ packageName: pkgName,
1986
+ version: nextVersion,
1987
+ previousVersion: latestTag || null,
1988
+ revisionRange,
1989
+ repoUrl: null,
1990
+ entries: changelogEntries
1991
+ });
1992
+ }
1993
+ } else {
1994
+ addChangelogData({
1995
+ packageName: mainPkgName || "monorepo",
1996
+ version: nextVersion,
1997
+ previousVersion: latestTag || null,
1998
+ revisionRange,
1999
+ repoUrl: null,
2000
+ entries: changelogEntries
2001
+ });
2002
+ }
1984
2003
  const commitPackageName = workspaceNames.length > 0 ? workspaceNames.join(", ") : void 0;
1985
2004
  const nextTags = config.packageSpecificTags && workspaceNames.length > 0 ? workspaceNames.map((pkgName) => formatTag(nextVersion, formattedPrefix, pkgName, tagTemplate, true)) : [formatTag(nextVersion, formattedPrefix, null, void 0, false)];
1986
2005
  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-P3KG635S.js";
8
+ } from "./chunk-MRXNAFME.js";
9
9
  import {
10
10
  readPackageVersion
11
- } from "./chunk-2MN2VLZF.js";
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-FARJUY5U.js");
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-P3KG635S.js";
14
+ } from "./chunk-MRXNAFME.js";
15
15
  import {
16
16
  BaseVersionError
17
- } from "./chunk-2MN2VLZF.js";
17
+ } from "./chunk-Q3FHZORY.js";
18
18
  import "./chunk-LMPZV35Z.js";
19
19
  export {
20
20
  BaseVersionError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@releasekit/version",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Semantic versioning based on Git history and conventional commits",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",