@commitlint/config-nx-scopes 18.4.4 → 18.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +25 -29
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import {RuleConfigSeverity} from '@commitlint/types';
|
|
2
|
+
const {
|
|
3
|
+
getProjects: getNXProjects,
|
|
4
|
+
} = require('nx/src/generators/utils/project-configuration');
|
|
5
|
+
const {FsTree} = require('nx/src/generators/tree');
|
|
2
6
|
|
|
3
7
|
module.exports = {
|
|
4
8
|
utils: {getProjects},
|
|
5
9
|
rules: {
|
|
6
|
-
'scope-enum': (ctx) =>
|
|
7
|
-
getProjects(ctx).then((packages) => [2, 'always', packages]),
|
|
10
|
+
'scope-enum': (ctx) => Promise.resolve([RuleConfigSeverity.Error, 'always', getProjects(ctx)]),
|
|
8
11
|
},
|
|
9
12
|
};
|
|
10
13
|
|
|
@@ -12,30 +15,23 @@ module.exports = {
|
|
|
12
15
|
* @param {(params: Pick<Nx.ProjectConfiguration, 'name' | 'projectType' | 'tags'>) => boolean} selector
|
|
13
16
|
*/
|
|
14
17
|
function getProjects(context, selector = () => true) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
tags: project.tags,
|
|
35
|
-
})
|
|
36
|
-
)
|
|
37
|
-
.filter((project) => project.targets)
|
|
38
|
-
.map((project) => project.name)
|
|
39
|
-
.map((name) => (name.charAt(0) === '@' ? name.split('/')[1] : name));
|
|
40
|
-
});
|
|
18
|
+
const ctx = context || {};
|
|
19
|
+
const cwd = ctx.cwd || process.cwd();
|
|
20
|
+
|
|
21
|
+
const projects = getNXProjects(new FsTree(cwd, false));
|
|
22
|
+
return Array.from(projects.entries())
|
|
23
|
+
.map(([name, project]) => ({
|
|
24
|
+
name,
|
|
25
|
+
...project,
|
|
26
|
+
}))
|
|
27
|
+
.filter((project) =>
|
|
28
|
+
selector({
|
|
29
|
+
name: project.name,
|
|
30
|
+
projectType: project.projectType,
|
|
31
|
+
tags: project.tags,
|
|
32
|
+
})
|
|
33
|
+
)
|
|
34
|
+
.filter((project) => project.targets)
|
|
35
|
+
.map((project) => project.name)
|
|
36
|
+
.map((name) => (name.charAt(0) === '@' ? name.split('/')[1] : name));
|
|
41
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/config-nx-scopes",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.5.0",
|
|
4
4
|
"description": "Shareable commitlint config enforcing nx project names as scopes",
|
|
5
5
|
"files": [
|
|
6
6
|
"index.js"
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@commitlint/test": "^18.0.0",
|
|
42
42
|
"@commitlint/utils": "^18.4.4"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7886d8b254eb09548f695c6032c68e6342299804"
|
|
45
45
|
}
|