MCPcopy Create free account
hub / github.com/dmno-dev/bumpy / render

Function render

packages/bumpy/src/commands/ci.ts:1637–1699  ·  view source on GitHub ↗
(includeSummaries: boolean)

Source from the content-addressed store, hash-verified

1635 const changelogPath = `${pkgDir}/CHANGELOG.md`;
1636 // GitHub anchors diff sections with #diff-<sha256 of file path>
1637 return ` <sub>[CHANGELOG.md](${changesBaseUrl}#diff-${sha256Hex(changelogPath)})</sub>`;
1638}
1639
1640function sha256Hex(input: string): string {
1641 return createHash('sha256').update(input).digest('hex');
1642}
1643
1644// GitHub rejects pull request bodies longer than this many characters
1645// (GraphQL: "Body is too long (maximum is 65536 characters)"). We leave a
1646// little headroom for safety since GitHub's count and JS string length can
1647// differ slightly for multi-byte characters.
1648const GH_BODY_MAX = 65_536;
1649const GH_BODY_SAFE = 64_000;
1650
1651export function formatVersionPrBody(
1652 plan: ReleasePlan,
1653 preamble: string,
1654 packageDirs: Map<string, string>,
1655 repo: string | undefined,
1656 prNumber: string | null,
1657 showNoPatWarning = false,
1658): string {
1659 const changesBaseUrl = repo && prNumber ? `https://github.com/${repo}/pull/${prNumber}/changes` : null;
1660
1661 const groups: Record<string, PlannedRelease[]> = { major: [], minor: [], patch: [] };
1662 for (const r of plan.releases) {
1663 groups[r.type]?.push(r);
1664 }
1665
1666 // Render the body at a given detail level. `includeSummaries: false` drops
1667 // the per-change bullet points, leaving just the version-bump headers — a
1668 // big size reduction for releases with many or large change summaries.
1669 const render = (includeSummaries: boolean): string => {
1670 const lines: string[] = [];
1671 lines.push(preamble);
1672 lines.push('');
1673
1674 if (!includeSummaries) {
1675 lines.push(
1676 '> ℹ️ This release contains too many changes to summarize inline. See the **Files changed** tab and each package’s `CHANGELOG.md` for details.',
1677 );
1678 lines.push('');
1679 }
1680
1681 for (const type of ['major', 'minor', 'patch'] as const) {
1682 const releases = groups[type];
1683 if (!releases || releases.length === 0) continue;
1684
1685 lines.push(bumpSectionHeader(type));
1686 lines.push('');
1687 for (const r of releases) {
1688 const suffix = r.isDependencyBump ? ' _(dep)_' : r.isCascadeBump ? ' _(cascade)_' : '';
1689 const pkgDir = packageDirs.get(r.name);
1690 const diffLinks = pkgDir ? buildDiffLinks(pkgDir, changesBaseUrl) : '';
1691 lines.push(`#### \`${r.name}\` ${r.oldVersion} → **${r.newVersion}**${suffix}${diffLinks}`);
1692 lines.push('');
1693
1694 if (!includeSummaries) continue;

Callers 1

formatVersionPrBodyFunction · 0.70

Calls 3

bumpSectionHeaderFunction · 0.85
buildDiffLinksFunction · 0.85
sha256HexFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…