commitlint-config-spellbookx 1.2.0 → 1.3.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +91 -60
  3. package/__tests__/index.test.ts +3 -29
  4. package/dist/{get-scopes-D9bIfVqN.js → git-C5S_9pJT.js} +2166 -276
  5. package/dist/index.d.ts +2 -4
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -7
  8. package/dist/lib/index.d.ts +1 -5
  9. package/dist/lib/index.d.ts.map +1 -1
  10. package/dist/lib/index.js +1 -5
  11. package/dist/prompt.js +8 -10
  12. package/dist/rules.d.ts.map +1 -1
  13. package/dist/rules.js +1 -4
  14. package/package.json +3 -15
  15. package/rolldown.config.ts +0 -6
  16. package/src/index.ts +2 -9
  17. package/src/lib/index.ts +1 -5
  18. package/src/prompt.ts +8 -8
  19. package/src/rules.ts +1 -2
  20. package/__tests__/scopes.test.ts +0 -42
  21. package/__tests__/workspaces.test.ts +0 -137
  22. package/dist/constants/commit-types.d.ts +0 -13
  23. package/dist/constants/commit-types.d.ts.map +0 -1
  24. package/dist/constants/commit-types.js +0 -24
  25. package/dist/get-workspaces-raw-path-Cg196xaD.js +0 -2043
  26. package/dist/lib/find-git-root.d.ts +0 -16
  27. package/dist/lib/find-git-root.d.ts.map +0 -1
  28. package/dist/lib/find-git-root.js +0 -30
  29. package/dist/lib/get-scope-description.d.ts +0 -21
  30. package/dist/lib/get-scope-description.d.ts.map +0 -1
  31. package/dist/lib/get-scope-description.js +0 -35
  32. package/dist/lib/get-scopes.d.ts +0 -16
  33. package/dist/lib/get-scopes.d.ts.map +0 -1
  34. package/dist/lib/get-scopes.js +0 -4
  35. package/dist/lib/get-workspaces-raw-path.d.ts +0 -19
  36. package/dist/lib/get-workspaces-raw-path.d.ts.map +0 -1
  37. package/dist/lib/get-workspaces-raw-path.js +0 -3
  38. package/dist/scopes.d.ts +0 -23
  39. package/dist/scopes.d.ts.map +0 -1
  40. package/dist/scopes.js +0 -38
  41. package/src/constants/commit-types.ts +0 -26
  42. package/src/lib/find-git-root.ts +0 -31
  43. package/src/lib/get-scope-description.ts +0 -38
  44. package/src/lib/get-scopes.ts +0 -89
  45. package/src/lib/get-workspaces-raw-path.ts +0 -53
  46. package/src/scopes.ts +0 -40
package/dist/index.d.ts CHANGED
@@ -1,14 +1,12 @@
1
1
  /**
2
2
  * @file index.ts
3
3
  * Main entry point for commitlint-config-spellbookx.
4
- * Exports conventional commit configuration, rules, prompt settings, and scope definitions.
4
+ * Exports conventional commit configuration, rules, and prompt settings.
5
5
  */
6
6
  import type { UserConfig } from '@commitlint/types';
7
- export { COMMIT_TYPES, type CommitType } from './constants/commit-types.js';
8
- export * from './lib/index.js';
7
+ export { packageJson } from './lib/index.js';
9
8
  export { prompt } from './prompt.js';
10
9
  export { rules } from './rules.js';
11
- export { SCOPE_RELEASE, SCOPE_WORKSPACE, scopesArray, scopesEnum, } from './scopes.js';
12
10
  /**
13
11
  * Shareable Commitlint configuration preset enforcing conventional commits.
14
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKpD,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC5E,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,GACX,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,UAKpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAKpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,UAKpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -1,10 +1,5 @@
1
- import { t as getScopes } from "./get-scopes-D9bIfVqN.js";
2
- import { getScopeDescription } from "./lib/get-scope-description.js";
3
- import { findGitRoot } from "./lib/find-git-root.js";
4
- import { t as getWorkspacesRawPath } from "./get-workspaces-raw-path-Cg196xaD.js";
5
- import { SCOPE_RELEASE, SCOPE_WORKSPACE, scopesArray, scopesEnum } from "./scopes.js";
1
+ import "./git-C5S_9pJT.js";
6
2
  import { prompt } from "./prompt.js";
7
- import { COMMIT_TYPES } from "./constants/commit-types.js";
8
3
  import { rules } from "./rules.js";
9
4
  import packageJson from "./lib/package-json.js";
10
5
  import "./lib/index.js";
@@ -21,4 +16,4 @@ const config = {
21
16
  };
22
17
 
23
18
  //#endregion
24
- export { COMMIT_TYPES, SCOPE_RELEASE, SCOPE_WORKSPACE, config, config as default, findGitRoot, getScopeDescription, getScopes, getWorkspacesRawPath, packageJson, prompt, rules, scopesArray, scopesEnum };
19
+ export { config, config as default, packageJson, prompt, rules };
@@ -1,10 +1,6 @@
1
1
  /**
2
2
  * @file index.ts
3
- * Barrel export for atomic utility functions in commitlint-config-spellbookx.
3
+ * Barrel export for internal utilities in commitlint-config-spellbookx.
4
4
  */
5
- export { findGitRoot } from './find-git-root.js';
6
- export { getScopeDescription } from './get-scope-description.js';
7
- export { getScopes } from './get-scopes.js';
8
- export { getWorkspacesRawPath } from './get-workspaces-raw-path.js';
9
5
  export { packageJson } from './package-json.js';
10
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/lib/index.js CHANGED
@@ -1,7 +1,3 @@
1
- import { t as getScopes } from "../get-scopes-D9bIfVqN.js";
2
- import { getScopeDescription } from "./get-scope-description.js";
3
- import { findGitRoot } from "./find-git-root.js";
4
- import { t as getWorkspacesRawPath } from "../get-workspaces-raw-path-Cg196xaD.js";
5
1
  import packageJson from "./package-json.js";
6
2
 
7
- export { findGitRoot, getScopeDescription, getScopes, getWorkspacesRawPath, packageJson };
3
+ export { packageJson };
package/dist/prompt.js CHANGED
@@ -1,6 +1,4 @@
1
- import "./get-scopes-D9bIfVqN.js";
2
- import "./get-workspaces-raw-path-Cg196xaD.js";
3
- import { scopesEnum } from "./scopes.js";
1
+ import { r as scopesEnum } from "./git-C5S_9pJT.js";
4
2
 
5
3
  //#region src/prompt.ts
6
4
  /**
@@ -36,17 +34,17 @@ const prompt = {
36
34
  docs: {
37
35
  description: "Documentation only changes",
38
36
  title: "Documentation",
39
- emoji: "📚"
37
+ emoji: "📖"
40
38
  },
41
39
  style: {
42
40
  description: "Changes that do not affect meaning of the code",
43
41
  title: "Styles",
44
- emoji: "💎"
42
+ emoji: "🎨"
45
43
  },
46
44
  refactor: {
47
45
  description: "Code refactoring",
48
46
  title: "Code Refactoring",
49
- emoji: "📦"
47
+ emoji: "🧹"
50
48
  },
51
49
  perf: {
52
50
  description: "Performance improvements",
@@ -56,17 +54,17 @@ const prompt = {
56
54
  test: {
57
55
  description: "Adding or fixing tests",
58
56
  title: "Tests",
59
- emoji: "🚨"
57
+ emoji: "🧪"
60
58
  },
61
59
  build: {
62
60
  description: "Changes that affect build system",
63
61
  title: "Builds",
64
- emoji: "🛠"
62
+ emoji: "📦"
65
63
  },
66
64
  ci: {
67
65
  description: "Changes to CI config",
68
66
  title: "Continuous Integrations",
69
- emoji: "⚙️"
67
+ emoji: "🤖"
70
68
  },
71
69
  chore: {
72
70
  description: "Other changes",
@@ -76,7 +74,7 @@ const prompt = {
76
74
  revert: {
77
75
  description: "Reverts a previous commit",
78
76
  title: "Reverts",
79
- emoji: "🗑"
77
+ emoji: "🔙"
80
78
  }
81
79
  }
82
80
  },
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKxD;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,cAQnB,CAAC"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD;;GAEG;AACH,eAAO,MAAM,KAAK,EAAE,cAQnB,CAAC"}
package/dist/rules.js CHANGED
@@ -1,7 +1,4 @@
1
- import "./get-scopes-D9bIfVqN.js";
2
- import "./get-workspaces-raw-path-Cg196xaD.js";
3
- import { scopesArray } from "./scopes.js";
4
- import { COMMIT_TYPES } from "./constants/commit-types.js";
1
+ import { n as scopesArray, t as COMMIT_TYPES } from "./git-C5S_9pJT.js";
5
2
 
6
3
  //#region src/rules.ts
7
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commitlint-config-spellbookx",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "description": "A shareable Commitlint configuration for enforcing conventional commits.",
6
6
  "keywords": [
@@ -40,16 +40,6 @@
40
40
  "import": "./dist/prompt.js",
41
41
  "default": "./dist/prompt.js"
42
42
  },
43
- "./scopes": {
44
- "types": "./dist/scopes.d.ts",
45
- "import": "./dist/scopes.js",
46
- "default": "./dist/scopes.js"
47
- },
48
- "./constants": {
49
- "types": "./dist/constants/commit-types.d.ts",
50
- "import": "./dist/constants/commit-types.js",
51
- "default": "./dist/constants/commit-types.js"
52
- },
53
43
  "./lib": {
54
44
  "types": "./dist/lib/index.d.ts",
55
45
  "import": "./dist/lib/index.js",
@@ -67,18 +57,16 @@
67
57
  "dependencies": {
68
58
  "@commitlint/cli": "^21.2.4",
69
59
  "@commitlint/config-conventional": "^21.2.4",
60
+ "@spellbookx/recipes": "1.3.0",
70
61
  "commitizen": "^4.3.2",
71
62
  "conventional-changelog-conventionalcommits": "^10.4.1",
72
- "cz-git": "^1.14.0",
73
- "fast-glob": "^3.3.3",
74
- "js-yaml": "^4.1.1"
63
+ "cz-git": "^1.14.0"
75
64
  },
76
65
  "devDependencies": {
77
66
  "@commitlint/lint": "^21.2.4",
78
67
  "@commitlint/load": "^21.2.4",
79
68
  "@commitlint/types": "^21.2.3",
80
69
  "@dcdavidev/tsconfig": "^0.1.0",
81
- "@types/js-yaml": "^4.0.9",
82
70
  "@types/node": "^25.3.0",
83
71
  "rolldown": "1.0.0-rc.5",
84
72
  "typescript": "5.9.3",
@@ -6,14 +6,8 @@ export default defineConfig([
6
6
  index: 'src/index.ts',
7
7
  rules: 'src/rules.ts',
8
8
  prompt: 'src/prompt.ts',
9
- scopes: 'src/scopes.ts',
10
- 'constants/commit-types': 'src/constants/commit-types.ts',
11
9
  'lib/index': 'src/lib/index.ts',
12
10
  'lib/package-json': 'src/lib/package-json.ts',
13
- 'lib/find-git-root': 'src/lib/find-git-root.ts',
14
- 'lib/get-scope-description': 'src/lib/get-scope-description.ts',
15
- 'lib/get-scopes': 'src/lib/get-scopes.ts',
16
- 'lib/get-workspaces-raw-path': 'src/lib/get-workspaces-raw-path.ts',
17
11
  },
18
12
  output: {
19
13
  format: 'esm',
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @file index.ts
3
3
  * Main entry point for commitlint-config-spellbookx.
4
- * Exports conventional commit configuration, rules, prompt settings, and scope definitions.
4
+ * Exports conventional commit configuration, rules, and prompt settings.
5
5
  */
6
6
 
7
7
  import type { UserConfig } from '@commitlint/types';
@@ -9,16 +9,9 @@ import type { UserConfig } from '@commitlint/types';
9
9
  import { prompt } from './prompt.js';
10
10
  import { rules } from './rules.js';
11
11
 
12
- export { COMMIT_TYPES, type CommitType } from './constants/commit-types.js';
13
- export * from './lib/index.js';
12
+ export { packageJson } from './lib/index.js';
14
13
  export { prompt } from './prompt.js';
15
14
  export { rules } from './rules.js';
16
- export {
17
- SCOPE_RELEASE,
18
- SCOPE_WORKSPACE,
19
- scopesArray,
20
- scopesEnum,
21
- } from './scopes.js';
22
15
 
23
16
  /**
24
17
  * Shareable Commitlint configuration preset enforcing conventional commits.
package/src/lib/index.ts CHANGED
@@ -1,10 +1,6 @@
1
1
  /**
2
2
  * @file index.ts
3
- * Barrel export for atomic utility functions in commitlint-config-spellbookx.
3
+ * Barrel export for internal utilities in commitlint-config-spellbookx.
4
4
  */
5
5
 
6
- export { findGitRoot } from './find-git-root.js';
7
- export { getScopeDescription } from './get-scope-description.js';
8
- export { getScopes } from './get-scopes.js';
9
- export { getWorkspacesRawPath } from './get-workspaces-raw-path.js';
10
6
  export { packageJson } from './package-json.js';
package/src/prompt.ts CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import type { UserConfig } from '@commitlint/types';
7
7
 
8
- import { scopesEnum } from './scopes.js';
8
+ import { scopesEnum } from '@spellbookx/recipes/git';
9
9
 
10
10
  /**
11
11
  * Commitizen and cz-git interactive prompt configuration.
@@ -36,17 +36,17 @@ export const prompt: UserConfig['prompt'] = {
36
36
  docs: {
37
37
  description: 'Documentation only changes',
38
38
  title: 'Documentation',
39
- emoji: '📚',
39
+ emoji: '📖',
40
40
  },
41
41
  style: {
42
42
  description: 'Changes that do not affect meaning of the code',
43
43
  title: 'Styles',
44
- emoji: '💎',
44
+ emoji: '🎨',
45
45
  },
46
46
  refactor: {
47
47
  description: 'Code refactoring',
48
48
  title: 'Code Refactoring',
49
- emoji: '📦',
49
+ emoji: '🧹',
50
50
  },
51
51
  perf: {
52
52
  description: 'Performance improvements',
@@ -56,23 +56,23 @@ export const prompt: UserConfig['prompt'] = {
56
56
  test: {
57
57
  description: 'Adding or fixing tests',
58
58
  title: 'Tests',
59
- emoji: '🚨',
59
+ emoji: '🧪',
60
60
  },
61
61
  build: {
62
62
  description: 'Changes that affect build system',
63
63
  title: 'Builds',
64
- emoji: '🛠',
64
+ emoji: '📦',
65
65
  },
66
66
  ci: {
67
67
  description: 'Changes to CI config',
68
68
  title: 'Continuous Integrations',
69
- emoji: '⚙️',
69
+ emoji: '🤖',
70
70
  },
71
71
  chore: { description: 'Other changes', title: 'Chores', emoji: '♻️' },
72
72
  revert: {
73
73
  description: 'Reverts a previous commit',
74
74
  title: 'Reverts',
75
- emoji: '🗑',
75
+ emoji: '🔙',
76
76
  },
77
77
  },
78
78
  },
package/src/rules.ts CHANGED
@@ -5,8 +5,7 @@
5
5
 
6
6
  import type { QualifiedRules } from '@commitlint/types';
7
7
 
8
- import { COMMIT_TYPES } from './constants/commit-types.js';
9
- import { scopesArray } from './scopes.js';
8
+ import { COMMIT_TYPES, scopesArray } from '@spellbookx/recipes/git';
10
9
 
11
10
  /**
12
11
  * Standard commitlint rules configuration.
@@ -1,42 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
-
3
- import {
4
- getScopeDescription,
5
- SCOPE_RELEASE,
6
- SCOPE_WORKSPACE,
7
- scopesArray,
8
- scopesEnum,
9
- } from '../src/index.js';
10
-
11
- describe('commitlint-config-spellbookx (scopes)', () => {
12
- it('defines workspace and release scope constants', () => {
13
- expect(SCOPE_WORKSPACE).toBe('workspace');
14
- expect(SCOPE_RELEASE).toBe('release');
15
- });
16
-
17
- it.each([
18
- SCOPE_WORKSPACE,
19
- SCOPE_RELEASE,
20
- '@spellbookx/recipes',
21
- 'commitlint-config-spellbookx',
22
- 'cspell-config-spellbookx',
23
- 'eslint-plugin-spellbookx',
24
- 'prettier-config-spellbookx',
25
- 'spellbookx',
26
- ])('includes "%s" in scopesArray and scopesEnum', (scope) => {
27
- expect(scopesArray).toContain(scope);
28
- expect(scopesEnum[scope]).toEqual({
29
- description: getScopeDescription(scope),
30
- });
31
- });
32
-
33
- it('returns descriptive text for special and package scopes', () => {
34
- expect(getScopeDescription(SCOPE_WORKSPACE)).toBe(
35
- 'workspace scope - root files such as config files, root package.json, etc'
36
- );
37
- expect(getScopeDescription(SCOPE_RELEASE)).toBe(
38
- 'Special scope for release commits'
39
- );
40
- expect(getScopeDescription('my-custom-pkg')).toBe('my-custom-pkg scope');
41
- });
42
- });
@@ -1,137 +0,0 @@
1
- import {
2
- existsSync,
3
- mkdirSync,
4
- mkdtempSync,
5
- rmSync,
6
- writeFileSync,
7
- } from 'node:fs';
8
- import os from 'node:os';
9
- import path from 'node:path';
10
- import { fileURLToPath } from 'node:url';
11
-
12
- import { afterEach, beforeEach, describe, expect, it } from 'vitest';
13
-
14
- import {
15
- findGitRoot,
16
- getScopes,
17
- getWorkspacesRawPath,
18
- } from '../src/lib/index.js';
19
-
20
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
21
-
22
- describe('commitlint-config-spellbookx (workspace discovery)', () => {
23
- let tempDir: string;
24
-
25
- beforeEach(() => {
26
- tempDir = mkdtempSync(path.join(os.tmpdir(), 'sbx-commitlint-'));
27
- });
28
-
29
- afterEach(() => {
30
- rmSync(tempDir, { recursive: true, force: true });
31
- });
32
-
33
- describe('findGitRoot', () => {
34
- it('locates the git root directory from a nested package path', () => {
35
- const root = findGitRoot(__dirname);
36
-
37
- expect(root).not.toBeNull();
38
- expect(existsSync(path.join(root!, '.git'))).toBe(true);
39
- });
40
-
41
- it('returns null when no .git directory exists up to filesystem root', () => {
42
- const root = findGitRoot(tempDir);
43
-
44
- expect(root).toBeNull();
45
- });
46
- });
47
-
48
- describe('getWorkspacesRawPath', () => {
49
- it('parses workspace globs from a JSON file', () => {
50
- const jsonPath = path.join(tempDir, 'package.json');
51
- writeFileSync(
52
- jsonPath,
53
- JSON.stringify({ workspaces: ['packages/*', 'apps/*'] })
54
- );
55
-
56
- expect(getWorkspacesRawPath(jsonPath, 'json', 'workspaces')).toEqual([
57
- 'packages/*',
58
- 'apps/*',
59
- ]);
60
- });
61
-
62
- it('parses package globs from a YAML file', () => {
63
- const yamlPath = path.join(tempDir, 'pnpm-workspace.yaml');
64
- writeFileSync(yamlPath, 'packages:\n - "packages/*"\n - "plugins/*"\n');
65
-
66
- expect(getWorkspacesRawPath(yamlPath, 'yaml', 'packages')).toEqual([
67
- 'packages/*',
68
- 'plugins/*',
69
- ]);
70
- });
71
-
72
- it('returns an empty array when file does not exist or property is missing', () => {
73
- expect(
74
- getWorkspacesRawPath(path.join(tempDir, 'missing.json'), 'json')
75
- ).toEqual([]);
76
-
77
- const jsonPath = path.join(tempDir, 'empty.json');
78
- writeFileSync(jsonPath, JSON.stringify({ name: 'no-workspaces' }));
79
- expect(getWorkspacesRawPath(jsonPath, 'json', 'workspaces')).toEqual([]);
80
- });
81
-
82
- it('throws an error when given an unsupported parser type', () => {
83
- const filePath = path.join(tempDir, 'config.txt');
84
- writeFileSync(filePath, 'content');
85
-
86
- expect(() => {
87
- // @ts-expect-error Testing invalid parser runtime check
88
- getWorkspacesRawPath(filePath, 'xml');
89
- }).toThrow(/Unsupported parser type: xml/);
90
- });
91
- });
92
-
93
- describe('getScopes', () => {
94
- it('discovers all package scopes in the current monorepo', () => {
95
- const scopes = getScopes(__dirname);
96
-
97
- expect(scopes).toEqual(
98
- expect.arrayContaining([
99
- '@spellbookx/recipes',
100
- 'commitlint-config-spellbookx',
101
- 'cspell-config-spellbookx',
102
- 'eslint-plugin-spellbookx',
103
- 'prettier-config-spellbookx',
104
- 'spellbookx',
105
- ])
106
- );
107
- });
108
-
109
- it('discovers scopes from a simulated git repository with workspaces and ignores malformed package.json', () => {
110
- mkdirSync(path.join(tempDir, '.git'));
111
- writeFileSync(
112
- path.join(tempDir, 'package.json'),
113
- JSON.stringify({ name: 'root-pkg', workspaces: ['packages/*'] })
114
- );
115
-
116
- const pkgA = path.join(tempDir, 'packages/pkg-a');
117
- const pkgInvalid = path.join(tempDir, 'packages/pkg-invalid');
118
- mkdirSync(pkgA, { recursive: true });
119
- mkdirSync(pkgInvalid, { recursive: true });
120
-
121
- writeFileSync(
122
- path.join(pkgA, 'package.json'),
123
- JSON.stringify({ name: '@acme/pkg-a' })
124
- );
125
- writeFileSync(path.join(pkgInvalid, 'package.json'), '{ invalid json');
126
-
127
- const scopes = getScopes(tempDir);
128
-
129
- expect(scopes).toContain('root-pkg');
130
- expect(scopes).toContain('@acme/pkg-a');
131
- });
132
-
133
- it('throws a fatal error when invoked outside a git repository', () => {
134
- expect(() => getScopes(tempDir)).toThrow('[FATAL] Not a repository.');
135
- });
136
- });
137
- });
@@ -1,13 +0,0 @@
1
- /**
2
- * @file commit-types.ts
3
- * Standard Conventional Commit types supported by Spellbookx.
4
- */
5
- /**
6
- * List of allowed commit types based on the Conventional Commits specification.
7
- */
8
- export declare const COMMIT_TYPES: readonly ["feat", "fix", "docs", "style", "refactor", "perf", "test", "chore", "ci", "build", "revert"];
9
- /**
10
- * Valid Conventional Commit type string.
11
- */
12
- export type CommitType = (typeof COMMIT_TYPES)[number];
13
- //# sourceMappingURL=commit-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commit-types.d.ts","sourceRoot":"","sources":["../../src/constants/commit-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,yGAYf,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -1,24 +0,0 @@
1
- //#region src/constants/commit-types.ts
2
- /**
3
- * @file commit-types.ts
4
- * Standard Conventional Commit types supported by Spellbookx.
5
- */
6
- /**
7
- * List of allowed commit types based on the Conventional Commits specification.
8
- */
9
- const COMMIT_TYPES = [
10
- "feat",
11
- "fix",
12
- "docs",
13
- "style",
14
- "refactor",
15
- "perf",
16
- "test",
17
- "chore",
18
- "ci",
19
- "build",
20
- "revert"
21
- ];
22
-
23
- //#endregion
24
- export { COMMIT_TYPES };