A Slack discussion last week raised the issue of creating CHANGELOG.md for each package.
Lerna can help with that https://github.com/lerna/lerna#--conventional-commits
$ lerna publish --conventional-commits
(Can also be set in lerna.json
)
When run with this flag, publish will use the Conventional Commits Specification to determine the version bump and generate CHANGELOG files for each package automatically.
Conventional Commits can be fully customized, a common implementation of this seen in widespread use thoughout GitHub is Angular implementation, prefixing commits with docs:
, fix:
, ci:
, chore:
and so on, when working with scoped packages the format takes on the package name as the scope, e.g. docs(i18n):
, docs(a11y):
, docs(is-shallow-equal):
etc
Even though the Angular format above is quite common Conventional Commits is fully customizable and there are a numerous configurations available to be used from projects such as ESLint, Atom, jQuery to name but a few.
One of particular note is the jQuery preset where commits should look like:
Component: Short Description
Optional Long Description
Fixes #xxx
Closes gh-yyy
Ref #zzz
This matches quite closely the WordPress commit message format documented in our handbook:
Component: Brief summary.
Longer description with more details, such as a `new_hook` being introduced with the context of a `$post` and a `$screen`.
More paragraphs can be added as needed.
Props person, another.
Fixes #30000. See #20202, #105.
By mixing the scope package names with our own WordPress Conventional Commit Preset we could have our CHANGELOG.md files generated using a format common to existing WordPress processes which would be benfecial if the packages repo is to get merged into SVN.