Home / Function/ renderChangelog() — react Function Reference

renderChangelog() — react Function Reference

Architecture documentation for the renderChangelog() function in formatters.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  083652dd_17f5_63a3_75af_1b2cb3a1c21a["renderChangelog()"]
  9ea677d7_cac5_5d9f_3511_29ba3c0e3110["formatters.js"]
  083652dd_17f5_63a3_75af_1b2cb3a1c21a -->|defined in| 9ea677d7_cac5_5d9f_3511_29ba3c0e3110
  style 083652dd_17f5_63a3_75af_1b2cb3a1c21a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/tasks/generate-changelog/formatters.js lines 104–223

function renderChangelog(entries, format) {
  if (format === 'text') {
    const lines = [];
    for (let i = 0; i < entries.length; i++) {
      const entry = entries[i];
      lines.push(`## ${entry.package}@${entry.version}`);
      if (!entry.hasChanges) {
        lines.push(`* ${entry.note}`);
        lines.push('');
        continue;
      }

      entry.commits.forEach(commit => {
        lines.push(
          `* ${commit.summary} (${commit.reference.label} by ${commit.author.display})`
        );
      });
      lines.push('');
    }

    while (lines.length && lines[lines.length - 1] === '') {
      lines.pop();
    }

    return lines.join('\n');
  }

  if (format === 'csv') {
    const header = [
      'package',
      'version',
      'summary',
      'reference_type',
      'reference_id',
      'reference_url',
      'author_name',
      'author_login',
      'author_url',
      'author_email',
      'commit_sha',
      'commit_url',
    ];
    const rows = [header];

    entries.forEach(entry => {
      if (!entry.hasChanges) {
        rows.push([
          entry.package,
          entry.version,
          entry.note,
          '',
          '',
          '',
          '',
          '',
          '',
          '',
          '',
          '',
        ]);
        return;
      }

      entry.commits.forEach(commit => {
        const authorName =
          commit.author.name ||
          (commit.author.login ? `@${commit.author.login}` : 'unknown author');
        rows.push([
          entry.package,
          entry.version,
          commit.summary,
          commit.reference.type,
          commit.reference.id,
          commit.reference.url,
          authorName,
          commit.author.login || '',
          commit.author.url || '',
          commit.author.email || '',
          commit.commitSha,
          commit.commitUrl,
        ]);

Domain

Subdomains

Frequently Asked Questions

What does renderChangelog() do?
renderChangelog() is a function in the react codebase, defined in scripts/tasks/generate-changelog/formatters.js.
Where is renderChangelog() defined?
renderChangelog() is defined in scripts/tasks/generate-changelog/formatters.js at line 104.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free