Skip to content

Commit

Permalink
chore: replace commitlint Nx plugin with devkit directly
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Oct 24, 2023
1 parent 5841099 commit c8c3241
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 128 deletions.
13 changes: 9 additions & 4 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
const {
utils: { getProjects },
} = require('@commitlint/config-nx-scopes');
buildProjectGraphWithoutDaemon,
} = require('nx/src/project-graph/project-graph');

const EXTRA_SCOPES = ['deps'];

const listNxProjects = async () => {
const graph = await buildProjectGraphWithoutDaemon();
return Object.values(graph.nodes).map((project) => project.name);
};

module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': (ctx) =>
getProjects(ctx).then((packages) => [
'scope-enum': () =>
listNxProjects().then((packages) => [
2,
'always',
[...packages, ...EXTRA_SCOPES],
Expand Down
187 changes: 65 additions & 122 deletions package-lock.json

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

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"devDependencies": {
"@bufbuild/buf": "1.27.0",
"@commitlint/cli": "17.7.2",
"@commitlint/config-conventional": "17.7.0",
"@commitlint/config-nx-scopes": "17.6.4",
"@commitlint/config-conventional": "18.0.0",
"@nx/devkit": "17.0.1",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/exec": "6.0.3",
Expand Down

0 comments on commit c8c3241

Please sign in to comment.