auto-changelog
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -7,4 +7,20 @@ ### Changelog | ||
#### [v2.5.0](https://github.com/cookpete/auto-changelog/compare/v2.4.0...v2.5.0) | ||
- Fix: Throws error if tag does not contains "version" property [`#272`](https://github.com/cookpete/auto-changelog/pull/272) | ||
- Add support for GitLab's new style routes [`#267`](https://github.com/cookpete/auto-changelog/pull/267) | ||
- fix: gitlab subgroups [`#232`](https://github.com/cookpete/auto-changelog/pull/232) | ||
- Add Template for handling commits with Conventional Commits format [`#217`](https://github.com/cookpete/auto-changelog/pull/217) | ||
- upgrade parse-github-url v1.0.3 [`#289`](https://github.com/cookpete/auto-changelog/pull/289) | ||
- tests: fix parseReleases [`#265`](https://github.com/cookpete/auto-changelog/pull/265) | ||
- feat: combine multiple commit-lists to one if heading is undefined [`#236`](https://github.com/cookpete/auto-changelog/pull/236) | ||
- Add a Plugin system [`#237`](https://github.com/cookpete/auto-changelog/pull/237) | ||
- add support for including commit pattern [`#258`](https://github.com/cookpete/auto-changelog/pull/258) | ||
- Revert GitLab's new style routes [`b087f51`](https://github.com/cookpete/auto-changelog/commit/b087f51151955f6f62ed1fcee9d3e144c9ed931a) | ||
- Remove email from package.json [`0991f17`](https://github.com/cookpete/auto-changelog/commit/0991f17ce936a9db490e2ad1a04121755038b78d) | ||
#### [v2.4.0](https://github.com/cookpete/auto-changelog/compare/v2.3.0...v2.4.0) | ||
> 3 February 2022 | ||
- Logical handling of --starting-version [`#227`](https://github.com/cookpete/auto-changelog/pull/227) | ||
@@ -11,0 +27,0 @@ - Trim commit subject [`#225`](https://github.com/cookpete/auto-changelog/pull/225) |
{ | ||
"name": "auto-changelog", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Command line tool for generating a changelog from git tags and commit history", | ||
@@ -23,3 +23,3 @@ "main": "./src/index.js", | ||
}, | ||
"author": "Pete Cook <pete@cookpete.com> (https://github.com/cookpete)", | ||
"author": "Pete Cook (https://github.com/cookpete)", | ||
"homepage": "https://github.com/CookPete/auto-changelog", | ||
@@ -49,4 +49,5 @@ "repository": { | ||
"handlebars": "^4.7.7", | ||
"import-cwd": "^3.0.0", | ||
"node-fetch": "^2.6.1", | ||
"parse-github-url": "^1.0.2", | ||
"parse-github-url": "^1.0.3", | ||
"semver": "^7.3.5" | ||
@@ -53,0 +54,0 @@ }, |
@@ -40,2 +40,3 @@ # auto-changelog | ||
--merge-pattern [regex] # add custom regex pattern for merge commits | ||
--commit-pattern [regex] # pattern to include when parsing commits | ||
--ignore-commit-pattern [regex] # pattern to ignore when parsing commits | ||
@@ -57,2 +58,3 @@ --tag-pattern [regex] # override regex pattern for version tags | ||
--stdout # output changelog to stdout | ||
--plugins [...name] # use plugins to augment commit/merge/release information | ||
-V, --version # output the version number | ||
@@ -241,3 +243,3 @@ -h, --help # output usage information | ||
{{#each commits}} | ||
- Commits have a {{shorthash}}, a {{subject}} and a {{href}}, amongst other things. | ||
- Commits have a {{shorthash}}, a {{subject}} and a {{href}}, {{author}} amongst other things. | ||
{{/each}} | ||
@@ -244,0 +246,0 @@ {{/each}} |
@@ -138,6 +138,9 @@ const semver = require('semver') | ||
const filterCommit = (commit, { ignoreCommitPattern }) => { | ||
const filterCommit = (commit, { ignoreCommitPattern, commitPattern }) => { | ||
if (ignoreCommitPattern && new RegExp(ignoreCommitPattern).test(commit.subject)) { | ||
return false | ||
} | ||
if (commitPattern) { | ||
return new RegExp(commitPattern).test(commit.subject) | ||
} | ||
return true | ||
@@ -144,0 +147,0 @@ } |
@@ -12,2 +12,9 @@ const semver = require('semver') | ||
const fixes = commits.filter(commit => commit.fixes).map(commit => ({ fixes: commit.fixes, commit })) | ||
for (const plugin of options.plugins || []) { | ||
if (plugin.processCommits) await plugin.processCommits(commits) | ||
if (plugin.processMerges) await plugin.processMerges(merges) | ||
if (plugin.processFixes) await plugin.processFixes(merges) | ||
} | ||
const emptyRelease = merges.length === 0 && fixes.length === 0 | ||
@@ -31,2 +38,7 @@ const { message } = commits[0] || { message: null } | ||
})) | ||
for (const plugin of options.plugins || []) { | ||
if (plugin.processReleases) await plugin.processReleases(releases) | ||
} | ||
return releases.filter(filterReleases(options)) | ||
@@ -33,0 +45,0 @@ } |
@@ -30,3 +30,2 @@ const parseRepoURL = require('parse-github-url') | ||
const IS_GITLAB = /gitlab/.test(hostname) | ||
const IS_GITLAB_SUBGROUP = /\.git$/.test(remote.branch) | ||
const IS_AZURE = /dev\.azure/.test(hostname) | ||
@@ -47,5 +46,3 @@ const IS_VISUAL_STUDIO = /visualstudio/.test(hostname) | ||
if (IS_GITLAB) { | ||
const url = IS_GITLAB_SUBGROUP | ||
? `${protocol}//${hostname}/${remote.repo}/${remote.branch.replace(/\.git$/, '')}` | ||
: `${protocol}//${hostname}/${remote.repo}` | ||
const url = `${protocol}//${hostname}/${remote.pathname.replace(/git@.*:/, '').replace(/\.git$/, '')}` | ||
return { | ||
@@ -52,0 +49,0 @@ getCommitLink: id => `${url}/commit/${id}`, |
const { Command } = require('commander') | ||
const importCwd = require('import-cwd') | ||
const { version } = require('../package.json') | ||
@@ -19,3 +20,4 @@ const { fetchRemote } = require('./remote') | ||
appendGitTag: '', | ||
config: '.auto-changelog' | ||
config: '.auto-changelog', | ||
plugins: [] | ||
} | ||
@@ -45,2 +47,3 @@ | ||
.option('--merge-pattern <regex>', 'add custom regex pattern for merge commits') | ||
.option('--commit-pattern <regex>', 'pattern to include when parsing commits') | ||
.option('--ignore-commit-pattern <regex>', 'pattern to ignore when parsing commits') | ||
@@ -62,2 +65,3 @@ .option('--tag-pattern <regex>', 'override regex pattern for version tags') | ||
.option('--stdout', 'output changelog to stdout') | ||
.option('--plugins [name...]', 'use plugins to augment commit/merge/release information') | ||
.version(version) | ||
@@ -81,3 +85,4 @@ .parse(argv) | ||
...remote, | ||
latestVersion | ||
latestVersion, | ||
plugins: options.plugins.map(p => importCwd(`auto-changelog-${p}`)) | ||
} | ||
@@ -84,0 +89,0 @@ } |
@@ -57,3 +57,3 @@ const semver = require('semver') | ||
// Fall back to nearest version lower than startingVersion | ||
return tags.findIndex(({ version }) => semver.lt(version, semverStartingVersion)) | ||
return tags.findIndex(({ version }) => version && semver.lt(version, semverStartingVersion)) | ||
} | ||
@@ -60,0 +60,0 @@ if (startingDate) { |
@@ -21,7 +21,9 @@ const { join } = require('path') | ||
const { exclude, message, subject, heading } = options.hash | ||
const list = context | ||
.filter(item => { | ||
const commit = item.commit || item | ||
if (options.hash.exclude) { | ||
const pattern = new RegExp(options.hash.exclude, 'm') | ||
if (exclude) { | ||
const pattern = new RegExp(exclude, 'm') | ||
if (pattern.test(commit.message)) { | ||
@@ -31,8 +33,8 @@ return false | ||
} | ||
if (options.hash.message) { | ||
const pattern = new RegExp(options.hash.message, 'm') | ||
if (message) { | ||
const pattern = new RegExp(message, 'm') | ||
return pattern.test(commit.message) | ||
} | ||
if (options.hash.subject) { | ||
const pattern = new RegExp(options.hash.subject) | ||
if (subject) { | ||
const pattern = new RegExp(subject) | ||
return pattern.test(commit.subject) | ||
@@ -49,3 +51,7 @@ } | ||
return `${options.hash.heading}\n\n${list}` | ||
if (!heading) { | ||
return list | ||
} | ||
return `${heading}\n\n${list}` | ||
}) | ||
@@ -52,0 +58,0 @@ |
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
85272
17
754
339
6
+ Addedimport-cwd@^3.0.0
+ Addedimport-cwd@3.0.0(transitive)
+ Addedimport-from@3.0.0(transitive)
+ Addedresolve-from@5.0.0(transitive)
Updatedparse-github-url@^1.0.3