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/lib/load-parser-config.js b/lib/load-parser-config.js index ee4a6c0f..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 }; }; diff --git a/package-lock.json b/package-lock.json index d500638a..d5ecfa1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "0.0.0-development", "license": "MIT", "dependencies": { - "conventional-changelog-angular": "^6.0.0", - "conventional-commits-filter": "^3.0.0", + "conventional-changelog-angular": "^7.0.0", + "conventional-commits-filter": "^4.0.0", "conventional-commits-parser": "^5.0.0", "debug": "^4.0.0", "import-from": "^4.0.0", @@ -20,18 +20,18 @@ "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": "22.0.0", "sinon": "16.0.0" }, "engines": { - "node": ">=18" + "node": "^18.17 || >=20.6.1" }, "peerDependencies": { "semantic-release": ">=20.1.0" @@ -480,27 +480,6 @@ "semantic-release": ">=20.1.0" } }, - "node_modules/@semantic-release/commit-analyzer/node_modules/conventional-changelog-angular": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", - "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", - "dev": true, - "dependencies": { - "compare-func": "^2.0.0" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@semantic-release/commit-analyzer/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==", - "dev": true, - "engines": { - "node": ">=16" - } - }, "node_modules/@semantic-release/error": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", @@ -653,27 +632,6 @@ "semantic-release": ">=20.1.0" } }, - "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-changelog-angular": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz", - "integrity": "sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ==", - "dev": true, - "dependencies": { - "compare-func": "^2.0.0" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@semantic-release/release-notes-generator/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==", - "dev": true, - "engines": { - "node": ">=16" - } - }, "node_modules/@semantic-release/release-notes-generator/node_modules/get-stream": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-7.0.1.tgz", @@ -1391,23 +1349,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": { @@ -1423,42 +1381,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": { @@ -1481,27 +1439,14 @@ "node": ">=16" } }, - "node_modules/conventional-changelog-writer/node_modules/conventional-commits-filter": { + "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==", - "dev": true, "engines": { "node": ">=16" } }, - "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==", - "dependencies": { - "lodash.ismatch": "^4.4.0", - "modify-values": "^1.0.1" - }, - "engines": { - "node": ">=14" - } - }, "node_modules/conventional-commits-parser": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", @@ -2714,11 +2659,6 @@ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", "dev": true }, - "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==" - }, "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -2931,14 +2871,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/modify-values": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", - "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", diff --git a/package.json b/package.json index 24985217..dedee242 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "Gregor Martynus (https://twitter.com/gr2m)" ], "dependencies": { - "conventional-changelog-angular": "^6.0.0", - "conventional-commits-filter": "^3.0.0", + "conventional-changelog-angular": "^7.0.0", + "conventional-commits-filter": "^4.0.0", "conventional-commits-parser": "^5.0.0", "debug": "^4.0.0", "import-from": "^4.0.0", @@ -28,18 +28,18 @@ "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": "22.0.0", "sinon": "16.0.0" }, "engines": { - "node": ">=18" + "node": "^18.17 || >=20.6.1" }, "files": [ "lib", 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")); }); 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 ); });