Skip to content

Commit

Permalink
Merge pull request #519 from semantic-release/beta
Browse files Browse the repository at this point in the history
  • Loading branch information
travi committed Sep 18, 2023
2 parents 84e84f9 + a681fbd commit 78f8f52
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 124 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
matrix:
node-version:
- 18.0.0
- 19
- 18.17.0
- 20.6.1
- 20
os:
- ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
v18
12 changes: 3 additions & 9 deletions lib/load-parser-config.js
Expand Up @@ -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 };
};
134 changes: 33 additions & 101 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions test/integration.test.js
Expand Up @@ -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"));
});
Expand Down
2 changes: 1 addition & 1 deletion test/load-parser-config.test.js
Expand Up @@ -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
);
});

Expand Down

0 comments on commit 78f8f52

Please sign in to comment.