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 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; diff --git a/package.json b/package.json index cecc7fcf..ab715375 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,17 @@ { - "name": "@semantic-release/commit-analyzer", + "name": "@tweeat/commit-analyzer", "description": "semantic-release plugin to analyze commits with conventional-changelog", - "version": "0.0.0-development", + "version": "1.0.0", "type": "module", - "author": "Pierre Vanduynslager (https://twitter.com/@pvdlg_)", + "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" }, - "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", @@ -45,7 +41,7 @@ "lib", "index.js" ], - "homepage": "https://github.com/semantic-release/commit-analyzer#readme", + "homepage": "https://github.com/Gert-Jan2AT/commit-analyzer#readme", "keywords": [ "changelog", "commit-analyzer", @@ -83,7 +79,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/semantic-release/commit-analyzer.git" + "url": "git+https://github.com/Gert-Jan2AT/commit-analyzer.git" }, "scripts": { "lint": "prettier --check \"*.{js,json,md}\" \".github/**/*.{md,yml}\" \"{bin,lib,test}/*.js\"", @@ -92,10 +88,5 @@ "semantic-release": "semantic-release", "test": "c8 ava -v", "test:ci": "c8 ava -v" - }, - "renovate": { - "extends": [ - "github>semantic-release/.github:renovate-config" - ] } }