conventional-changelog

  • Version 7.1.0
  • Published
  • 387 kB
  • 8 dependencies
  • MIT license

Install

npm i conventional-changelog
yarn add conventional-changelog
pnpm add conventional-changelog

Overview

Generate a changelog from git metadata.

Index

Variables

variable flags

const flags: {
readonly infile: {
readonly shortFlag: 'i';
readonly default: 'CHANGELOG.md';
readonly type: 'string';
};
readonly outfile: { readonly shortFlag: 'o'; readonly type: 'string' };
readonly stdout: { readonly type: 'boolean' };
readonly preset: { readonly shortFlag: 'p'; readonly type: 'string' };
readonly pkg: { readonly shortFlag: 'k'; readonly type: 'string' };
readonly append: { readonly shortFlag: 'a'; readonly type: 'boolean' };
readonly releaseCount: { readonly shortFlag: 'r'; readonly type: 'number' };
readonly skipUnstable: { readonly type: 'boolean' };
readonly outputUnreleased: { readonly shortFlag: 'u'; readonly type: 'boolean' };
readonly verbose: { readonly shortFlag: 'v'; readonly type: 'boolean' };
readonly config: { readonly shortFlag: 'n'; readonly type: 'string' };
readonly context: { readonly shortFlag: 'c'; readonly type: 'string' };
readonly firstRelease: { readonly shortFlag: 'f'; readonly type: 'boolean' };
readonly lernaPackage: { readonly shortFlag: 'l'; readonly type: 'string' };
readonly tagPrefix: { readonly shortFlag: 't'; readonly type: 'string' };
};

    Functions

    function runProgram

    runProgram: (generator: ConventionalChangelog, flags: Flags) => Promise<void>;

      Classes

      class ConventionalChangelog

      class ConventionalChangelog {}
      • Conventional changelog generator

      constructor

      constructor(cwdOrGitClient?: any);

        method commits

        commits: (params: GetCommitsParams, parserOptions?: ParserStreamOptions) => this;
        • Set params to get commits

          Parameter params

          Params to get commits since last release

          Parameter parserOptions

          Parser options

          Returns

          this

        method config

        config: (config: Preset | Promise<Preset>) => this;
        • Set the config directly

          Parameter config

          Config object

          Returns

          this

        method context

        context: (context: Context) => this;
        • Set writer context data

          Parameter context

          Writer context data

          Returns

          this

        method loadPreset

        loadPreset: <
        PresetCreatorParams extends UnknownPresetCreatorParams = UnknownPresetCreatorParams
        >(
        preset: PresetParams<PresetCreatorParams>,
        loader?: PresetModuleLoader
        ) => this;
        • Load configs from a preset

          Parameter preset

          Parameter loader

          Preset module loader, if not provided, will use default loader

          Returns

          this

        method options

        options: (options: Options) => this;
        • Set conventional-changelog options

          Parameter options

          Generator options

          Returns

          this

        method package

        package: (pkg: Record<string, unknown>) => this;
        • Set package.json data

          Parameter pkg

          Package.json data

          Returns

          this

        method readPackage

        readPackage: {
        (transform?: PackageTransform): this;
        (path?: string, transform?: PackageTransform): this;
        };
        • Find package.json and read it

          Parameter transform

          Optional transform function

          Returns

          this

        • Read package.json from a specified path

          Parameter path

          Path to package.json

          Parameter transform

          Optional transform function

          Returns

          this

        method readRepository

        readRepository: () => this;
        • Read repository info from the current git repository

          Returns

          this

        method repository

        repository: (infoOrGitUrl: string | Partial<HostedGitInfo>) => this;
        • Set repository info

          Parameter infoOrGitUrl

          Hosted git info or git url

          Returns

          this

        method tags

        tags: (params: GetSemverTagsParams) => this;
        • Set params to get semver tags

          Parameter params

          Params to get the last semver tag

          Returns

          this

        method write

        write: {
        (includeDetails?: false): AsyncGenerator<string, void>;
        (includeDetails: true): AsyncGenerator<Details<Commit>, void, unknown>;
        (includeDetails?: boolean): AsyncGenerator<any, void, unknown>;
        };
        • Generate changelog

          Parameter includeDetails

          Generate data objects instead of strings

          Returns

          Changelog generator

        • Generate changelog data objects

          Parameter includeDetails

          Generate data objects instead of strings

        method writer

        writer: (params: WriterOptions) => this;
        • Set writer options

          Parameter params

          Writer options

          Returns

          this

        method writeStream

        writeStream: (includeDetails?: boolean) => Readable;
        • Generate changelog to stream

          Parameter includeDetails

          Generate data objects instead of strings

          Returns

          Changelog stream

        Interfaces

        interface FinalizedContext

        interface FinalizedContext extends FinalContext {}

          property currentTag

          currentTag?: string | null;

            property linkCompare

            linkCompare?: boolean;

              property previousTag

              previousTag?: string | null;

                interface Flags

                interface Flags {}

                  property append

                  append?: boolean;

                    property config

                    config?: string;

                      property context

                      context?: string;

                        property firstRelease

                        firstRelease?: boolean;

                          property infile

                          infile?: string;

                            property lernaPackage

                            lernaPackage?: string;

                              property outfile

                              outfile?: string;

                                property outputUnreleased

                                outputUnreleased?: boolean;

                                  property pkg

                                  pkg?: string;

                                    property preset

                                    preset?: string;

                                      property releaseCount

                                      releaseCount?: number;

                                        property skipUnstable

                                        skipUnstable?: boolean;

                                          property stdout

                                          stdout?: boolean;

                                            property tagPrefix

                                            tagPrefix?: string;

                                              property verbose

                                              verbose?: boolean;

                                                interface HostedGitInfo

                                                interface HostedGitInfo {}

                                                  property host

                                                  host: string;

                                                    property owner

                                                    owner?: string;

                                                      property project

                                                      project?: string;

                                                        property type

                                                        type: HostType;

                                                          property url

                                                          url: string;

                                                            interface HostOptions

                                                            interface HostOptions {}

                                                              property commit

                                                              commit: string;

                                                                property issue

                                                                issue: string;

                                                                  property issuePrefixes

                                                                  issuePrefixes: string[];

                                                                    property referenceActions

                                                                    referenceActions: string[];

                                                                      interface Options

                                                                      interface Options {}

                                                                        property append

                                                                        append?: boolean;
                                                                        • Should the log be appended to existing data. false

                                                                        property debug

                                                                        debug?: Logger;
                                                                        • Logger for debug messages.

                                                                        property outputUnreleased

                                                                        outputUnreleased?: boolean;
                                                                        • If this value is true and context.version equals last release then context.version will be changed to 'Unreleased'.

                                                                        property releaseCount

                                                                        releaseCount?: number;
                                                                        • How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to 0 to regenerate all. 1

                                                                        property reset

                                                                        reset?: boolean;
                                                                        • Whether to reset the changelog or not. false

                                                                        property transformCommit

                                                                        transformCommit?: CommitTransformFunction;
                                                                        • A transform function that applies after the parser and before the writer.

                                                                        property warn

                                                                        warn?: Logger;
                                                                        • Logger for warnings.

                                                                        method formatDate

                                                                        formatDate: (date: string | Date) => string;
                                                                        • A function to format date.

                                                                          Parameter date

                                                                          Date string or Date object.

                                                                          Returns

                                                                          Final date string.

                                                                        interface Params

                                                                        interface Params extends Preset {}

                                                                          property commits

                                                                          commits: GetCommitsParams;

                                                                            property context

                                                                            context?: Context;

                                                                              property options

                                                                              options: Options;

                                                                                property package

                                                                                package?: Package;

                                                                                  property repository

                                                                                  repository?: Partial<HostedGitInfo> | null;

                                                                                    interface Preset

                                                                                    interface Preset {}

                                                                                      property commits

                                                                                      commits?: GetCommitsParams;

                                                                                        property parser

                                                                                        parser?: ParserStreamOptions;

                                                                                          property tags

                                                                                          tags?: GetSemverTagsParams;

                                                                                            property writer

                                                                                            writer?: WriterOptions;

                                                                                              Type Aliases

                                                                                              type CommitTransformFunction

                                                                                              type CommitTransformFunction = (
                                                                                              commit: Commit,
                                                                                              params: Params
                                                                                              ) => Partial<Commit> | null | Promise<Partial<Commit> | null>;

                                                                                                type HostType

                                                                                                type HostType = 'github' | 'gitlab' | 'bitbucket' | 'sourcehut' | '';

                                                                                                  type Logger

                                                                                                  type Logger = (source: string, messages: string | string[]) => void;

                                                                                                    type Package

                                                                                                    type Package = Partial<NormalizedPackage>;

                                                                                                      type PackageTransform

                                                                                                      type PackageTransform = (pkg: Package) => Package;

                                                                                                        Package Files (4)

                                                                                                        Dependencies (8)

                                                                                                        Dev Dependencies (0)

                                                                                                        No dev dependencies.

                                                                                                        Peer Dependencies (0)

                                                                                                        No peer dependencies.

                                                                                                        Badge

                                                                                                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/conventional-changelog.

                                                                                                        • Markdown
                                                                                                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/conventional-changelog)
                                                                                                        • HTML
                                                                                                          <a href="https://www.jsdocs.io/package/conventional-changelog"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>