{"id":13393710,"url":"https://github.com/semantic-release/commit-analyzer","last_synced_at":"2025-05-14T03:10:57.709Z","repository":{"id":38360990,"uuid":"100321584","full_name":"semantic-release/commit-analyzer","owner":"semantic-release","description":":bulb: semantic-release plugin to analyze commits with conventional-changelog","archived":false,"fork":false,"pushed_at":"2025-05-12T01:58:50.000Z","size":3611,"stargazers_count":406,"open_issues_count":41,"forks_count":76,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-12T02:43:00.892Z","etag":null,"topics":["changelog","commit-analyzer","conventional-changelog","conventional-commits","github","publish","release","semantic-release"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/semantic-release.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-15T00:37:55.000Z","updated_at":"2025-05-12T01:58:53.000Z","dependencies_parsed_at":"2024-02-28T22:24:59.633Z","dependency_job_id":"c382726c-1615-4e36-85f2-98b7d30c3db6","html_url":"https://github.com/semantic-release/commit-analyzer","commit_stats":{"total_commits":541,"total_committers":23,"mean_commits":23.52173913043478,"dds":"0.40110905730129387","last_synced_commit":"aa832fef5a3b8b89d94c659120efbd16a0ff68ee"},"previous_names":["vanduynslagerp/sr-commit-analyzer"],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semantic-release%2Fcommit-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semantic-release%2Fcommit-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semantic-release%2Fcommit-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semantic-release%2Fcommit-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semantic-release","download_url":"https://codeload.github.com/semantic-release/commit-analyzer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253708826,"owners_count":21951058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["changelog","commit-analyzer","conventional-changelog","conventional-commits","github","publish","release","semantic-release"],"created_at":"2024-07-30T17:00:59.044Z","updated_at":"2025-05-14T03:10:52.691Z","avatar_url":"https://github.com/semantic-release.png","language":"JavaScript","readme":"# **commit-analyzer**\n\n[**semantic-release**](https://github.com/semantic-release/semantic-release) plugin to analyze commits with [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog)\n\n[![Build Status](https://github.com/semantic-release/commit-analyzer/workflows/Test/badge.svg)](https://github.com/semantic-release/commit-analyzer/actions?query=workflow%3ATest+branch%3Amaster) [![npm latest version](https://img.shields.io/npm/v/@semantic-release/commit-analyzer/latest.svg)](https://www.npmjs.com/package/@semantic-release/commit-analyzer)\n[![npm next version](https://img.shields.io/npm/v/@semantic-release/commit-analyzer/next.svg)](https://www.npmjs.com/package/@semantic-release/commit-analyzer)\n[![npm beta version](https://img.shields.io/npm/v/@semantic-release/commit-analyzer/beta.svg)](https://www.npmjs.com/package/@semantic-release/commit-analyzer)\n\n| Step             | Description                                                                                                                                         |\n| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `analyzeCommits` | Determine the type of release by analyzing commits with [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog). |\n\n## Install\n\n\u003e [!TIP]\n\u003e You do not need to directly depend on this package if you are using `semantic-release`.\n\u003e `semantic-release` already depends on this package, and defining your own direct dependency can result in conflicts when you update `semantic-release`.\n\n```bash\n$ npm install @semantic-release/commit-analyzer -D\n```\n\n## Usage\n\nThe plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration):\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@semantic-release/commit-analyzer\",\n      {\n        \"preset\": \"angular\",\n        \"releaseRules\": [\n          { \"type\": \"docs\", \"scope\": \"README\", \"release\": \"patch\" },\n          { \"type\": \"refactor\", \"release\": \"patch\" },\n          { \"type\": \"style\", \"release\": \"patch\" }\n        ],\n        \"parserOpts\": {\n          \"noteKeywords\": [\"BREAKING CHANGE\", \"BREAKING CHANGES\"]\n        }\n      }\n    ],\n    \"@semantic-release/release-notes-generator\"\n  ]\n}\n```\n\nWith this example:\n\n- the commits that contains `BREAKING CHANGE` or `BREAKING CHANGES` in their body will be considered breaking changes.\n- the commits with a 'docs' `type`, a 'README' `scope` will be associated with a `patch` release\n- the commits with a 'refactor' `type` will be associated with a `patch` release\n- the commits with a 'style' `type` will be associated with a `patch` release\n\n**Note**: Your commits must be formatted **exactly** as specified by the chosen convention. For example the [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines) require the `BREAKING CHANGE` keyword to be followed by a colon (`:`) and to be in the **footer** of the commit message.\n\n## Configuration\n\n### Options\n\n| Option         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Default                                                                                                                           |\n| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |\n| `preset`       | [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset (possible values: [`angular`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular), [`atom`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-atom), [`codemirror`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-codemirror), [`ember`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-ember), [`eslint`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-eslint), [`express`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-express), [`jquery`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-jquery), [`jshint`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-jshint), [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits)). | [`angular`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) |\n| `config`       | npm package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | -                                                                                                                                 |\n| `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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | -                                                                                                                                 |\n| `releaseRules` | An external module, a path to a module or an `Array` of rules. See [`releaseRules`](#releaserules).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | See [`releaseRules`](#releaserules)                                                                                               |\n| `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).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | -                                                                                                                                 |\n\n**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`)\n\n**Note**: `config` will be overwritten by the values of `preset`. You should use either `preset` or `config`, but not both.\n\n**Note**: Individual properties of `parserOpts` will override ones loaded with an explicitly set `preset` or `config`. If `preset` or `config` are not set, only the properties set in `parserOpts` will be used.\n\n**Note**: For presets that expects a configuration object, such as [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits), the `presetConfig` option **must** be set.\n\n#### releaseRules\n\nRelease rules are used when deciding if the commits since the last release warrant a new release. If you define custom release rules the [default rules](lib/default-release-rules.js) will be used if nothing matched. Those rules will be matched against the commit objects resulting of [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser) parsing. Each rule property can be defined as a [glob](https://github.com/micromatch/micromatch#matching-features).\n\n##### Rules definition\n\nThis is an `Array` of rule objects. A rule object has a `release` property and 1 or more criteria.\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@semantic-release/commit-analyzer\",\n      {\n        \"preset\": \"angular\",\n        \"releaseRules\": [\n          { \"type\": \"docs\", \"scope\": \"README\", \"release\": \"patch\" },\n          { \"type\": \"refactor\", \"scope\": \"core-*\", \"release\": \"minor\" },\n          { \"type\": \"refactor\", \"release\": \"patch\" },\n          { \"scope\": \"no-release\", \"release\": false }\n        ]\n      }\n    ],\n    \"@semantic-release/release-notes-generator\"\n  ]\n}\n```\n\n##### Rules matching\n\nEach commit will be compared with each rule and when it matches, the commit will be associated with the release type in the rule's `release` property. If a commit match multiple rules, the highest release type (`major` \u003e `minor` \u003e `patch`) is associated with the commit.\n\nSee [release types](lib/default-release-types.js) for the release types hierarchy.\n\nWith the previous example:\n\n- Commits with `type` 'docs' and `scope` 'README' will be associated with a `patch` release.\n- Commits with `type` 'refactor' and `scope` starting with 'core-' (i.e. 'core-ui', 'core-rules', ...) will be associated with a `minor` release.\n- Other commits with `type` 'refactor' (without `scope` or with a `scope` not matching the glob `core-*`) will be associated with a `patch` release.\n- Commits with scope `no-release` will not be associated with a release type.\n\n##### Default rules matching\n\nIf a commit doesn't match any rule in `releaseRules` it will be evaluated against the [default release rules](lib/default-release-rules.js).\n\nWith the previous example:\n\n- Commits with a breaking change will be associated with a `major` release.\n- Commits with `type` 'feat' will be associated with a `minor` release.\n- Commits with `type` 'fix' will be associated with a `patch` release.\n- Commits with `type` 'perf' will be associated with a `patch` release.\n- Commits with scope `no-release` will not be associated with a release type even if they have a breaking change or the `type` 'feat', 'fix' or 'perf'.\n\n##### No rules matching\n\nIf a commit doesn't match any rules in `releaseRules` or in [default release rules](lib/default-release-rules.js) then no release type will be associated with the commit.\n\nWith the previous example:\n\n- Commits with `type` 'style' will not be associated with a release type.\n- Commits with `type` 'test' will not be associated with a release type.\n- Commits with `type` 'chore' will not be associated with a release type.\n\n##### Multiple commits\n\nIf there is multiple commits that match one or more rules, the one with the highest release type will determine the global release type.\n\nConsidering the following commits:\n\n- `docs(README): Add more details to the API docs`\n- `feat(API): Add a new method to the public API`\n\nWith the previous example the release type determined by the plugin will be `minor`.\n\n##### Specific commit properties\n\nThe properties to set in the rules will depends on the commit style chosen. For example [conventional-changelog-angular](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular) use the commit properties `type`, `scope` and `subject` but [conventional-changelog-eslint](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-eslint) uses `tag` and `message`.\n\nFor example with `eslint` preset:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@semantic-release/commit-analyzer\",\n      {\n        \"preset\": \"eslint\",\n        \"releaseRules\": [\n          { \"tag\": \"Docs\", \"message\": \"*README*\", \"release\": \"patch\" },\n          { \"tag\": \"New\", \"release\": \"patch\" }\n        ]\n      }\n    ],\n    \"@semantic-release/release-notes-generator\"\n  ]\n}\n```\n\nWith this configuration:\n\n- Commits with `tag` 'Docs', that contains 'README' in their header message will be associated with a `patch` release.\n- Commits with `tag` 'New' will be associated with a `patch` release.\n- Commits with `tag` 'Breaking' will be associated with a `major` release (per [default release rules](lib/default-release-rules.js)).\n- Commits with `tag` 'Fix' will be associated with a `patch` release (per [default release rules](lib/default-release-rules.js)).\n- Commits with `tag` 'Update' will be associated with a `minor` release (per [default release rules](lib/default-release-rules.js)).\n- All other commits will not be associated with a release type.\n\n##### External package / file\n\n`releaseRules` can also reference a module, either by it's `npm` name or path:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"@semantic-release/commit-analyzer\",\n      {\n        \"preset\": \"angular\",\n        \"releaseRules\": \"./config/release-rules.cjs\"\n      }\n    ],\n    \"@semantic-release/release-notes-generator\"\n  ]\n}\n```\n\n```js\n// File: config/release-rules.cjs\nmodule.exports = [\n  { type: \"docs\", scope: \"README\", release: \"patch\" },\n  { type: \"refactor\", scope: \"core-*\", release: \"minor\" },\n  { type: \"refactor\", release: \"patch\" },\n];\n```\n","funding_links":[],"categories":["About","JavaScript","github"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemantic-release%2Fcommit-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemantic-release%2Fcommit-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemantic-release%2Fcommit-analyzer/lists"}