Open
Description
Expected Behavior
When creating a commit be able to identify from where (packages) the files are coming from:
$ git commit -m "feat: adding a new DB adapter for X" # (on packages A)
$ git commit -m "fix: this will solve a problem on the Service Z" # (on packages B)
$ git commit -m "chore: update eslint-config-custom to version 0.4.2" # (on packages A, B, C)
And we format the message given the package/scope they changes are coming from:
ccc64c55 "feat(A): adding a new database adapter for X"
42bc938a "fix(B): this will solve a problem on the Service Z"
9f4fe8d3 "chore: update eslint-config-custom to version 0.4.2"
Current Behavior
When writing a commit we're obligated to define the scope
of the package, and to avoid forgetting it we add the rule 'scope-empty': [2, 'never']
to enforce this definition when generating our CHANGELOG file.
The only way now is by always adding the (scope)
manually as we couldn't find an easy way to adding it dynamically by detecting from which package the affected files are coming from.
There's an approach we can follow by reading the commit message/title and the staged files?
Current config
commitlint.config.js
const { getPackages } = require('@commitlint/config-lerna-scopes').utils;
module.exports = {
extends: [
'@commitlint/config-conventional',
'@commitlint/config-lerna-scopes',
],
rules: {
'scope-case': [2, 'always', ['lower-case', 'pascal-case', 'camel-case']],
'scope-enum': async (ctx) => {
const pkgs = await getPackages(ctx);
return [2, 'always', [...pkgs, 'deps', 'release']]
},
'scope-empty': [2, 'never'],
'header-max-length': [2, 'always', 100],
},
};