keep-a-changelog
Advanced tools
Comparing version 0.10.0 to 0.10.1
24
bin.js
@@ -11,5 +11,5 @@ #!/usr/bin/env node | ||
url: null, | ||
https: true | ||
https: true, | ||
}, | ||
boolean: ['https', 'init'] | ||
boolean: ['https', 'init', 'latest-release', 'release'], | ||
}); | ||
@@ -31,2 +31,22 @@ | ||
if (argv.latestRelease) { | ||
const release = changelog.releases.find((release) => release.date && release.version); | ||
if (release) { | ||
console.log(release.version.toString()); | ||
} | ||
process.exit(0); | ||
} | ||
if (argv.release) { | ||
const release = changelog.releases.find((release) => { | ||
return !release.date && release.version; | ||
}); | ||
if (release) { | ||
release.date = new Date(); | ||
} | ||
} | ||
if (!changelog.url && !argv.url) { | ||
@@ -33,0 +53,0 @@ const gitconfig = require('gitconfiglocal'); |
@@ -5,5 +5,14 @@ # Changelog | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/). | ||
## [0.10.1] - 2020-05-04 | ||
### Added | ||
- New command --latest-release added to cli | ||
- New command --release added to cli | ||
### Fixed | ||
- Removed trailing space in the default description generated with --init | ||
- Updated dependencies | ||
## [0.10.0] - 2020-02-08 | ||
@@ -152,2 +161,3 @@ ### Added | ||
[0.10.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.10.0...v0.10.1 | ||
[0.10.0]: https://github.com/oscarotero/keep-a-changelog/compare/v0.9.1...v0.10.0 | ||
@@ -154,0 +164,0 @@ [0.9.1]: https://github.com/oscarotero/keep-a-changelog/compare/v0.9.0...v0.9.1 |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/oscarotero/keep-a-changelog#readme", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"main": "src/index.js", | ||
@@ -30,8 +30,8 @@ "bin": { | ||
"gitconfiglocal": "^2.1.0", | ||
"semver": "^7.1.2", | ||
"yargs-parser": "^16.1.0" | ||
"semver": "^7.3.2", | ||
"yargs-parser": "^18.1.3" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^7.0.1", | ||
"prettier": "^1.19.1" | ||
"mocha": "^7.1.2", | ||
"prettier": "^2.0.5" | ||
}, | ||
@@ -38,0 +38,0 @@ "scripts": { |
@@ -114,2 +114,15 @@ # keep-a-changelog | ||
You can release automatically the latest "Unreleased" version: | ||
```sh | ||
changelog --release | ||
``` | ||
And return the latest released version: | ||
```sh | ||
changelog --latest-release | ||
> 0.3.1 | ||
``` | ||
Available options: | ||
@@ -123,1 +136,3 @@ | ||
`--init` | Init a new empty changelog file. | ||
`--latest-release` | Print the latest release version. | ||
`--release` | Updated the latest unreleased version with the current date. |
@@ -9,3 +9,3 @@ class Change { | ||
toString() { | ||
let t = this.title.split('\n').map(line => ` ${line}`); | ||
let t = this.title.split('\n').map((line) => ` ${line}`); | ||
t[0] = '-' + t[0].substr(1); | ||
@@ -16,3 +16,3 @@ | ||
t = t.concat(this.description.split('\n').map(line => ` ${line}`)); | ||
t = t.concat(this.description.split('\n').map((line) => ` ${line}`)); | ||
} | ||
@@ -26,3 +26,3 @@ | ||
Change.extractIssues = function(text, issues) { | ||
Change.extractIssues = function (text, issues) { | ||
return text | ||
@@ -29,0 +29,0 @@ .replace(/(^|[^\\])\[#(\d+)\](?=[^\(]|$)/g, (matches, start, index) => { |
@@ -29,5 +29,5 @@ const Release = require('./Release'); | ||
if (!version) { | ||
return this.releases.find(release => !release.version); | ||
return this.releases.find((release) => !release.version); | ||
} | ||
return this.releases.find(release => release.version && eq(release.version, version)); | ||
return this.releases.find((release) => release.version && eq(release.version, version)); | ||
} | ||
@@ -57,3 +57,3 @@ | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/).`; | ||
@@ -66,7 +66,7 @@ | ||
this.releases.forEach(release => { | ||
this.releases.forEach((release) => { | ||
t.push(''); | ||
t.push(release.toString(this)); | ||
release.getLinks(this).forEach(link => { | ||
release.getLinks(this).forEach((link) => { | ||
if (!links.includes(link)) { | ||
@@ -87,3 +87,3 @@ links.push(link); | ||
links.sort(compare); | ||
links.forEach(link => t.push(link)); | ||
links.forEach((link) => t.push(link)); | ||
} | ||
@@ -94,3 +94,3 @@ | ||
compareLinks.forEach(link => t.push(link)); | ||
compareLinks.forEach((link) => t.push(link)); | ||
} | ||
@@ -97,0 +97,0 @@ |
@@ -5,3 +5,3 @@ module.exports = { | ||
Changelog: require('./Changelog'), | ||
Release: require('./Release') | ||
Release: require('./Release'), | ||
}; |
@@ -5,3 +5,3 @@ const Changelog = require('./Changelog'); | ||
const defaultOptions = { | ||
releaseCreator: (version, date, description) => new Release(version, date, description) | ||
releaseCreator: (version, date, description) => new Release(version, date, description), | ||
}; | ||
@@ -100,3 +100,3 @@ | ||
.split('\n') | ||
.map(line => { | ||
.map((line) => { | ||
if (line.startsWith('---')) { | ||
@@ -153,4 +153,4 @@ return ['hr', ['-']]; | ||
return tokens | ||
.filter(token => !isEmpty(token[2])) | ||
.map(token => { | ||
.filter((token) => !isEmpty(token[2])) | ||
.map((token) => { | ||
const content = token[2]; | ||
@@ -157,0 +157,0 @@ |
@@ -16,3 +16,3 @@ const Semver = require('semver/classes/semver'); | ||
['fixed', []], | ||
['security', []] | ||
['security', []], | ||
]); | ||
@@ -46,3 +46,3 @@ } | ||
return Array.from(this.changes.values()).every(change => !change.length); | ||
return Array.from(this.changes.values()).every((change) => !change.length); | ||
} | ||
@@ -131,3 +131,3 @@ | ||
t.push(`### ${type[0].toUpperCase()}${type.substring(1)}`); | ||
t = t.concat(changes.map(change => change.toString())); | ||
t = t.concat(changes.map((change) => change.toString())); | ||
t.push(''); | ||
@@ -179,5 +179,5 @@ } | ||
this.changes.forEach(changes => | ||
changes.forEach(change => { | ||
change.issues.forEach(issue => { | ||
this.changes.forEach((changes) => | ||
changes.forEach((change) => { | ||
change.issues.forEach((issue) => { | ||
if (!links.includes(issue)) { | ||
@@ -184,0 +184,0 @@ links.push(`[#${issue}]: ${changelog.url}/issues/${issue}`); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29068
526
137
+ Addedyargs-parser@18.1.3(transitive)
- Removedyargs-parser@16.1.0(transitive)
Updatedsemver@^7.3.2
Updatedyargs-parser@^18.1.3