From f3b88d3e7409b0bac38cb58bd04f19506f2f6159 Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Fri, 1 Sep 2023 15:57:32 -0500 Subject: [PATCH 1/5] feat(conventional-changelog-presets): supported new preset format BREAKING CHANGE: the new preset format is a breaking change when compared to the previous preset format. updating to support the new format means that the old preset format is no longer supported. update your preset to the latest version to maintain compatibility --- lib/load-parser-config.js | 6 +-- package-lock.json | 84 +++++++++++++++++++++------------ package.json | 12 ++--- test/load-parser-config.test.js | 2 +- 4 files changed, 64 insertions(+), 40 deletions(-) diff --git a/lib/load-parser-config.js b/lib/load-parser-config.js index ee4a6c0f..8c4bbdbd 100644 --- a/lib/load-parser-config.js +++ b/lib/load-parser-config.js @@ -22,11 +22,11 @@ export default async ({ preset, config, parserOpts, presetConfig }, { cwd }) => if (preset) { const presetPackage = `conventional-changelog-${preset.toLowerCase()}`; - loadedConfig = importFrom.silent(__dirname, presetPackage) || importFrom(cwd, presetPackage); + loadedConfig = (importFrom.silent(__dirname, presetPackage) || importFrom(cwd, presetPackage))(); } else if (config) { - loadedConfig = importFrom.silent(__dirname, config) || importFrom(cwd, config); + loadedConfig = (importFrom.silent(__dirname, config) || importFrom(cwd, config))(); } else { - loadedConfig = conventionalChangelogAngular; + loadedConfig = conventionalChangelogAngular(); } loadedConfig = await (typeof loadedConfig === "function" diff --git a/package-lock.json b/package-lock.json index 26493e38..a6e3b074 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0-development", "license": "MIT", "dependencies": { - "conventional-changelog-angular": "^6.0.0", + "conventional-changelog-angular": "^7.0.0", "conventional-commits-filter": "^3.0.0", "conventional-commits-parser": "^5.0.0", "debug": "^4.0.0", @@ -20,12 +20,12 @@ "devDependencies": { "ava": "5.3.1", "c8": "8.0.1", - "conventional-changelog-atom": "3.0.0", + "conventional-changelog-atom": "4.0.0", "conventional-changelog-conventionalcommits": "6.1.0", - "conventional-changelog-ember": "3.0.0", - "conventional-changelog-eslint": "4.0.0", - "conventional-changelog-express": "3.0.0", - "conventional-changelog-jshint": "3.0.0", + "conventional-changelog-ember": "4.0.0", + "conventional-changelog-eslint": "5.0.0", + "conventional-changelog-express": "4.0.0", + "conventional-changelog-jshint": "4.0.0", "prettier": "3.0.3", "semantic-release": "21.1.1", "sinon": "15.2.0" @@ -480,6 +480,18 @@ "semantic-release": ">=20.1.0" } }, + "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-changelog-angular": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz", + "integrity": "sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-commits-parser": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz", @@ -691,6 +703,18 @@ "semantic-release": ">=20.1.0" } }, + "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-changelog-angular": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz", + "integrity": "sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-commits-parser": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz", @@ -1672,23 +1696,23 @@ } }, "node_modules/conventional-changelog-angular": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz", - "integrity": "sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", + "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", "dependencies": { "compare-func": "^2.0.0" }, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-atom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-3.0.0.tgz", - "integrity": "sha512-pnN5bWpH+iTUWU3FaYdw5lJmfWeqSyrUkG+wyHBI9tC1dLNnHkbAOg1SzTQ7zBqiFrfo55h40VsGXWMdopwc5g==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-4.0.0.tgz", + "integrity": "sha512-q2YtiN7rnT1TGwPTwjjBSIPIzDJCRE+XAUahWxnh+buKK99Kks4WLMHoexw38GXx9OUxAsrp44f9qXe5VEMYhw==", "dev": true, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-conventionalcommits": { @@ -1704,42 +1728,42 @@ } }, "node_modules/conventional-changelog-ember": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-3.0.0.tgz", - "integrity": "sha512-7PYthCoSxIS98vWhVcSphMYM322OxptpKAuHYdVspryI0ooLDehRXWeRWgN+zWSBXKl/pwdgAg8IpLNSM1/61A==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-4.0.0.tgz", + "integrity": "sha512-D0IMhwcJUg1Y8FSry6XAplEJcljkHVlvAZddhhsdbL1rbsqRsMfGx/PIkPYq0ru5aDgn+OxhQ5N5yR7P9mfsvA==", "dev": true, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-eslint": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-4.0.0.tgz", - "integrity": "sha512-nEZ9byP89hIU0dMx37JXQkE1IpMmqKtsaR24X7aM3L6Yy/uAtbb+ogqthuNYJkeO1HyvK7JsX84z8649hvp43Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-5.0.0.tgz", + "integrity": "sha512-6JtLWqAQIeJLn/OzUlYmzd9fKeNSWmQVim9kql+v4GrZwLx807kAJl3IJVc3jTYfVKWLxhC3BGUxYiuVEcVjgA==", "dev": true, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-express": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-3.0.0.tgz", - "integrity": "sha512-HqxihpUMfIuxvlPvC6HltA4ZktQEUan/v3XQ77+/zbu8No/fqK3rxSZaYeHYant7zRxQNIIli7S+qLS9tX9zQA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-4.0.0.tgz", + "integrity": "sha512-yWyy5c7raP9v7aTvPAWzqrztACNO9+FEI1FSYh7UP7YT1AkWgv5UspUeB5v3Ibv4/o60zj2o9GF2tqKQ99lIsw==", "dev": true, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-jshint": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-3.0.0.tgz", - "integrity": "sha512-bQof4byF4q+n+dwFRkJ/jGf9dCNUv4/kCDcjeCizBvfF81TeimPZBB6fT4HYbXgxxfxWXNl/i+J6T0nI4by6DA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-4.0.0.tgz", + "integrity": "sha512-LyXq1bbl0yG0Ai1SbLxIk8ZxUOe3AjnlwE6sVRQmMgetBk+4gY9EO3d00zlEt8Y8gwsITytDnPORl8al7InTjg==", "dev": true, "dependencies": { "compare-func": "^2.0.0" }, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/conventional-changelog-writer": { diff --git a/package.json b/package.json index 228fceab..4d17235b 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "Gregor Martynus (https://twitter.com/gr2m)" ], "dependencies": { - "conventional-changelog-angular": "^6.0.0", + "conventional-changelog-angular": "^7.0.0", "conventional-commits-filter": "^3.0.0", "conventional-commits-parser": "^5.0.0", "debug": "^4.0.0", @@ -28,12 +28,12 @@ "devDependencies": { "ava": "5.3.1", "c8": "8.0.1", - "conventional-changelog-atom": "3.0.0", + "conventional-changelog-atom": "4.0.0", "conventional-changelog-conventionalcommits": "6.1.0", - "conventional-changelog-ember": "3.0.0", - "conventional-changelog-eslint": "4.0.0", - "conventional-changelog-express": "3.0.0", - "conventional-changelog-jshint": "3.0.0", + "conventional-changelog-ember": "4.0.0", + "conventional-changelog-eslint": "5.0.0", + "conventional-changelog-express": "4.0.0", + "conventional-changelog-jshint": "4.0.0", "prettier": "3.0.3", "semantic-release": "21.1.1", "sinon": "15.2.0" diff --git a/test/load-parser-config.test.js b/test/load-parser-config.test.js index 83da1506..6c3de649 100644 --- a/test/load-parser-config.test.js +++ b/test/load-parser-config.test.js @@ -36,7 +36,7 @@ loadConfig.title = (providedTitle, config) => `${providedTitle} Load "${config}" test('Load "conventional-changelog-angular" by default', async (t) => { t.deepEqual( await loadParserConfig({}, { cwd }), - (await (await import("conventional-changelog-angular")).default).parserOpts + (await (await import("conventional-changelog-angular")).default()).parserOpts ); }); From 99dcf7ef13a2d0206f621f5046aa1ccbb4a9e480 Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Tue, 5 Sep 2023 22:52:42 -0500 Subject: [PATCH 2/5] fix(deps): update dependency conventional-commits-filter to v4 --- package-lock.json | 43 ++++++++++++++++++++++++++++++++++++++++--- package.json | 2 +- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a6e3b074..2a724dee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "conventional-changelog-angular": "^7.0.0", - "conventional-commits-filter": "^3.0.0", + "conventional-commits-filter": "^4.0.0", "conventional-commits-parser": "^5.0.0", "debug": "^4.0.0", "import-from": "^4.0.0", @@ -492,6 +492,19 @@ "node": ">=14" } }, + "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-commits-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz", + "integrity": "sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==", + "dev": true, + "dependencies": { + "lodash.ismatch": "^4.4.0", + "modify-values": "^1.0.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-commits-parser": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz", @@ -715,6 +728,19 @@ "node": ">=14" } }, + "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-commits-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz", + "integrity": "sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==", + "dev": true, + "dependencies": { + "lodash.ismatch": "^4.4.0", + "modify-values": "^1.0.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-commits-parser": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz", @@ -1787,10 +1813,11 @@ "node": ">=14" } }, - "node_modules/conventional-commits-filter": { + "node_modules/conventional-changelog-writer/node_modules/conventional-commits-filter": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz", "integrity": "sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==", + "dev": true, "dependencies": { "lodash.ismatch": "^4.4.0", "modify-values": "^1.0.1" @@ -1799,6 +1826,14 @@ "node": ">=14" } }, + "node_modules/conventional-commits-filter": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-4.0.0.tgz", + "integrity": "sha512-rnpnibcSOdFcdclpFwWa+pPlZJhXE7l+XK04zxhbWrhgpR96h33QLz8hITTXbcYICxVr3HZFtbtUAQ+4LdBo9A==", + "engines": { + "node": ">=16" + } + }, "node_modules/conventional-commits-parser": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", @@ -3118,7 +3153,8 @@ "node_modules/lodash.ismatch": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", - "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==" + "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", + "dev": true }, "node_modules/lodash.isplainobject": { "version": "4.0.6", @@ -3406,6 +3442,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", + "dev": true, "engines": { "node": ">=0.10.0" } diff --git a/package.json b/package.json index 4d17235b..785e2a3b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ ], "dependencies": { "conventional-changelog-angular": "^7.0.0", - "conventional-commits-filter": "^3.0.0", + "conventional-commits-filter": "^4.0.0", "conventional-commits-parser": "^5.0.0", "debug": "^4.0.0", "import-from": "^4.0.0", From 27fd252a45a8311920fe4b7b23cea0165a246219 Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Sun, 10 Sep 2023 09:38:30 -0500 Subject: [PATCH 3/5] test(integration): reversed the list of commits to align with conventional-changelog expectations based on https://github.com/conventional-changelog/conventional-changelog/issues/1121#issuecomment-1709206347. however, assuming the previous order actually aligned with how core provides the list, this will need to be coordinated with reversing that list somewhere --- test/integration.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration.test.js b/test/integration.test.js index fb45793b..1078a6d1 100644 --- a/test/integration.test.js +++ b/test/integration.test.js @@ -99,14 +99,14 @@ test('Accept a partial "parseOpts" object as option', async (t) => { test("Exclude commits if they have a matching revert commits", async (t) => { const commits = [ - { hash: "123", message: "feat(scope): First feature" }, - { hash: "456", message: "revert: feat(scope): First feature\n\nThis reverts commit 123.\n" }, { message: "fix(scope): First fix" }, + { hash: "456", message: "revert: feat(scope): First feature\n\nThis reverts commit 123.\n" }, + { hash: "123", message: "feat(scope): First feature" }, ]; const releaseType = await analyzeCommits({}, { cwd, commits, logger: t.context.logger }); t.is(releaseType, "patch"); - t.true(t.context.log.calledWith("Analyzing commit: %s", commits[2].message)); + 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("Analysis of %s commits complete: %s release", 3, "patch")); }); From 3ff94584f399738acb2075c6175df64e2ae181e5 Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Fri, 15 Sep 2023 13:18:26 -0500 Subject: [PATCH 4/5] fix(config-loader): accounted for normalization of preset interfaces --- lib/load-parser-config.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/load-parser-config.js b/lib/load-parser-config.js index 8c4bbdbd..44163652 100644 --- a/lib/load-parser-config.js +++ b/lib/load-parser-config.js @@ -22,18 +22,12 @@ export default async ({ preset, config, parserOpts, presetConfig }, { cwd }) => if (preset) { const presetPackage = `conventional-changelog-${preset.toLowerCase()}`; - loadedConfig = (importFrom.silent(__dirname, presetPackage) || importFrom(cwd, presetPackage))(); + loadedConfig = await (importFrom.silent(__dirname, presetPackage) || importFrom(cwd, presetPackage))(presetConfig); } else if (config) { - loadedConfig = (importFrom.silent(__dirname, config) || importFrom(cwd, config))(); + loadedConfig = await (importFrom.silent(__dirname, config) || importFrom(cwd, config))(); } else { - loadedConfig = conventionalChangelogAngular(); + loadedConfig = await conventionalChangelogAngular(); } - loadedConfig = await (typeof loadedConfig === "function" - ? isPlainObject(presetConfig) - ? loadedConfig(presetConfig) - : promisify(loadedConfig)() - : loadedConfig); - return { ...loadedConfig.parserOpts, ...parserOpts }; }; From a681fbdab30b4ff66093506ce09b383e750cca5e Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Sat, 16 Sep 2023 23:44:54 -0500 Subject: [PATCH 5/5] feat(node-versions): raised the minimum node version to v18.17 and dropped v19 support BREAKING CHANGE: the minimum required node version is now v18.17, v19 support has been dropped, and the minimum required in the v20 range is v20.6.1 --- .github/workflows/test.yml | 4 ++-- .nvmrc | 1 + package-lock.json | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 .nvmrc diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d964c72..839ba5e0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,8 +13,8 @@ jobs: strategy: matrix: node-version: - - 18.0.0 - - 19 + - 18.17.0 + - 20.6.1 - 20 os: - ubuntu-latest diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..3f430af8 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18 diff --git a/package-lock.json b/package-lock.json index 11677704..6286a267 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "sinon": "16.0.0" }, "engines": { - "node": ">=18" + "node": "^18.17 || >=20.6.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" diff --git a/package.json b/package.json index 6d630a56..dedee242 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "sinon": "16.0.0" }, "engines": { - "node": ">=18" + "node": "^18.17 || >=20.6.1" }, "files": [ "lib",