Generate a changelog from git metadata with Angular commit convention.
npx @tessl/cli install tessl/npm-standard-changelog@7.0.0Standard Changelog provides an opinionated approach to CHANGELOG generation using Angular commit conventions. It offers both a command-line interface and a JavaScript API for generating changelogs from git metadata, with automatic detection of features, fixes, performance improvements, and breaking changes.
npm install standard-changelogimport { StandardChangelog } from "standard-changelog";For CommonJS:
const { StandardChangelog } = require("standard-changelog");# Generate changelog for current release
standard-changelog
# Generate changelog for first release
standard-changelog --first-release
# Output to stdout
standard-changelog --stdout
# Append to existing changelog
standard-changelog -aimport { StandardChangelog } from "standard-changelog";
// Basic usage
const generator = new StandardChangelog(process.cwd())
.readPackage();
// Generate as stream
generator.writeStream().pipe(process.stdout);
// Generate as async iterator
for await (const chunk of generator.write()) {
console.log(chunk);
}Standard Changelog is built on top of the conventional-changelog ecosystem with these key components:
Core changelog generation class with Angular commit conventions pre-configured. Extends ConventionalChangelog with all inherited methods available.
class StandardChangelog extends ConventionalChangelog {
constructor(cwdOrGitClient: string | ConventionalGitClient);
}Command-line interface for generating changelogs with extensive configuration options.
function runProgram(
generator: ConventionalChangelog,
flags: Flags
): Promise<void>;
interface Flags {
infile?: string;
outfile?: string;
stdout?: boolean;
preset?: string;
pkg?: string;
append?: boolean;
releaseCount?: number;
skipUnstable?: boolean;
outputUnreleased?: boolean;
verbose?: boolean;
config?: string;
context?: string;
firstRelease?: boolean;
lernaPackage?: string;
tagPrefix?: string;
}All types and functions from conventional-changelog are re-exported for full ecosystem compatibility.
// Core classes
export { ConventionalChangelog } from "conventional-changelog";
// Core types
export type {
Commit,
Package,
Logger,
PackageTransform,
CommitTransformFunction,
HostType,
HostedGitInfo,
HostOptions,
FinalizedContext,
Preset,
Options,
Params
} from "conventional-changelog";
// Utility functions
export { packagePrefix, flags, runProgram } from "conventional-changelog";interface ConventionalGitClient {
cwd: string;
debug?: Logger;
getSemverTags(params?: GetSemverTagsParams): AsyncGenerator<string>;
getCommits(params: GetCommitsParams, parserOptions?: ParserStreamOptions): AsyncGenerator<Commit>;
verify(revision: string): Promise<void>;
getConfig(key: string): Promise<string>;
}
type Logger = (source: string, messages: string | string[]) => void;
interface Commit extends CommitBase {
[key: string]: string | null;
}
interface CommitBase {
merge: string | null;
revert: CommitMeta | null;
header: string | null;
body: string | null;
footer: string | null;
notes: CommitNote[];
mentions: string[];
references: CommitReference[];
}
interface CommitNote {
title: string;
text: string;
}
interface CommitReference {
raw: string;
action: string | null;
owner: string | null;
repository: string | null;
issue: string;
prefix: string;
}
type CommitMeta = Record<string, string | null>;
interface Details<T> {
log: string;
keyCommit: T | null;
}