§ 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
§ Purpose

7 main features (see above):
- Wraps the version with a link (brackets) and creates the diff URL in the footer.
- Adds missing diff links in the footer. It's intelligent-enough to detect existing links and their order.
- If the
.git
repo data is successfully read, it will create/convert diff links either in Bitbucket- or GitHub-based repository changelogs. - User account name in diff link is set correctly as per
package.json
- Project's name in diff link is set correctly as per
package.json
- "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. - If dates are not in ISO format (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 argument | Type | Obligatory? | Description |
---|---|---|---|
changelogContents | String | yes | Contents of the changelog |
gitTags | Plain Object | no | Git data from gitTags to calculate "from" entry in diff url |
packageJsonContents | Plain Object | no | package.json to retrieve the current version |
§ API - Output
It returns a string, processed changelog.
§ Changelog
See it in the monorepo , on Sourcehut.
§ Licence
Copyright © 2010–2020 Roy Revelt and other contributors
Related packages:
📦 chlu-cli 1.17.1
CH-ange-L-og U-pdate - Automatically fix errors in your changelog file