How to use lerna-changelog - 1 common examples

To help you get started, we’ve selected a few lerna-changelog 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 shopgate / pwa / scripts / build-changelog.js View on Github external
async function run() {
  try {
    // Find last release: Get tags, filter out wrong tags and pre-releases, then take last one.
    const { stdout } = // get last filtered tag, sorted by version numbers in ascending order
      await exec(`git tag | grep '${tagFrom}' | grep -Ev '-' | sort -bt. -k1,1 -k2,2n -k3,3n -k4,4n -k5,5n | tail -1`);
    const prevTag = stdout.trim();

    // Normalize the given "release-name" for the tile (strip out pre-release information).
    const nextVersionString = `v${nextVersion.major}.${nextVersion.minor}.${nextVersion.patch}`;

    // Read previous changelog to extend it (remove ending line feeds -> added back in later)
    const changelogContent = fs.readFileSync('CHANGELOG.md', { encoding: 'utf8' }).trimRight();

    const config = lernaConfiguration.load();

    // This causes the "Unreleased" title to be replaced by a version that links to a github diff.
    config.nextVersion = `[${
      nextVersionString
    }](https://github.com/shopgate/pwa/compare/${prevTag}...${nextVersionString})`;

    // Skip creation if the "nextVersion" title is already present.
    if (changelogContent.includes(config.nextVersion)) {
      // Output the already existing data when already is there already.
      logger.log(changelogContent);
      return;
    }

    const changelog = new Changelog(config);

    // The "release-name" param is not supposed to be used here. Instead use "HEAD".

lerna-changelog

Generate a changelog for a lerna monorepo

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular lerna-changelog functions