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.3.1 to 0.4.0

yarn.lock

11

CHANGELOG.md

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

## [0.4.0] - 2018-03-22
### Added
- Create links automatically to the issues
### Fixed
- Use UTC date functions to fix decrement issue - [#1](https://github.com/oscarotero/keep-a-changelog/issues/1)
## [0.3.1] - 2017-12-11

@@ -47,4 +57,5 @@

[0.4.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.3.1...v0.4.0
[0.3.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.1.0...v0.2.0

10

package.json

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

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

@@ -30,8 +30,8 @@ "bin": {

"gitconfiglocal": "^2.0.1",
"semver": "^5.4.1",
"yargs-parser": "^8.0.0"
"semver": "^5.5.0",
"yargs-parser": "^9.0.2"
},
"devDependencies": {
"mocha": "^4.0.1",
"prettier": "^1.9.1"
"mocha": "^5.0.4",
"prettier": "^1.11.1"
},

@@ -38,0 +38,0 @@ "scripts": {

@@ -0,1 +1,3 @@

const _release = Symbol.for('release');
class Change {

@@ -7,3 +9,16 @@ constructor(title, description = '') {

set release(release) {
this[_release] = release;
}
get release() {
return this[_release];
}
toString() {
const url =
this.release && this.release.changelog
? this.release.changelog.url
: null;
let t = [`- ${this.title}`];

@@ -15,3 +30,3 @@

return t.join('\n').trim();
return t.map(line => linkify(line, url)).join('\n').trim();
}

@@ -21,1 +36,9 @@ }

module.exports = Change;
function linkify(text, url) {
if (url) {
return text.replace(/#(\d+)([^\w\]]|$)/g, `[#$1](${url}/issues/$1)$2`);
}
return text;
}

@@ -13,5 +13,4 @@ const Changelog = require('./Changelog');

throw new Error(
`Parse error in the line ${totalLines - lines.length}: ${
error.message
}`
`Parse error in the line ${totalLines -
lines.length}: ${error.message}`
);

@@ -26,6 +25,3 @@ }

if (lines.length && lines[0].startsWith('# ')) {
changelog.title = lines
.shift()
.substr(1)
.trim();
changelog.title = lines.shift().substr(1).trim();
}

@@ -39,6 +35,3 @@

let release;
const line = lines
.shift()
.substr(2)
.trim();
const line = lines.shift().substr(2).trim();
const matches = line.match(

@@ -62,7 +55,3 @@ /\[?([^\]]+)\]?\s*-\s*([\d]{4}-[\d]{1,2}-[\d]{1,2})$/

while (moveWhile(lines, '### ')) {
const type = lines
.shift()
.substr(3)
.trim()
.toLowerCase();
const type = lines.shift().substr(3).trim().toLowerCase();

@@ -73,6 +62,3 @@ while (moveWhile(lines, '-', '*')) {

new Change(
lines
.shift()
.substr(1)
.trim(),
lines.shift().substr(1).trim(),
getUntil(lines, '-', '*', '#', '[').replace(

@@ -79,0 +65,0 @@ /\n\s\s/g,

@@ -32,2 +32,6 @@ const Semver = require('semver');

get changelog() {
return this[_changelog];
}
compare(release) {

@@ -65,2 +69,3 @@ if (!this.version) {

this.changes[type].push(change);
change.release = this;

@@ -95,3 +100,3 @@ return this;

toString() {
const url = this[_changelog] ? this[_changelog].url : null;
const url = this.changelog ? this.changelog.url : null;
let t = [];

@@ -140,5 +145,4 @@

if (changelog.unreleased === this) {
return `[UNRELEASED]: ${changelog.url}/compare/v${
changelog.releases[0].version
}...HEAD`;
return `[UNRELEASED]: ${changelog.url}/compare/v${changelog
.releases[0].version}...HEAD`;
}

@@ -149,5 +153,5 @@

return `[${this.version}]: ${changelog.url}/compare/v${
next.version
}...v${this.version}`;
return `[${this
.version}]: ${changelog.url}/compare/v${next.version}...v${this
.version}`;
}

@@ -179,5 +183,5 @@

function formatDate(date) {
let year = date.getFullYear(),
month = date.getMonth() + 1,
day = date.getDate();
let year = date.getUTCFullYear(),
month = date.getUTCMonth() + 1,
day = date.getUTCDate();

@@ -184,0 +188,0 @@ if (month < 10) {

@@ -13,2 +13,6 @@ # Changelog - demo

- None
- Test with issue link [#1](https://github.com/olivierlacan/keep-a-changelog/issues/1)
- Test with issue link [#2](https://github.com/olivierlacan/keep-a-changelog/issues/2) in the middle of the text
- [#3](https://github.com/olivierlacan/keep-a-changelog/issues/3) Test with issue link in the beginning of the text
- Test with no issue link #123b

@@ -15,0 +19,0 @@ ## [1.0.0] - 2017-06-20

@@ -11,2 +11,6 @@ # Changelog - demo

- None
- Test with issue link #1
- Test with issue link #2 in the middle of the text
- [#3](https://github.com/olivierlacan/keep-a-changelog/issues/3) Test with issue link in the beginning of the text
- Test with no issue link #123b

@@ -13,0 +17,0 @@ ## [1.0.0] - 2017-06-20

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