Socket
Socket
Sign inDemoInstall

keep-a-changelog

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keep-a-changelog - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

test/empty.expected.md

8

bin.js

@@ -40,5 +40,3 @@ #!/usr/bin/env node

changelog.url = getHttpUrl(
config.remote &&
config.remote.origin &&
config.remote.origin.url
config.remote && config.remote.origin && config.remote.origin.url
);

@@ -66,5 +64,3 @@ save(file, changelog);

parsed.pathname = parsed.pathname
.replace(/\.git$/, '')
.replace(/^\/\:/, '/');
parsed.pathname = parsed.pathname.replace(/\.git$/, '').replace(/^\/\:/, '/');

@@ -71,0 +67,0 @@ return url.format(parsed);

@@ -8,2 +8,10 @@ # Changelog

## [0.6.3] - 2018-08-22
### Fixed
- Fixed trailing newlines when no links are present - [#5]
- Fixed case of unreleased version to match http://keepachangelog.com/ - [#4]
- Fixed Release isEmpty and add tests - [#3]
## [0.6.2] - 2018-07-24

@@ -103,4 +111,8 @@

[#5]: https://github.com/oscarotero/keep-a-changelog/issues/5
[#4]: https://github.com/oscarotero/keep-a-changelog/issues/4
[#3]: https://github.com/oscarotero/keep-a-changelog/issues/3
[#1]: https://github.com/oscarotero/keep-a-changelog/issues/1
[0.6.3]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.2...v0.6.3
[0.6.2]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.1...v0.6.2

@@ -107,0 +119,0 @@ [0.6.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.6.0...v0.6.1

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/oscarotero/keep-a-changelog#readme",
"version": "0.6.2",
"version": "0.6.3",
"main": "src/index.js",

@@ -29,4 +29,4 @@ "bin": {

"dependencies": {
"gitconfiglocal": "^2.0.1",
"semver": "^5.5.0",
"gitconfiglocal": "^2.0.2",
"semver": "^5.5.1",
"yargs-parser": "^10.1.0"

@@ -36,6 +36,6 @@ },

"mocha": "^5.2.0",
"prettier": "^1.13.7"
"prettier": "^1.14.2"
},
"scripts": {
"prettier": "prettier src/*.js test/*.js bin.js --single-quote --tab-width 4 --write",
"prettier": "prettier src/*.js test/*.js bin.js --single-quote --tab-width 4 --print-width 100 --write",
"test": "mocha test",

@@ -42,0 +42,0 @@ "changelog": "node example.js"

@@ -27,4 +27,4 @@ const Release = require('./Release');

let links = [];
let compareLinks = [];
const links = [];
const compareLinks = [];

@@ -60,9 +60,13 @@ const description =

t.push('');
if (links.length) {
t.push('');
links.forEach(link => t.push(link));
links.forEach(link => t.push(link));
}
t.push('');
if (compareLinks.length) {
t.push('');
compareLinks.forEach(link => t.push(link));
compareLinks.forEach(link => t.push(link));
}

@@ -69,0 +73,0 @@ t.push('');

@@ -11,5 +11,3 @@ const Changelog = require('./Changelog');

} catch (error) {
throw new Error(
`Parse error in the line ${tokens[0][0]}: ${error.message}`
);
throw new Error(`Parse error in the line ${tokens[0][0]}: ${error.message}`);
}

@@ -28,5 +26,3 @@ };

while ((release = getContent(tokens, 'h2').toLowerCase())) {
const matches = release.match(
/\[?([^\]]+)\]?\s*-\s*([\d]{4}-[\d]{1,2}-[\d]{1,2})$/
);
const matches = release.match(/\[?([^\]]+)\]?\s*-\s*([\d]{4}-[\d]{1,2}-[\d]{1,2})$/);

@@ -33,0 +29,0 @@ if (matches) {

@@ -52,5 +52,3 @@ const Semver = require('semver');

return Array.from(this.changes.values()).some(
change => change.length > 0
);
return Array.from(this.changes.values()).every(change => !change.length);
}

@@ -107,5 +105,5 @@

if (this.hasCompareLink(changelog)) {
t.push('## [UNRELEASED]');
t.push('## [Unreleased]');
} else {
t.push('## UNRELEASED');
t.push('## Unreleased');
}

@@ -147,16 +145,10 @@ }

if (!this.version) {
return `[UNRELEASED]: ${changelog.url}/compare/v${
next.version
}...HEAD`;
return `[Unreleased]: ${changelog.url}/compare/v${next.version}...HEAD`;
}
if (!this.date) {
return `[${this.version}]: ${changelog.url}/compare/v${
next.version
}...HEAD`;
return `[${this.version}]: ${changelog.url}/compare/v${next.version}...HEAD`;
}
return `[${this.version}]: ${changelog.url}/compare/v${
next.version
}...v${this.version}`;
return `[${this.version}]: ${changelog.url}/compare/v${next.version}...v${this.version}`;
}

@@ -175,5 +167,3 @@

if (!links.includes(issue)) {
links.push(
`[#${issue}]: ${changelog.url}/issues/${issue}`
);
links.push(`[#${issue}]: ${changelog.url}/issues/${issue}`);
}

@@ -200,3 +190,3 @@ });

if (!date) {
return 'UNRELEASED';
return 'Unreleased';
}

@@ -203,0 +193,0 @@

@@ -8,3 +8,3 @@ # Changelog - demo

## [UNRELEASED]
## [Unreleased]

@@ -15,3 +15,3 @@ ### Added

## [2.0.0] - UNRELEASED
## [2.0.0] - Unreleased

@@ -191,3 +191,3 @@ ### Added

[UNRELEASED]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD
[2.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v1.0.0...HEAD

@@ -194,0 +194,0 @@ [1.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0

const fs = require('fs');
const { parser } = require('../src');
const { parser, Changelog, Release } = require('../src');
const assert = require('assert');

@@ -7,2 +7,3 @@

const expected = fs.readFileSync(__dirname + '/changelog.expected.md', 'UTF-8');
const emptyExpected = fs.readFileSync(__dirname + '/empty.expected.md', 'UTF-8');

@@ -13,2 +14,6 @@ //fs.writeFileSync(__dirname + '/changelog.expected.md', changelog.toString());

describe('Changelog testing', function() {
it('should generate an empty changelog', function() {
assert.equal(new Changelog('Changelog').toString(), emptyExpected);
});
it('should match the generated changelog with the expected', function() {

@@ -18,1 +23,27 @@ assert.equal(changelog.toString().trim(), expected.trim());

});
describe('Release testing', function() {
describe('isEmpty', function() {
it('should be true for a new release with no description', function() {
assert.equal(new Release().isEmpty(), true);
assert.equal(new Release('1.2.3').isEmpty(), true);
assert.equal(new Release('1.2.3', new Date()).isEmpty(), true);
assert.equal(new Release('1.2.3', new Date(), ' ').isEmpty(), true);
});
it('should be false if a description is set', function() {
assert.equal(new Release(null, null, 'description').isEmpty(), false);
assert.equal(new Release('1.2.3', null, 'description').isEmpty(), false);
assert.equal(new Release('1.2.3', new Date(), 'description').isEmpty(), false);
});
it('should be false if changes are added', function() {
assert.equal(new Release().added('added').isEmpty(), false);
assert.equal(new Release().changed('changed').isEmpty(), false);
assert.equal(new Release().deprecated('deprecated').isEmpty(), false);
assert.equal(new Release().removed('removed').isEmpty(), false);
assert.equal(new Release().fixed('fixed').isEmpty(), false);
assert.equal(new Release().security('security').isEmpty(), false);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc