relizy 1.3.0-beta.1 → 1.3.0-beta.2

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/cli.mjs CHANGED
@@ -5,7 +5,7 @@ import process from 'node:process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { printBanner, logger } from '@maz-ui/node';
7
7
  import { Command } from 'commander';
8
- import { ag as isInCI, ah as getCIName, b as bump, c as changelog, g as publish, e as providerRelease, h as social, p as prComment, r as release } from './shared/relizy.w8-5SlcY.mjs';
8
+ import { ag as isInCI, ah as getCIName, b as bump, c as changelog, g as publish, e as providerRelease, h as social, p as prComment, r as release } from './shared/relizy.CupzvopJ.mjs';
9
9
  import '@maz-ui/utils';
10
10
  import 'c12';
11
11
  import 'changelogen';
package/dist/index.d.mts CHANGED
@@ -9,7 +9,8 @@ declare function getDefaultConfig(): {
9
9
  cwd: string;
10
10
  types: NonNullable<RelizyConfig["types"]>;
11
11
  templates: {
12
- commitMessage: string;
12
+ commitMessage: string | undefined;
13
+ commitBody: string | undefined;
13
14
  tagMessage: string;
14
15
  tagBody: string;
15
16
  emptyChangelogContent: string;
@@ -1338,19 +1339,43 @@ interface SlackOptions {
1338
1339
  }
1339
1340
  interface TemplatesConfig {
1340
1341
  /**
1341
- * Commit message template
1342
+ * Commit message template (title).
1343
+ *
1344
+ * Default in `unified`/`selective` modes: `'chore(release): bump version to {{newVersion}}'`.
1345
+ * Default in `independent` mode (when not customized): `'chore(release): bump {{packageCount}} packages'`.
1346
+ *
1347
+ * Available variables:
1348
+ * - `{{newVersion}}` — in `independent` mode, comma-separated list of bumped `name@version` (legacy behavior); otherwise the new version.
1349
+ * - `{{packageCount}}` — number of bumped packages.
1350
+ * - `{{packageNames}}` — comma-separated list of bumped package names.
1351
+ * - `{{packageList}}` — comma-separated list of bumped `name@version`.
1352
+ * - `{{rootVersion}}` — version from the root `package.json`.
1342
1353
  */
1343
1354
  commitMessage?: string;
1355
+ /**
1356
+ * Commit message body template. When defined, it is passed as the commit body.
1357
+ *
1358
+ * Default in `unified`/`selective` modes: `undefined` (no body).
1359
+ * Default in `independent` mode (when `commitMessage` and `commitBody` are not customized): `'{{packageList}}'`.
1360
+ *
1361
+ * Same variables as `commitMessage`.
1362
+ */
1363
+ commitBody?: string;
1344
1364
  /**
1345
1365
  * Tag message template
1366
+ * @default 'Bump version to {{newVersion}}'
1367
+ * Available variables: {{newVersion}}
1346
1368
  */
1347
1369
  tagMessage?: string;
1348
1370
  /**
1349
1371
  * Not used with "independent" version mode
1372
+ * @default 'v{{newVersion}}'
1373
+ * Available variables: {{newVersion}}
1350
1374
  */
1351
1375
  tagBody?: string;
1352
1376
  /**
1353
1377
  * Empty changelog content
1378
+ * @default 'No relevant changes for this release'
1354
1379
  */
1355
1380
  emptyChangelogContent?: string;
1356
1381
  /**
package/dist/index.d.ts CHANGED
@@ -9,7 +9,8 @@ declare function getDefaultConfig(): {
9
9
  cwd: string;
10
10
  types: NonNullable<RelizyConfig["types"]>;
11
11
  templates: {
12
- commitMessage: string;
12
+ commitMessage: string | undefined;
13
+ commitBody: string | undefined;
13
14
  tagMessage: string;
14
15
  tagBody: string;
15
16
  emptyChangelogContent: string;
@@ -1338,19 +1339,43 @@ interface SlackOptions {
1338
1339
  }
1339
1340
  interface TemplatesConfig {
1340
1341
  /**
1341
- * Commit message template
1342
+ * Commit message template (title).
1343
+ *
1344
+ * Default in `unified`/`selective` modes: `'chore(release): bump version to {{newVersion}}'`.
1345
+ * Default in `independent` mode (when not customized): `'chore(release): bump {{packageCount}} packages'`.
1346
+ *
1347
+ * Available variables:
1348
+ * - `{{newVersion}}` — in `independent` mode, comma-separated list of bumped `name@version` (legacy behavior); otherwise the new version.
1349
+ * - `{{packageCount}}` — number of bumped packages.
1350
+ * - `{{packageNames}}` — comma-separated list of bumped package names.
1351
+ * - `{{packageList}}` — comma-separated list of bumped `name@version`.
1352
+ * - `{{rootVersion}}` — version from the root `package.json`.
1342
1353
  */
1343
1354
  commitMessage?: string;
1355
+ /**
1356
+ * Commit message body template. When defined, it is passed as the commit body.
1357
+ *
1358
+ * Default in `unified`/`selective` modes: `undefined` (no body).
1359
+ * Default in `independent` mode (when `commitMessage` and `commitBody` are not customized): `'{{packageList}}'`.
1360
+ *
1361
+ * Same variables as `commitMessage`.
1362
+ */
1363
+ commitBody?: string;
1344
1364
  /**
1345
1365
  * Tag message template
1366
+ * @default 'Bump version to {{newVersion}}'
1367
+ * Available variables: {{newVersion}}
1346
1368
  */
1347
1369
  tagMessage?: string;
1348
1370
  /**
1349
1371
  * Not used with "independent" version mode
1372
+ * @default 'v{{newVersion}}'
1373
+ * Available variables: {{newVersion}}
1350
1374
  */
1351
1375
  tagBody?: string;
1352
1376
  /**
1353
1377
  * Empty changelog content
1378
+ * @default 'No relevant changes for this release'
1354
1379
  */
1355
1380
  emptyChangelogContent?: string;
1356
1381
  /**
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { aa as NEW_PACKAGE_MARKER, T as PR_COMMENT_MARKER, a as buildCommentBody, b as bump, ao as capReleaseTypeForZeroMajor, c as changelog, u as checkGitStatusIfDirty, aC as confirmBump, A as createCommitAndTags, I as createGitlabRelease, k as defineConfig, x as detectGitProvider, K as detectPackageManager, S as detectPullRequest, L as determinePublishTag, aq as determineReleaseType, ap as determineSemverChange, aj as executeBuildCmd, ai as executeFormatCmd, af as executeHook, o as expandPackagesToBumpWithDependents, a3 as extractChangelogSummary, au as extractVersionFromPackageTag, aF as extractVersionFromTag, v as fetchGitTags, al as filterOutPrivatePackages, Q as findGitHubPR, R as findGitLabMR, a0 as formatChangelogForSlack, a1 as formatSlackMessage, ad as formatTweetMessage, i as generateChangelog, O as getAuthCommand, aD as getBumpedIndependentPackages, aB as getBumpedPackageIndependently, ah as getCIName, aG as getCanaryVersion, E as getCurrentGitBranch, F as getCurrentGitRef, j as getDefaultConfig, n as getDependentsOf, D as getFirstCommit, q as getGitStatus, a5 as getIndependentTag, a9 as getLastPackageTag, a8 as getLastRepoTag, a6 as getLastStableTag, a7 as getLastTag, z as getModifiedReleaseFilePatterns, Z as getPackageCommits, m as getPackageDependencies, as as getPackageNewVersion, Y as getPackages, am as getPackagesOrBumpedPackages, N as getPackagesToPublishInIndependentMode, M as getPackagesToPublishInSelectiveMode, az as getPreid, a4 as getReleaseUrl, W as getRootPackage, G as getShortCommitSha, $ as getSlackToken, ac as getTwitterCredentials, H as github, J as gitlab, _ as hasLernaJson, ak as isBumpedPackage, aA as isChangedPreid, ay as isGraduating, an as isGraduatingToStableBetweenVersion, ag as isInCI, av as isPrerelease, ax as isPrereleaseReleaseType, aw as isStableReleaseType, aH as isTagVersionCompatibleWithCurrent, l as loadRelizyConfig, y as parseGitRemoteUrl, U as postPrComment, a2 as postReleaseToSlack, ae as postReleaseToTwitter, p as prComment, e as providerRelease, d as providerReleaseSafetyCheck, g as publish, P as publishPackage, f as publishSafetyCheck, B as pushCommitAndTags, V as readPackageJson, X as readPackages, r as release, ab as resolveTags, C as rollbackModifiedFiles, aE as shouldFilterPrereleaseTags, h as social, s as socialSafetyCheck, t as topologicalSort, at as updateLernaVersion, w as writeChangelogToFile, ar as writeVersion } from './shared/relizy.w8-5SlcY.mjs';
1
+ export { aa as NEW_PACKAGE_MARKER, T as PR_COMMENT_MARKER, a as buildCommentBody, b as bump, ao as capReleaseTypeForZeroMajor, c as changelog, u as checkGitStatusIfDirty, aC as confirmBump, A as createCommitAndTags, I as createGitlabRelease, k as defineConfig, x as detectGitProvider, K as detectPackageManager, S as detectPullRequest, L as determinePublishTag, aq as determineReleaseType, ap as determineSemverChange, aj as executeBuildCmd, ai as executeFormatCmd, af as executeHook, o as expandPackagesToBumpWithDependents, a3 as extractChangelogSummary, au as extractVersionFromPackageTag, aF as extractVersionFromTag, v as fetchGitTags, al as filterOutPrivatePackages, Q as findGitHubPR, R as findGitLabMR, a0 as formatChangelogForSlack, a1 as formatSlackMessage, ad as formatTweetMessage, i as generateChangelog, O as getAuthCommand, aD as getBumpedIndependentPackages, aB as getBumpedPackageIndependently, ah as getCIName, aG as getCanaryVersion, E as getCurrentGitBranch, F as getCurrentGitRef, j as getDefaultConfig, n as getDependentsOf, D as getFirstCommit, q as getGitStatus, a5 as getIndependentTag, a9 as getLastPackageTag, a8 as getLastRepoTag, a6 as getLastStableTag, a7 as getLastTag, z as getModifiedReleaseFilePatterns, Z as getPackageCommits, m as getPackageDependencies, as as getPackageNewVersion, Y as getPackages, am as getPackagesOrBumpedPackages, N as getPackagesToPublishInIndependentMode, M as getPackagesToPublishInSelectiveMode, az as getPreid, a4 as getReleaseUrl, W as getRootPackage, G as getShortCommitSha, $ as getSlackToken, ac as getTwitterCredentials, H as github, J as gitlab, _ as hasLernaJson, ak as isBumpedPackage, aA as isChangedPreid, ay as isGraduating, an as isGraduatingToStableBetweenVersion, ag as isInCI, av as isPrerelease, ax as isPrereleaseReleaseType, aw as isStableReleaseType, aH as isTagVersionCompatibleWithCurrent, l as loadRelizyConfig, y as parseGitRemoteUrl, U as postPrComment, a2 as postReleaseToSlack, ae as postReleaseToTwitter, p as prComment, e as providerRelease, d as providerReleaseSafetyCheck, g as publish, P as publishPackage, f as publishSafetyCheck, B as pushCommitAndTags, V as readPackageJson, X as readPackages, r as release, ab as resolveTags, C as rollbackModifiedFiles, aE as shouldFilterPrereleaseTags, h as social, s as socialSafetyCheck, t as topologicalSort, at as updateLernaVersion, w as writeChangelogToFile, ar as writeVersion } from './shared/relizy.CupzvopJ.mjs';
2
2
  import '@maz-ui/node';
3
3
  import 'node:process';
4
4
  import '@maz-ui/utils';
@@ -1841,7 +1841,9 @@ function getDefaultConfig() {
1841
1841
  ci: { title: "\u{1F916} CI" }
1842
1842
  },
1843
1843
  templates: {
1844
- commitMessage: "chore(release): bump version to {{newVersion}}",
1844
+ // commitMessage & commitBody are resolved dynamically in loadRelizyConfig based on monorepo.versionMode.
1845
+ commitMessage: void 0,
1846
+ commitBody: void 0,
1845
1847
  tagMessage: "Bump version to {{newVersion}}",
1846
1848
  tagBody: "v{{newVersion}}",
1847
1849
  emptyChangelogContent: "No relevant changes for this release",
@@ -1916,6 +1918,16 @@ function getDefaultConfig() {
1916
1918
  safetyCheck: true
1917
1919
  };
1918
1920
  }
1921
+ function resolveTemplateDefaults(config) {
1922
+ const templates = config.templates ?? (config.templates = {});
1923
+ const isIndependent = config.monorepo?.versionMode === "independent";
1924
+ if (templates.commitMessage === void 0) {
1925
+ templates.commitMessage = isIndependent ? "chore(release): bump {{packageCount}} packages" : "chore(release): bump version to {{newVersion}}";
1926
+ if (isIndependent && templates.commitBody === void 0) {
1927
+ templates.commitBody = "{{packageList}}";
1928
+ }
1929
+ }
1930
+ }
1919
1931
  function setupLogger(logLevel) {
1920
1932
  if (logLevel) {
1921
1933
  logger.setLevel(logLevel);
@@ -1962,6 +1974,7 @@ async function loadRelizyConfig(options) {
1962
1974
  }
1963
1975
  setupLogger(options?.overrides?.logLevel || results.config.logLevel);
1964
1976
  logger.verbose("User config:", formatJson(results.config.changelog));
1977
+ resolveTemplateDefaults(results.config);
1965
1978
  const resolvedConfig = await resolveConfig(results.config, cwd);
1966
1979
  logger.debug("Resolved config:", formatJson(resolvedConfig));
1967
1980
  return resolvedConfig;
@@ -2103,15 +2116,38 @@ async function createCommitAndTags({
2103
2116
  throw new Error("Failed to read root package.json");
2104
2117
  }
2105
2118
  newVersion = newVersion || rootPackage.version;
2106
- const versionForMessage = internalConfig.monorepo?.versionMode === "independent" ? bumpedPackages?.map((pkg) => getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version })).join(", ") || "unknown" : newVersion || "unknown";
2107
- const commitMessage = internalConfig.templates.commitMessage?.replaceAll("{{newVersion}}", versionForMessage) || `chore(release): bump version to ${versionForMessage}`;
2119
+ const isIndependent = internalConfig.monorepo?.versionMode === "independent";
2120
+ const packageList = bumpedPackages?.map((pkg) => getIndependentTag({ name: pkg.name, version: pkg.newVersion || pkg.version })).join(", ") || "";
2121
+ const packageNames = bumpedPackages?.map((pkg) => pkg.name).join(", ") || "";
2122
+ const packageCount = bumpedPackages?.length ?? 0;
2123
+ const versionForMessage = isIndependent ? packageList || "unknown" : newVersion || "unknown";
2124
+ const placeholders = {
2125
+ newVersion: versionForMessage,
2126
+ rootVersion: rootPackage.version || "unknown",
2127
+ packageCount: String(packageCount),
2128
+ packageNames: packageNames || "unknown",
2129
+ packageList: packageList || "unknown"
2130
+ };
2131
+ const applyPlaceholders = (template) => {
2132
+ let out = template;
2133
+ for (const [key, value] of Object.entries(placeholders)) {
2134
+ out = out.replaceAll(`{{${key}}}`, value);
2135
+ }
2136
+ return out;
2137
+ };
2138
+ const titleTemplate = internalConfig.templates.commitMessage ?? "chore(release): bump version to {{newVersion}}";
2139
+ const bodyTemplate = internalConfig.templates.commitBody;
2140
+ const commitMessage = applyPlaceholders(titleTemplate);
2141
+ const commitBody = bodyTemplate ? applyPlaceholders(bodyTemplate) : void 0;
2108
2142
  const noVerifyFlag = noVerify ? "--no-verify " : "";
2109
2143
  logger.debug(`No verify: ${noVerify}`);
2144
+ const bodyFlag = commitBody ? ` -m "${commitBody.replaceAll('"', '\\"')}"` : "";
2145
+ const fullCommitCmd = `git commit ${noVerifyFlag}-m "${commitMessage.replaceAll('"', '\\"')}"${bodyFlag}`;
2110
2146
  if (dryRun) {
2111
- logger.info(`[dry-run] git commit ${noVerifyFlag}-m "${commitMessage}"`);
2147
+ logger.info(`[dry-run] ${fullCommitCmd}`);
2112
2148
  } else {
2113
- logger.debug(`Executing: git commit ${noVerifyFlag}-m "${commitMessage}"`);
2114
- await execPromise(`git commit ${noVerifyFlag}-m "${commitMessage}"`, {
2149
+ logger.debug(`Executing: ${fullCommitCmd}`);
2150
+ await execPromise(fullCommitCmd, {
2115
2151
  logLevel,
2116
2152
  noStderr: true,
2117
2153
  noStdout: true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relizy",
3
3
  "type": "module",
4
- "version": "1.3.0-beta.1",
4
+ "version": "1.3.0-beta.2",
5
5
  "description": "Changelogen adapter for monorepo management with unified and independent versioning",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",