Skip to content

Commit

Permalink
Use keep-a-changelog functions for modifying changelog (#9)
Browse files Browse the repository at this point in the history
* Use keep-a-changelog functions for modifying changelog

* Update changelog
  • Loading branch information
Ted Janeczko authored Sep 3, 2018
1 parent 3450520 commit ea5c1e4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Use functions from keep-a-changelog instead the Semver library directly to avoid library versioning issues

## [0.1.4] - 2018-08-26

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"license": "Apache-2.0",
"dependencies": {
"chalk": "^2.4.1",
"keep-a-changelog": "^0.6.3",
"semver": "^5.5.1"
"keep-a-changelog": "^0.6.4"
},
"repository": {
"type": "git",
Expand Down
9 changes: 4 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node

const Semver = require('semver');
const { parser, Release, Changelog } = require('keep-a-changelog');
const fs = require('fs');
const chalk = require('chalk');
Expand Down Expand Up @@ -98,13 +97,13 @@ module.exports.release = function () {
const changelog = getChangelog();
changelog.url = pkg.repository.url;

const unreleased = changelog.releases.find(release => !release.version);
const existingRelease = changelog.releases.some(release => release.version && Semver.eq(release.version, pkg.version));
const unreleased = changelog.findRelease();
const existingRelease = changelog.findRelease(pkg.version);

if (!existingRelease) {
ensureChangesForRelease(unreleased);
unreleased.version = new Semver(pkg.version);

unreleased.setVersion(pkg.version);
unreleased.date = new Date();

changelog.addRelease(new Release());
Expand Down

0 comments on commit ea5c1e4

Please sign in to comment.