Skip to content

Commit

Permalink
ci: add 'demo' type to commit messages (#3590)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxokorokov committed Feb 13, 2020
1 parent 42642ac commit 2e0918a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
18 changes: 15 additions & 3 deletions DEVELOPER.md
Expand Up @@ -184,8 +184,20 @@ For Conventional Commit Messages to be working with [CommitLint](https://commitl

In both cases you can validate your local installation by trying to commit something. (guides available [here](https://commitlint.js.org/#/guides-local-setup))

#### Scopes

We maintain dynamic custom scopes on the project. Valid scopes correspond to the name of our widgets or the 2 generic terms _"demo"_ & _"demos"_.
#### Commit types and scopes

We maintain dynamic custom scopes for the project. Valid scopes correspond to the name of our widgets: `alert`, `accordion`, etc.

Examples:
- `feat(datepicker): ...` → a new feature for the datepicker
- `fix(datepicker): ...` → a bug fix for the datepicker
- `test(datepicker): ... ` → an update to one of the datepicker unit or e2e tests
- `docs(datepicker): ...` → a datepicker documentation update
- `refactor(datepicker): ... ` → an internal datepicker refactoring without public functionality changes
- `demo(datepicker): ... ` → an update to one of the datepicker demos
- `demo: ...` → any change for the demo site
- `build: ...` → any change for the utility scripts, configurations, dependencies, etc.
- `ci: ...` → any change for CI related configuration
- `revert: ...` → revert an older commit

Anything else won't pass commitlint validation.
17 changes: 11 additions & 6 deletions commitlint.config.js
@@ -1,17 +1,22 @@
const fs = require('fs');
const angularTypes = require('@commitlint/config-angular-type-enum').value();

/*
Let's get widget names as valid list of scopes.
Adding also demo & demos as valid too.
*/
const scopes = [
"demo", "demos", ...fs.readdirSync("./src", {withFileTypes: true})
.filter(d => d.isDirectory())
.filter(d => !["test", "util"].includes(d.name))
.map(d => d.name)
...fs.readdirSync("./src", {withFileTypes: true})
.filter(d => d.isDirectory())
.filter(d => !["test", "util"].includes(d.name))
.map(d => d.name)
];

const types = ['demo', ...angularTypes];

module.exports = {
extends: ['@commitlint/config-angular'],
rules: {"scope-enum": [2, 'always', scopes]}
rules: {
"scope-enum": [2, 'always', scopes],
"type-enum": [2, 'always', types]
}
};

0 comments on commit 2e0918a

Please sign in to comment.