How to use conventional-changelog-writer - 2 common examples

To help you get started, we’ve selected a few conventional-changelog-writer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github positive-js / mosaic / tools / release / changelog.ts View on Github external
function createDedupeWriterOptions(changelogPath: string) {
    const existingChangelogContent = readFileSync(changelogPath, 'utf8');
    const commitSortFunction = changelogCompare.functionify(['type', 'scope', 'subject']);

    return {
        // Overwrite the changelog templates so that we can render the commits grouped
        // by package names. Templates are based on the original templates of the
        // angular preset: "conventional-changelog-angular/templates".
        mainTemplate: readFileSync(join(__dirname, 'changelog-root-template.hbs'), 'utf8'),
        commitPartial: readFileSync(join(__dirname, 'changelog-commit-template.hbs'), 'utf8'),
        // Specify a writer option that can be used to modify the content of a new changelog section.
        // See: conventional-changelog/tree/master/packages/conventional-changelog-writer
        finalizeContext: (context: any) => {
            const packageGroups: {[packageName: string]: ChangelogPackage} = {};

            context.commitGroups.forEach((group: any) => {
                group.commits.forEach((commit: any) => {
                    // Filter out duplicate commits. Note that we cannot compare the SHA because the commits
                    // will have a different SHA if they are being cherry-picked into a different branch.
github angular / components / tools / release / changelog.ts View on Github external
function createChangelogWriterOptions(changelogPath: string, presetWriterOptions: any) {
  const existingChangelogContent = readFileSync(changelogPath, 'utf8');
  const commitSortFunction = changelogCompare.functionify(['type', 'scope', 'subject']);
  const allPackages = [...orderedChangelogPackages, ...excludedChangelogPackages];

  return {
    // Overwrite the changelog templates so that we can render the commits grouped
    // by package names. Templates are based on the original templates of the
    // angular preset: "conventional-changelog-angular/templates".
    mainTemplate: readFileSync(join(__dirname, 'changelog-root-template.hbs'), 'utf8'),
    commitPartial: readFileSync(join(__dirname, 'changelog-commit-template.hbs'), 'utf8'),

    // Overwrites the conventional-changelog-angular preset transform function. This is necessary
    // because the Angular preset changes every commit note to a breaking change note. Since we
    // have a custom note type for deprecations, we need to keep track of the original type.
    transform: (commit, context) => {
      commit.notes.forEach(n => n.type = n.title);
      return presetWriterOptions.transform(commit, context);
    },

conventional-changelog-writer

Write logs based on conventional commits and templates.

ISC
Latest version published 8 months ago

Package Health Score

87 / 100
Full package analysis

Popular conventional-changelog-writer functions