@taiga-ui/commitlint-config 0.310.0 → 0.311.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.cjs.js +57 -0
- package/index.esm.js +40 -22
- package/package.json +1 -1
package/index.cjs.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var conventional = require('@commitlint/config-conventional');
|
|
4
|
+
var node_child_process = require('node:child_process');
|
|
5
|
+
var node_fs = require('node:fs');
|
|
6
|
+
|
|
7
|
+
function getGitDiffLines() {
|
|
8
|
+
try {
|
|
9
|
+
return node_child_process.execSync('git diff --name-only --staged').toString().trim().split('\n');
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getTypes(dir) {
|
|
17
|
+
try {
|
|
18
|
+
return node_fs.readdirSync(dir).filter((entity) => node_fs.statSync(`${dir}/${entity}`).isDirectory());
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var index = {
|
|
26
|
+
extends: ['@commitlint/config-conventional'],
|
|
27
|
+
rules: {
|
|
28
|
+
'scope-enum': () => {
|
|
29
|
+
return [
|
|
30
|
+
2,
|
|
31
|
+
'always',
|
|
32
|
+
[
|
|
33
|
+
'release',
|
|
34
|
+
'deprecate',
|
|
35
|
+
'schematics',
|
|
36
|
+
'all',
|
|
37
|
+
'deps',
|
|
38
|
+
...getTypes('projects'),
|
|
39
|
+
...getTypes('apps'),
|
|
40
|
+
...getTypes('libs'),
|
|
41
|
+
...getTypes('packages'),
|
|
42
|
+
],
|
|
43
|
+
];
|
|
44
|
+
},
|
|
45
|
+
'type-enum': () => {
|
|
46
|
+
const staged = getGitDiffLines();
|
|
47
|
+
const demoChanges = staged.filter((path) => path.startsWith('projects/demo') || path.startsWith('apps/demo'));
|
|
48
|
+
const [level, applicable, types] = conventional.rules['type-enum'];
|
|
49
|
+
const prefixes = demoChanges.length === staged.length
|
|
50
|
+
? ['chore']
|
|
51
|
+
: [...types, 'deprecate'];
|
|
52
|
+
return [level, applicable, prefixes];
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports = index;
|
package/index.esm.js
CHANGED
|
@@ -3,35 +3,53 @@ import { execSync } from 'node:child_process';
|
|
|
3
3
|
import { readdirSync, statSync } from 'node:fs';
|
|
4
4
|
|
|
5
5
|
function getGitDiffLines() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
try {
|
|
7
|
+
return execSync('git diff --name-only --staged').toString().trim().split('\n');
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
function getTypes(dir) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
try {
|
|
16
|
+
return readdirSync(dir).filter((entity) => statSync(`${dir}/${entity}`).isDirectory());
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
var index = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
extends: ['@commitlint/config-conventional'],
|
|
25
|
+
rules: {
|
|
26
|
+
'scope-enum': () => {
|
|
27
|
+
return [
|
|
28
|
+
2,
|
|
29
|
+
'always',
|
|
30
|
+
[
|
|
31
|
+
'release',
|
|
32
|
+
'deprecate',
|
|
33
|
+
'schematics',
|
|
34
|
+
'all',
|
|
35
|
+
'deps',
|
|
36
|
+
...getTypes('projects'),
|
|
37
|
+
...getTypes('apps'),
|
|
38
|
+
...getTypes('libs'),
|
|
39
|
+
...getTypes('packages'),
|
|
40
|
+
],
|
|
41
|
+
];
|
|
42
|
+
},
|
|
43
|
+
'type-enum': () => {
|
|
44
|
+
const staged = getGitDiffLines();
|
|
45
|
+
const demoChanges = staged.filter((path) => path.startsWith('projects/demo') || path.startsWith('apps/demo'));
|
|
46
|
+
const [level, applicable, types] = conventional.rules['type-enum'];
|
|
47
|
+
const prefixes = demoChanges.length === staged.length
|
|
48
|
+
? ['chore']
|
|
49
|
+
: [...types, 'deprecate'];
|
|
50
|
+
return [level, applicable, prefixes];
|
|
51
|
+
},
|
|
26
52
|
},
|
|
27
|
-
'type-enum': () => {
|
|
28
|
-
const staged = getGitDiffLines();
|
|
29
|
-
const demoChanges = staged.filter(path => path.startsWith('projects/demo') || path.startsWith('apps/demo'));
|
|
30
|
-
const [level, applicable, types] = conventional.rules['type-enum'];
|
|
31
|
-
const prefixes = demoChanges.length === staged.length ? ['chore'] : [...types, 'deprecate'];
|
|
32
|
-
return [level, applicable, prefixes];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
53
|
};
|
|
36
54
|
|
|
37
55
|
export { index as default };
|