Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Puppeteer Puppeteer Merge Changelogs

From Leeroopedia
Property Value
sources tools/merge-changelogs.ts
domains Tools, Release Management
last_updated 2026-02-12 00:00 GMT

Overview

Description

The merge-changelogs tool is a TypeScript script that merges the separate changelogs from the puppeteer and puppeteer-core packages into a single combined CHANGELOG.md file at the repository root. Since the two packages share version numbers and often contain complementary changelog entries, this tool produces a unified view of changes for each release.

The script works in three phases:

  1. Parsing -- The parseChangelog function reads each changelog file and parses it into an array of Version objects. Each version contains the semantic version string, the header line (e.g., ## [24.0.0](...)), and an array of content lines. Versions are delimited by ## headers, and the version number is extracted via regex.
  2. Merging -- For each version in the puppeteer changelog, the script searches the puppeteer-core changelog for a matching version. When a match is found, mergeVersions combines the two entries by collecting all section headers (lines starting with ### ) and their bullet-point entries into a Map. Duplicate entries within the same section are deduplicated using a Set.
  3. Output -- The merged entries are written to ./CHANGELOG.md with a combined header noting that the file covers both packages.

Usage

This script is run as part of the release process to generate the combined changelog. It reads from ./packages/puppeteer/CHANGELOG.md and ./packages/puppeteer-core/CHANGELOG.md, and writes to ./CHANGELOG.md.

Code Reference

Source Location

tools/merge-changelogs.ts

Signature

interface Version {
  version: string;
  header: string;
  lines: string[];
}

function parseChangelog(file: string): Version[];
function mergeVersions(a: Version, b: Version): Version;

// Script body: reads, merges, and writes changelogs

Import

// This is a standalone script, not a library module.
// Run directly: npx ts-node tools/merge-changelogs.ts

I/O Contract

Input Type Description
./packages/puppeteer/CHANGELOG.md File The puppeteer package changelog
./packages/puppeteer-core/CHANGELOG.md File The puppeteer-core package changelog
Output Type Description
./CHANGELOG.md File The merged combined changelog
Function Input Output Description
parseChangelog string (file path) Version[] Parses a changelog file into version entries
mergeVersions Version, Version Version Merges two version entries, deduplicating sections and lines

Usage Examples

// Run the script from the repository root
// npx ts-node tools/merge-changelogs.ts

// The script reads:
//   ./packages/puppeteer/CHANGELOG.md
//   ./packages/puppeteer-core/CHANGELOG.md
//
// And produces:
//   ./CHANGELOG.md
//
// With content like:
// # Changelog
//
// Combined changelog for puppeteer and puppeteer-core.
//
// ## [24.0.0](https://github.com/puppeteer/puppeteer/compare/...)
//
// ### Bug Fixes
// * fix description 1
// * fix description 2
//
// ### Features
// * feature description 1

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment