From f088a5d62807333a3e042c4de65fb91a9e513105 Mon Sep 17 00:00:00 2001 From: babblebey Date: Fri, 11 Sep 2026 19:57:23 +0100 Subject: [PATCH 1/6] feat(preset): drop support for `ember`, `eslint`, `jshint`, `express` and `atom` presets --- package-lock.json | 61 ----------------------------------------------- package.json | 6 ----- 2 files changed, 67 deletions(-) diff --git a/package-lock.json b/package-lock.json index 227160c0..3bc469e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,12 +21,6 @@ "ava": "6.4.1", "c8": "11.0.0", "conventional-changelog-angular": "9.3.0", - "conventional-changelog-atom": "5.1.0", - "conventional-changelog-conventionalcommits": "10.4.0", - "conventional-changelog-ember": "5.1.0", - "conventional-changelog-eslint": "6.1.0", - "conventional-changelog-express": "5.1.0", - "conventional-changelog-jshint": "5.2.0", "lockfile-lint": "5.0.1", "ls-engines": "0.9.4", "npm-run-all2": "9.0.3", @@ -131,7 +125,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/@conventional-changelog/template/-/template-1.4.0.tgz", "integrity": "sha512-aalGyl7dbB5PArRebDIX43ZvBlXrYm9uWzGJ26t+4SzJVPsOuvfILGGbw5X4yX7i50YEmJ8zvbiWnqH/AAnZqg==", - "dev": true, "license": "MIT", "engines": { "node": ">=22" @@ -3008,21 +3001,10 @@ "node": ">=22" } }, - "node_modules/conventional-changelog-atom": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-5.1.0.tgz", - "integrity": "sha512-fw7GpI9jHNCWGBnTsPRI452ypQbNupGwsjrXfozvRNE0c92pJRpoj9rXfzDKUYJcsmk0H4XKaQjhjelwI9z27w==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=18" - } - }, "node_modules/conventional-changelog-conventionalcommits": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-10.4.0.tgz", "integrity": "sha512-Rriac6ZrAlVm6cy9Bz4NSp+WMHpwNXoPIYex+HjCgduAVUSbnew29DQjQw0C4g9u3HtSYzGiGY+pdBXAZo+4aA==", - "dev": true, "license": "ISC", "dependencies": { "@conventional-changelog/template": "^1.4.0" @@ -3031,49 +3013,6 @@ "node": ">=22" } }, - "node_modules/conventional-changelog-ember": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-5.1.0.tgz", - "integrity": "sha512-XNcgGcdJt7wh341BBML0CI8DKpqE5lKD1WahzFHGZFvKTzJr1rZW976cw7beqKLOBbzdrH9ZIkE/s2TfbOuM3g==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=18" - } - }, - "node_modules/conventional-changelog-eslint": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-6.1.0.tgz", - "integrity": "sha512-beWr3qzuEMN9gznMWa8PhTVfGkGXoq+XnUzViNXg5KygrgV728ZRqZngz3uPhz5+ayUhPrpNFYqIE0qHWz9NAw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=18" - } - }, - "node_modules/conventional-changelog-express": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-5.1.0.tgz", - "integrity": "sha512-g/s9eLohrefYTSNQaB6+k0ONbiVx41YOKBbIOIM3ST/NtedAgppCJnrpKXVN9sOmpPkN4vjFwURlfvpEDUjoeg==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=18" - } - }, - "node_modules/conventional-changelog-jshint": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-5.2.0.tgz", - "integrity": "sha512-OaatyvHXP1fjI7Mx0b1IkmhbhTsVHsytnsQSkOj4rhGbFMoTcfvbwm/vAtCzRMXOxojK1EDMBBmBj1pM9KNy/Q==", - "dev": true, - "license": "ISC", - "dependencies": { - "compare-func": "^2.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/conventional-changelog-writer": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-8.1.0.tgz", diff --git a/package.json b/package.json index c2801c9a..ab5d1579 100644 --- a/package.json +++ b/package.json @@ -31,12 +31,6 @@ "ava": "6.4.1", "c8": "11.0.0", "conventional-changelog-angular": "9.3.0", - "conventional-changelog-atom": "5.1.0", - "conventional-changelog-conventionalcommits": "10.4.0", - "conventional-changelog-ember": "5.1.0", - "conventional-changelog-eslint": "6.1.0", - "conventional-changelog-express": "5.1.0", - "conventional-changelog-jshint": "5.2.0", "lockfile-lint": "5.0.1", "ls-engines": "0.9.4", "npm-run-all2": "9.0.3", From 07447849f509e39a6dbf26e3e81270ef196f39e4 Mon Sep 17 00:00:00 2001 From: babblebey Date: Fri, 11 Sep 2026 20:24:12 +0100 Subject: [PATCH 2/6] feat(preset): pack `conventional-changelog-angular` as production deps --- package-lock.json | 3 +-- package.json | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3bc469e2..aa35b6bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0-development", "license": "MIT", "dependencies": { + "conventional-changelog-angular": "^9.0.0", "conventional-changelog-conventionalcommits": "^10.0.0", "conventional-commits-filter": "^6.0.0", "conventional-commits-parser": "^7.0.0", @@ -20,7 +21,6 @@ "devDependencies": { "ava": "6.4.1", "c8": "11.0.0", - "conventional-changelog-angular": "9.3.0", "lockfile-lint": "5.0.1", "ls-engines": "0.9.4", "npm-run-all2": "9.0.3", @@ -2992,7 +2992,6 @@ "version": "9.3.0", "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-9.3.0.tgz", "integrity": "sha512-0MWQLVUT1oVCsUGs9aAWteBVxPlLwJTn5VbQH7B0B3fDizZgrJ9QGnKl/2mp1+5P7153GCBCjO/v1aKJ6eysCg==", - "dev": true, "license": "ISC", "dependencies": { "@conventional-changelog/template": "^1.3.0" diff --git a/package.json b/package.json index ab5d1579..5650c3fc 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "Matt Travi (https://matt.travi.org/)" ], "dependencies": { + "conventional-changelog-angular": "^9.0.0", "conventional-changelog-conventionalcommits": "^10.0.0", "conventional-commits-filter": "^6.0.0", "conventional-commits-parser": "^7.0.0", @@ -30,7 +31,6 @@ "devDependencies": { "ava": "6.4.1", "c8": "11.0.0", - "conventional-changelog-angular": "9.3.0", "lockfile-lint": "5.0.1", "ls-engines": "0.9.4", "npm-run-all2": "9.0.3", From 6b453eebd2da13158db8bec790a144dc57cae3c2 Mon Sep 17 00:00:00 2001 From: babblebey Date: Fri, 11 Sep 2026 20:25:40 +0100 Subject: [PATCH 3/6] doc(preset): update available presets and clarify installation notes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 694b71ea..616ebedd 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,13 @@ With this example: | Option | Description | Default | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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)). | [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) | +| `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), [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits)). | [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) | | `config` | npm package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. | - | | `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). | - | -**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`) +**Notes**: the [`angular`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) and [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) presets are included with this package, so you do not need to install them separately. Custom presets must be installed separately. **Note**: `config` will be overwritten by the values of `preset`. You should use either `preset` or `config`, but not both. From 21dbc5457f0a6a8a6a2c376f9e954567a96e3074 Mon Sep 17 00:00:00 2001 From: babblebey Date: Fri, 11 Sep 2026 20:36:45 +0100 Subject: [PATCH 4/6] doc(README): improve formatting and clarity of options section --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 616ebedd..17b76774 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ With this example: ### Options -| Option | Description | Default | -| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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), [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits)). | [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) | -| `config` | npm package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. | - | -| `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). | - | +| Option | Description | Default | +| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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), [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits)). | [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) | +| `config` | npm package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. | - | +| `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). | - | **Notes**: the [`angular`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) and [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) presets are included with this package, so you do not need to install them separately. Custom presets must be installed separately. From 0fe8016e62a10ec94fe1dbf18beaf8dc413a0fa1 Mon Sep 17 00:00:00 2001 From: babblebey Date: Fri, 11 Sep 2026 20:49:50 +0100 Subject: [PATCH 5/6] refactor(tests): remove deprecated preset tests for `atom`, `ember`, `eslint`, `express`, and `jshint` --- test/integration.test.js | 166 -------------------------------- test/load-parser-config.test.js | 10 -- 2 files changed, 176 deletions(-) diff --git a/test/integration.test.js b/test/integration.test.js index 7451a637..986ba10a 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -25,39 +25,6 @@ test('Parse with "conventional-changelog-conventionalcommits" by default', async t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); }); -test('Accept "preset" option', async (t) => { - const commits = [ - { hash: "123", message: "Fix: First fix (fixes #123)" }, - { hash: "456", message: "Update: Second feature (fixes #456)" }, - ]; - const releaseType = await analyzeCommits({ preset: "eslint" }, { cwd, commits, logger: t.context.logger }); - - t.is(releaseType, "minor"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "patch")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "minor")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); -}); - -test('Accept "config" option', async (t) => { - const commits = [ - { hash: "123", message: "Fix: First fix (fixes #123)" }, - { hash: "456", message: "Update: Second feature (fixes #456)" }, - ]; - const releaseType = await analyzeCommits( - { config: "conventional-changelog-eslint" }, - { cwd, commits, logger: t.context.logger } - ); - - t.is(releaseType, "minor"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "patch")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "minor")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); -}); - test('Accept a "parseOpts" object as option', async (t) => { const commits = [ { hash: "123", message: "%%BUGFIX%% First fix (fixes #123)" }, @@ -76,27 +43,6 @@ test('Accept a "parseOpts" object as option', async (t) => { t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); }); -test('Accept a partial "parseOpts" object as option', async (t) => { - const commits = [ - { hash: "123", message: "%%fix%% First fix (fixes #123)" }, - { hash: "456", message: "%%Update%% Second feature (fixes #456)" }, - ]; - const releaseType = await analyzeCommits( - { - config: "conventional-changelog-eslint", - parserOpts: { headerPattern: /^%%(?.*?)%% (?.*)$/, headerCorrespondence: ["type", "shortDesc"] }, - }, - { cwd, commits, logger: t.context.logger } - ); - - t.is(releaseType, "patch"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "patch")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The commit should not trigger a release")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "patch")); -}); - test("Exclude commits if they have a matching revert commits", async (t) => { const commits = [ { hash: "df012f1", message: "fix(scope): First fix" }, @@ -129,21 +75,6 @@ test('Accept a "releaseRules" option that reference a requirable module', async t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); }); -test('Return "major" if there is a breaking change, using default releaseRules', async (t) => { - const commits = [ - { hash: "123", message: "Fix: First fix (fixes #123)" }, - { hash: "456", message: "Update: Second feature (fixes #456) \n\nBREAKING CHANGE: break something" }, - ]; - const releaseType = await analyzeCommits({ preset: "eslint" }, { cwd, commits, logger: t.context.logger }); - - t.is(releaseType, "major"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "patch")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "major")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "major")); -}); - test('Return "major" if there is a "conventionalcommits" breaking change, using default releaseRules', async (t) => { const commits = [ { hash: "123", message: "fix: First fix" }, @@ -177,27 +108,6 @@ test('Return "patch" if there is only types set to "patch", using default releas t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "patch")); }); -test('Allow to use glob in "releaseRules" configuration', async (t) => { - const commits = [{ message: "Chore: First chore (fixes #123)" }, { message: "Docs: update README (fixes #456)" }]; - const releaseType = await analyzeCommits( - { - preset: "eslint", - releaseRules: [ - { tag: "Chore", release: "patch" }, - { message: "*README*", release: "minor" }, - ], - }, - { cwd, commits, logger: t.context.logger } - ); - - t.is(releaseType, "minor"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "minor")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "minor")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); -}); - test('Return "null" if no rule match', async (t) => { const commits = [ { hash: "123", message: "doc: doc update" }, @@ -213,54 +123,6 @@ test('Return "null" if no rule match', async (t) => { t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "no")); }); -test("Process rules in order and apply highest match", async (t) => { - const commits = [ - { hash: "123", message: "Chore: First chore (fixes #123)" }, - { hash: "456", message: "Docs: update README (fixes #456)" }, - ]; - const releaseType = await analyzeCommits( - { - preset: "eslint", - releaseRules: [ - { tag: "Chore", release: "minor" }, - { tag: "Chore", release: "patch" }, - ], - }, - { cwd, commits, logger: t.context.logger } - ); - - t.is(releaseType, "minor"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "minor")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The commit should not trigger a release")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); -}); - -test("Process rules in order and apply highest match from config even if default has an higher match", async (t) => { - const commits = [ - { hash: "123", message: "Chore: First chore (fixes #123)" }, - { hash: "456", message: "Docs: update README (fixes #456) \n\nBREAKING CHANGE: break something" }, - ]; - const releaseType = await analyzeCommits( - { - preset: "eslint", - releaseRules: [ - { tag: "Chore", release: "patch" }, - { breaking: true, release: "minor" }, - ], - }, - { cwd, commits, logger: t.context.logger } - ); - - t.is(releaseType, "minor"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "patch")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "minor")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); -}); - test('Allow to overwrite default "releaseRules" with "false"', async (t) => { const commits = [ { hash: "123", message: "chore: First chore" }, @@ -321,24 +183,6 @@ test('Commits with an associated default release type have higher priority than t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "patch")); }); -test('Use default "releaseRules" if none of provided match', async (t) => { - const commits = [ - { hash: "123", message: "Chore: First chore" }, - { hash: "456", message: "Update: new feature" }, - ]; - const releaseType = await analyzeCommits( - { preset: "eslint", releaseRules: [{ tag: "Chore", release: "patch" }] }, - { cwd, commits, logger: t.context.logger } - ); - - t.is(releaseType, "minor"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[0].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "patch")); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[1].message)); - t.true(t.context.log.calledWith("The release type for the commit is %s", "minor")); - t.true(t.context.log.calledWith("Analysis of %s commits complete: %s release", 2, "minor")); -}); - test("Filter out empty commits", async (t) => { const commits = [ { hash: "123", message: "" }, @@ -372,16 +216,6 @@ test('Throw error if "config" doesn`t exist', async (t) => { }); }); -test('Throw error if "releaseRules" reference invalid commit type', async (t) => { - await t.throwsAsync( - analyzeCommits({ preset: "eslint", releaseRules: [{ tag: "Update", release: "invalid" }] }, { cwd }), - { - message: - /Error in commit-analyzer configuration: "invalid" is not a valid release type\. Valid values are:\[?.*]/, - } - ); -}); - test('Re-Throw error from "conventional-changelog-parser"', async (t) => { const commits = [{ message: "Fix: First fix (fixes #123)" }, { message: "Update: Second feature (fixes #456)" }]; await t.throwsAsync( diff --git a/test/load-parser-config.test.js b/test/load-parser-config.test.js index bc401490..996667e3 100644 --- a/test/load-parser-config.test.js +++ b/test/load-parser-config.test.js @@ -82,16 +82,6 @@ test('Accept a partial "parserOpts" object as option that overlaod a config', as test(loadPreset, "angular"); test(loadConfig, "angular"); -test(loadPreset, "atom"); -test(loadConfig, "atom"); -test(loadPreset, "ember"); -test(loadConfig, "ember"); -test(loadPreset, "eslint"); -test(loadConfig, "eslint"); -test(loadPreset, "express"); -test(loadConfig, "express"); -test(loadPreset, "jshint"); -test(loadConfig, "jshint"); test(loadPreset, "conventionalcommits", { presetConfig: {} }); test(loadConfig, "conventionalcommits", { presetConfig: {} }); From ce52d65f1604b11ef4b02f35a8ebbfdd0deaf4d7 Mon Sep 17 00:00:00 2001 From: babblebey Date: Mon, 14 Sep 2026 15:39:31 +0100 Subject: [PATCH 6/6] feat(preset): restored ngular as default preset --- README.md | 14 +++++++------- lib/load-parser-config.js | 4 ++-- test/integration.test.js | 2 +- test/load-parser-config.test.js | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 17b76774..a0a08faa 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ With this example: ### Options -| Option | Description | Default | -| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `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), [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits)). | [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) | -| `config` | npm package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. | - | -| `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). | - | +| Option | Description | Default | +| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `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), [`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) | +| `config` | npm package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. | - | +| `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). | - | **Notes**: the [`angular`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) and [`conventionalcommits`](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits) presets are included with this package, so you do not need to install them separately. Custom presets must be installed separately. diff --git a/lib/load-parser-config.js b/lib/load-parser-config.js index 600d5925..4d9745c5 100644 --- a/lib/load-parser-config.js +++ b/lib/load-parser-config.js @@ -1,7 +1,7 @@ import { dirname } from "node:path"; import { fileURLToPath } from "node:url"; import importFrom from "import-from-esm"; -import conventionalChangelogConventionalcommits from "conventional-changelog-conventionalcommits"; +import conventionalChangelogAngular from "conventional-changelog-angular"; /** * Load `conventional-changelog-parser` options. Handle presets that return either a `Promise` or a `Promise`. @@ -27,7 +27,7 @@ export default async ({ preset, config, parserOpts, presetConfig }, { cwd }) => } else if (config) { loadedConfig = await ((await importFrom.silent(__dirname, config)) || (await importFrom(cwd, config)))(); } else { - loadedConfig = await conventionalChangelogConventionalcommits(); + loadedConfig = await conventionalChangelogAngular(); } return { ...loadedConfig.parser, ...parserOpts }; diff --git a/test/integration.test.js b/test/integration.test.js index 986ba10a..6f5c212a 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -10,7 +10,7 @@ test.beforeEach((t) => { t.context.logger = { log }; }); -test('Parse with "conventional-changelog-conventionalcommits" by default', async (t) => { +test('Parse with "conventional-changelog-angular" by default', async (t) => { const commits = [ { hash: "123", message: "fix(scope1): First fix" }, { hash: "456", message: "feat(scope2): Second feature" }, diff --git a/test/load-parser-config.test.js b/test/load-parser-config.test.js index 996667e3..237f518d 100644 --- a/test/load-parser-config.test.js +++ b/test/load-parser-config.test.js @@ -35,10 +35,10 @@ async function loadConfig(t, config, pluginOptions) { loadConfig.title = (providedTitle, config) => `${providedTitle} Load "${config}" config`.trim(); -test('Load "conventional-changelog-conventionalcommits" by default', async (t) => { +test('Load "conventional-changelog-angular" by default', async (t) => { t.deepEqual( await loadParserConfig({}, { cwd }), - (await (await import("conventional-changelog-conventionalcommits")).default()).parser + (await (await import("conventional-changelog-angular")).default()).parser ); });