Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
perf(projects): remove version compare title
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed May 31, 2023
1 parent c6b3785 commit dcfcf85
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { convert } from 'convert-gitmoji';
import { upperFirst, partition, groupBy, capitalize, join } from './shared';
import { $fetch } from 'ohmyfetch';
import { formatReference } from './repo';
import type { Reference, Commit, ResolvedChangelogOptions, RepoConfig, GitCommit, ChangelogConfig } from './types';
import type { Reference, Commit, ResolvedChangelogOptions, GitCommit, ChangelogConfig } from './types';

const emojisRE =
/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;
Expand Down Expand Up @@ -132,11 +132,7 @@ export async function generateChangelog(commits: Commit[], config: ResolvedChang

// Version Title
const v = config.newVersion && `v${config.newVersion}`;
markdown.push('', `## ${v || `${config.from || ''}...${config.to}`}`, '');

if (config.repo && config.from) {
markdown.push(formatCompareChanges(v, config));
}
markdown.push('', `## ${v}`, '');

const typeKeys = Object.keys(config.types);
typeKeys.forEach(typeKey => {
Expand Down Expand Up @@ -211,15 +207,6 @@ export async function generateChangelog(commits: Commit[], config: ResolvedChang
return convert(markdown.join('\n').trim(), true);
}

function baseUrl(config: RepoConfig) {
return `https://${config.domain}/${config.repo}`;
}

function formatCompareChanges(v: string, config: ResolvedChangelogOptions) {
const part = config.repo.provider === 'bitbucket' ? 'branches/compare' : 'compare';
return `[compare changes](${baseUrl(config.repo)}/${part}/${config.from}...${v || config.to})`;
}

function formatCommit(commit: GitCommit, config: ChangelogConfig) {
return `- ${commit.scope ? `**${commit.scope.trim()}:** ` : ''}${commit.isBreaking ? '⚠️ ' : ''}${upperFirst(
commit.description
Expand Down

0 comments on commit dcfcf85

Please sign in to comment.