@taiga-ui/commitlint-config 0.262.0 → 0.263.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.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ extends: string[];
3
+ rules: {
4
+ 'scope-enum': () => (string | number | string[])[];
5
+ 'type-enum': () => (string[] | import("@commitlint/types").RuleConfigSeverity | import("@commitlint/types").RuleConfigCondition)[];
6
+ };
7
+ };
8
+ export default _default;
package/index.esm.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./index";
2
+ export { default } from "./index";
package/index.esm.js ADDED
@@ -0,0 +1,37 @@
1
+ import conventional from '@commitlint/config-conventional';
2
+ import { execSync } from 'node:child_process';
3
+ import { readdirSync, statSync } from 'node:fs';
4
+
5
+ function getGitDiffLines() {
6
+ try {
7
+ return execSync('git diff --name-only --staged').toString().trim().split('\n');
8
+ } catch {
9
+ return [];
10
+ }
11
+ }
12
+
13
+ function getTypes(dir) {
14
+ try {
15
+ return readdirSync(dir).filter(entity => statSync(`${dir}/${entity}`).isDirectory());
16
+ } catch {
17
+ return [];
18
+ }
19
+ }
20
+
21
+ var index = {
22
+ extends: ['@commitlint/config-conventional'],
23
+ rules: {
24
+ 'scope-enum': () => {
25
+ return [2, 'always', ['release', 'deprecate', 'schematics', 'all', 'deps', ...getTypes('projects'), ...getTypes('apps'), ...getTypes('libs'), ...getTypes('packages')]];
26
+ },
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
+ };
36
+
37
+ export { index as default };
package/package.json CHANGED
@@ -1,23 +1,32 @@
1
1
  {
2
- "name": "@taiga-ui/commitlint-config",
3
- "version": "0.262.0",
4
- "description": "Taiga UI commitlint config",
5
- "keywords": [
6
- "commitlint",
7
- "prettier"
8
- ],
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/taiga-family/configurations.git"
12
- },
13
- "license": "Apache-2.0",
14
- "type": "module",
15
- "exports": "./commitlint.config.js",
16
- "peerDependencies": {
17
- "@commitlint/cli": "^19.8.0",
18
- "@commitlint/config-conventional": "^19.8.0"
19
- },
20
- "publishConfig": {
21
- "access": "public"
2
+ "name": "@taiga-ui/commitlint-config",
3
+ "version": "0.263.0",
4
+ "description": "Taiga UI commitlint config",
5
+ "keywords": [
6
+ "commitlint",
7
+ "prettier"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/taiga-family/configurations.git"
12
+ },
13
+ "license": "Apache-2.0",
14
+ "type": "module",
15
+ "peerDependencies": {
16
+ "@commitlint/cli": "^19.8.0",
17
+ "@commitlint/config-conventional": "^19.8.0"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "exports": {
23
+ "./package.json": "./package.json",
24
+ ".": {
25
+ "import": "./index.esm.js",
26
+ "types": "./index.esm.d.ts"
22
27
  }
23
- }
28
+ },
29
+ "module": "./index.esm.js",
30
+ "main": "./index.esm.js",
31
+ "types": "./index.esm.d.ts"
32
+ }
@@ -0,0 +1 @@
1
+ export declare function getGitDiffLines(): string[];
@@ -0,0 +1 @@
1
+ export declare function getTypes(dir: string): string[];
@@ -1,43 +0,0 @@
1
- import fs from 'node:fs';
2
-
3
- import conventional from '@commitlint/config-conventional';
4
-
5
- export default {
6
- extends: ['@commitlint/config-conventional'],
7
- rules: {
8
- 'scope-enum': () => {
9
- function getTypes(dir) {
10
- try {
11
- const {readdirSync, statSync} = fs;
12
-
13
- return readdirSync(dir).filter((entity) =>
14
- statSync(`${dir}/${entity}`).isDirectory(),
15
- );
16
- } catch {
17
- return [];
18
- }
19
- }
20
-
21
- return [
22
- 2,
23
- 'always',
24
- [
25
- 'release',
26
- 'deprecate',
27
- 'schematics',
28
- 'all',
29
- 'deps',
30
- ...getTypes('projects'),
31
- ...getTypes('apps'),
32
- ...getTypes('libs'),
33
- ...getTypes('packages'),
34
- ],
35
- ];
36
- },
37
- 'type-enum': () => {
38
- const [level, applicable, types] = conventional.rules['type-enum'];
39
-
40
- return [level, applicable, [...types, 'deprecate']];
41
- },
42
- },
43
- };