From cec1034e9d3ead68624b5e1fbf2b74454af030de Mon Sep 17 00:00:00 2001 From: Gert-Jan2AT <150832848+Gert-Jan2AT@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:07:16 +0100 Subject: [PATCH 1/5] feat: Added possibility to use regex to remove text from the commit message --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3a2dba9f..8ef3196b 100644 --- a/.gitignore +++ b/.gitignore @@ -125,4 +125,5 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk -# End of https://www.gitignore.io/api/macos,windows,linux,node \ No newline at end of file +# End of https://www.gitignore.io/api/macos,windows,linux,node +/.vs From 272e267808759e4f15e178ba87ab4ca48edaa9aa Mon Sep 17 00:00:00 2001 From: Gert-Jan2AT <150832848+Gert-Jan2AT@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:07:21 +0100 Subject: [PATCH 2/5] feat: Added possibility to use regex to remove text from the commit message --- README.md | 1 + index.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d9c850b3..30f56366 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ With this example: | `parserOpts` | Additional [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#conventionalcommitsparseroptions) options that will extends the ones loaded by `preset` or `config`. This is convenient to use a [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset with some customizations without having to create a new module. | - | | `releaseRules` | An external module, a path to a module or an `Array` of rules. See [`releaseRules`](#releaserules). | See [`releaseRules`](#releaserules) | | `presetConfig` | Additional configuration passed to the [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. Used for example with [conventional-changelog-conventionalcommits](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/master/versions/2.0.0/README.md). | - | +| `regexRemove` | Optional regular that will be used to clean up de message in the commit. For example to remove the Merged PR xxxx: part from a devops commit | - | **Notes**: in order to use a `preset` it must be installed (for example to use the [eslint preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-eslint) you must install it with `npm install conventional-changelog-eslint -D`) diff --git a/index.js b/index.js index 98e36b22..7716e3b5 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,7 @@ const debug = debugFactory("semantic-release:commit-analyzer"); * @param {String} pluginConfig.config Requireable npm package with a custom conventional-changelog preset * @param {String|Array} pluginConfig.releaseRules A `String` to load an external module or an `Array` of rules. * @param {Object} pluginConfig.parserOpts Additional `conventional-changelog-parser` options that will overwrite ones loaded by `preset` or `config`. + * @param {Object} pluginConfig.regexRemove Optional regular that will be used to clean up de message in the commit. For example to remove the Merged PR xxxx: part from a devops commit * @param {Object} context The semantic-release context. * @param {Array} context.commits The commits to analyze. * @param {String} context.cwd The current working directory. @@ -41,7 +42,7 @@ export async function analyzeCommits(pluginConfig, context) { return true; }) - .map(({ message, ...commitProps }) => ({ rawMsg: message, message, ...commitProps, ...parser(message, config) })) + .map(({ message, ...commitProps }) => ({ rawMsg: message, message, ...commitProps, ...parser(pluginConfig.regexRemove ? message.replace(new RegExp(pluginConfig.regexRemove), "") : message, config) })) ).every(({ rawMsg, ...commit }) => { logger.log(`Analyzing commit: %s`, rawMsg); let commitReleaseType; From 2ef9d75326521825f7cecf379ca27b98a2dc3ea6 Mon Sep 17 00:00:00 2001 From: Gert-Jan2AT <150832848+Gert-Jan2AT@users.noreply.github.com> Date: Mon, 18 Mar 2024 10:13:12 +0100 Subject: [PATCH 3/5] Modified package.json --- package.json | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index cecc7fcf..a7b56913 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,16 @@ { - "name": "@semantic-release/commit-analyzer", - "description": "semantic-release plugin to analyze commits with conventional-changelog", - "version": "0.0.0-development", - "type": "module", - "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)", + "name": "@tweeat/release-notes-generator", + "description": "tweeat plugin to generate changelog content with conventional-changelog", + "version": "1.0.0", + "author": "Gert-Jan Naaktgeboren", "ava": { "files": [ "test/**/*.test.js" ] }, "bugs": { - "url": "https://github.com/semantic-release/commit-analyzer/issues" + "url": "https://github.com/Gert-Jan2AT/commit-analyzer/issues" }, - "contributors": [ - "Stephan Bönnemann (http://boennemann.me)", - "Gregor Martynus (https://twitter.com/gr2m)" - ], "dependencies": { "conventional-changelog-angular": "^7.0.0", "conventional-commits-filter": "^4.0.0", @@ -83,7 +78,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/semantic-release/commit-analyzer.git" + "url": "https://github.com/Gert-Jan2AT/commit-analyzer.git" }, "scripts": { "lint": "prettier --check \"*.{js,json,md}\" \".github/**/*.{md,yml}\" \"{bin,lib,test}/*.js\"", From 525d0a405dbdc5ddcdda6c222d8996c91a1f047e Mon Sep 17 00:00:00 2001 From: Gert-Jan2AT <150832848+Gert-Jan2AT@users.noreply.github.com> Date: Mon, 18 Mar 2024 11:08:09 +0100 Subject: [PATCH 4/5] Modified package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a7b56913..8f811565 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@tweeat/release-notes-generator", + "name": "@tweeat/commit-analyzer", "description": "tweeat plugin to generate changelog content with conventional-changelog", "version": "1.0.0", "author": "Gert-Jan Naaktgeboren", From b3faaa40f20b5c7b4bf880fb218b156796a950b8 Mon Sep 17 00:00:00 2001 From: Gert-Jan2AT <150832848+Gert-Jan2AT@users.noreply.github.com> Date: Mon, 18 Mar 2024 13:36:31 +0100 Subject: [PATCH 5/5] added type module --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 8f811565..2525ae8a 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@tweeat/commit-analyzer", "description": "tweeat plugin to generate changelog content with conventional-changelog", "version": "1.0.0", + "type": "module", "author": "Gert-Jan Naaktgeboren", "ava": { "files": [