-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(conventional-changelog-presets): supported new preset format #526
Changes from all commits
a681671
4fe3563
8a042da
8e79828
c6075a5
73d5356
9c4e5f5
c87cc1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,19 +25,13 @@ export default async ({ preset, config, parserOpts, writerOpts, presetConfig }, | |
|
||
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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the angular config currently does not accept config, so i think it is ok to avoid passing the config here |
||
} | ||
|
||
loadedConfig = await (typeof loadedConfig === "function" | ||
? isPlainObject(presetConfig) | ||
? loadedConfig(presetConfig) | ||
: promisify(loadedConfig)() | ||
: loadedConfig); | ||
|
||
Comment on lines
-35
to
-40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this took me a bit to understand, capturing the reason this is being removed. with the previous preset format, most presets returned an object, but the conventionalcommits preset returned a function that accepted config. the change that resulted in the breaking changes across the conventional-changelog presets was an effort to unify the interface across those presets. therefore, we can instead pass the config above and remove the handling of the different potential return shapes. nice work @dangreen! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i figured this out after cutting the first beta of the commit-analyzer plugin, so will make this change there too soon |
||
return { | ||
parserOpts: { ...loadedConfig.parserOpts, ...parserOpts }, | ||
writerOpts: { ...loadedConfig.writerOpts, ...writerOpts }, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also accept the config, but we dont currently have a test for that case, so want to add those together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the interest of getting the beta promoted, i'm ok with completing this detail after this is merged