chlu3.7.76

CH-ange-L-og U-pdate - Automatically fix errors in your changelog file

§ Quick Take

import { strict as assert } from "assert";
import chluLib from "chlu";

const original = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## 1.3.0 - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/correct-lib/compare/v1.3.0...v1.4.0
`;

const expected = `# Seed Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.4.0] - 2017-05-09
### Added
- blablabla

## [1.3.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.2.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## [1.1.0] - 2017-04-20
### Added
- blablabla
- blablabla
### Improved
- blablabla
### Updated
- Readme
### Unchanged
- Code coverage is still 100%

## 1.0.0 - 2017-04-03
### New
- First public release

[1.4.0]: https://github.com/codsen/correct-lib/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/codsen/correct-lib/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/codsen/correct-lib/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/codsen/correct-lib/compare/v1.0.0...v1.1.0
`;

assert.equal(chluLib(original), expected);
2020 summer update

A long time has passed since we created this program. Our workflow has evolved since and we don't use it any more. Our npm packages live in a monorepo on GitLab, deployment is via GitLab CI and commitizen automates all the versioning and changelog updates.

We're saying this because normally we use our programs, following the "eat what you cook" principle of Indieweb opens in a new tab

§ Purpose

features

7 main features (see above):

  1. Wraps the version with a link (brackets) and creates the diff URL in the footer.
  2. Adds missing diff links in the footer. It's intelligent-enough to detect existing links and their order.
  3. If the .git repo data is successfully read, it will create/convert diff links either in Bitbucket- or GitHub-based repository changelogs.
  4. User account name in diff link is set correctly as per package.json
  5. Project's name in diff link is set correctly as per package.json
  6. "from" version is chosen wisely. If there is no git data available, a previous entry in the changelog will be used. But if there is, the real, previous version will be used. In practice, often there are many patch releases between changelog entries (hence the word used in the title — "notable changes"). If we merely calculated the diff between changelog entries (usually minor/major releases), all patch releases would get caught in between and skew the picture of what was released for real.
  7. If dates are not in ISO format opens in a new tab (year-month-date), we try to convert them. Couple well-known projects with messed-up changelogs are used as guinea pigs in our unit tests.

§ API - Input

chlu(changelogContents, [gitTags, packageJsonContents])

In other words, it is a string-in, string-out function.

Input argumentTypeObligatory?Description
changelogContentsStringyesContents of the changelog
gitTagsPlain ObjectnoGit data from gitTags opens in a new tab to calculate "from" entry in diff url
packageJsonContentsPlain Objectnopackage.json to retrieve the current version

§ API - Output

It returns a string, processed changelog.

§ Licence

MIT opens in a new tab

Copyright © 2010–2020 Roy Revelt and other contributors

Related packages:

📦 chlu-cli 1.16.82
CH-ange-L-og U-pdate - Automatically fix errors in your changelog file