@abelspithost/commitlint 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026 Abel Spithost
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # @abelspithost/commitlint
2
+
3
+ A shared [commitlint](https://commitlint.js.org/) preset that extends `@commitlint/config-conventional` with stricter defaults, plus a CLI to set everything up in one command.
4
+
5
+ ## What's included
6
+
7
+ - Commitlint configuration that extends `@commitlint/config-conventional`
8
+ - Scope is optional by default
9
+ - A `createConfig` helper to customize allowed types and scopes (providing scopes makes them mandatory)
10
+ - An `init` CLI that installs and configures commitlint + husky automatically
11
+ - Automatic package manager detection (npm, yarn, pnpm, bun)
12
+
13
+ ## Quick setup
14
+
15
+ Run the init command in your project root:
16
+
17
+ ```sh
18
+ npx -p @abelspithost/commitlint init
19
+ ```
20
+
21
+ The CLI automatically detects your package manager by looking for `bun.lockb`/`bun.lock`, `pnpm-lock.yaml`, `yarn.lock`, or falling back to npm. It will:
22
+
23
+ 1. Install `husky`, `@commitlint/cli`, and `@abelspithost/commitlint` as dev dependencies
24
+ 2. Initialize husky
25
+ 3. Remove the default `pre-commit` hook created by husky
26
+ 4. Create a `.husky/commit-msg` hook (using the correct runner for your package manager)
27
+ 5. Generate a `commitlint.config.ts` that re-exports the preset (skipped if one already exists)
28
+
29
+ ## Manual setup (npm)
30
+
31
+ Install the dependencies:
32
+
33
+ ```sh
34
+ npm install --save-dev husky @commitlint/cli @abelspithost/commitlint
35
+ ```
36
+
37
+ Create a `commitlint.config.ts` in your project root:
38
+
39
+ ```ts
40
+ export { default } from '@abelspithost/commitlint';
41
+ ```
42
+
43
+ Set up husky and add the commit-msg hook:
44
+
45
+ ```sh
46
+ npx husky init
47
+ ```
48
+
49
+ Then create a `.husky/commit-msg` file with the following content:
50
+
51
+ ```sh
52
+ npx --no -- commitlint --edit $1
53
+ ```
54
+
55
+ ## Using `createConfig`
56
+
57
+ Use the `createConfig` helper to customize allowed scopes and types:
58
+
59
+ ```ts
60
+ import { createConfig } from '@abelspithost/commitlint';
61
+
62
+ export default createConfig({
63
+ scopes: ['api', 'ui', 'core'],
64
+ });
65
+ ```
66
+
67
+ ### Options
68
+
69
+ | Option | Type | Default | Description |
70
+ | -------- | ---------- | -------------- | ------------------------------------ |
71
+ | `scopes` | `string[]` | — | Restrict commits to these scopes (makes scope mandatory) |
72
+ | `types` | `string[]` | `COMMIT_TYPES` | Override the allowed commit types |
73
+
74
+ When `scopes` is omitted, scope is optional and any value is accepted. When `scopes` is provided, a scope becomes **required** and must be one of the listed values. When `types` is omitted, it defaults to the built-in `COMMIT_TYPES`.
75
+
76
+ ### Examples
77
+
78
+ ```ts
79
+ // Restrict scopes only
80
+ import { createConfig } from '@abelspithost/commitlint';
81
+
82
+ export default createConfig({
83
+ scopes: ['api', 'ui', 'core', 'docs'],
84
+ });
85
+ ```
86
+
87
+ ```ts
88
+ // Custom types and scopes
89
+ import { createConfig } from '@abelspithost/commitlint';
90
+
91
+ export default createConfig({
92
+ scopes: ['api', 'ui'],
93
+ types: ['feat', 'fix', 'chore'],
94
+ });
95
+ ```
96
+
97
+ ## Extending the preset manually
98
+
99
+ Import the default config and spread it into your own configuration in `commitlint.config.ts`:
100
+
101
+ ```ts
102
+ import baseConfig, { RuleConfigSeverity, type UserConfig } from '@abelspithost/commitlint';
103
+
104
+ const configuration: UserConfig = {
105
+ ...baseConfig,
106
+ rules: {
107
+ ...baseConfig.rules,
108
+ // require a scope in this project
109
+ 'scope-empty': [RuleConfigSeverity.Error, 'never'],
110
+ },
111
+ };
112
+
113
+ export default configuration;
114
+ ```
115
+
116
+ `RuleConfigSeverity` and `UserConfig` are re-exported from this package so you don't need to install `@commitlint/types` separately.
117
+
118
+ ## Commit message format
119
+
120
+ Commits must follow the [Conventional Commits](https://www.conventionalcommits.org/) format:
121
+
122
+ ```
123
+ type: description
124
+ type(scope): description
125
+ ```
126
+
127
+ ### Allowed types
128
+
129
+ `build`, `chore`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `style`, `test`
130
+
131
+ ### Examples
132
+
133
+ ```
134
+ feat: add login endpoint
135
+ fix(api): handle null response from user service
136
+ docs(readme): add installation instructions
137
+ ```
package/bin/cli.mjs ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env node
2
+ import { execSync } from 'node:child_process';
3
+ import { existsSync, unlinkSync, writeFileSync } from 'node:fs';
4
+
5
+ function run(cmd) {
6
+ return execSync(cmd, { stdio: 'inherit' });
7
+ }
8
+
9
+ function step(description, fn) {
10
+ try {
11
+ fn();
12
+ } catch {
13
+ console.error(`\nFailed to ${description}. Please check the error above and retry.`);
14
+ process.exit(1);
15
+ }
16
+ }
17
+
18
+ function detectPackageManager() {
19
+ if (existsSync('bun.lockb') || existsSync('bun.lock')) return 'bun';
20
+ if (existsSync('pnpm-lock.yaml')) return 'pnpm';
21
+ if (existsSync('yarn.lock')) return 'yarn';
22
+ return 'npm';
23
+ }
24
+
25
+ function installCommand(pm, deps) {
26
+ const joined = deps.join(' ');
27
+ switch (pm) {
28
+ case 'bun':
29
+ return `bun add -D ${joined}`;
30
+ case 'pnpm':
31
+ return `pnpm add -D ${joined}`;
32
+ case 'yarn':
33
+ return `yarn add -D ${joined}`;
34
+ default:
35
+ return `npm install --save-dev ${joined}`;
36
+ }
37
+ }
38
+
39
+ const pm = detectPackageManager();
40
+ const DEPS = ['husky', '@commitlint/cli', '@abelspithost/commitlint'];
41
+
42
+ console.log(`Setting up commitlint with husky (using ${pm})...\n`);
43
+
44
+ step('install dependencies', () => {
45
+ run(installCommand(pm, DEPS));
46
+ });
47
+
48
+ step('initialize husky', () => {
49
+ let scriptBase;
50
+ switch (pm) {
51
+ case 'bun':
52
+ scriptBase = 'bunx';
53
+ break;
54
+ case 'pnpm':
55
+ scriptBase = 'pnpm exec';
56
+ break;
57
+ case 'yarn':
58
+ scriptBase = 'yarn run';
59
+ break;
60
+ default:
61
+ scriptBase = 'npx';
62
+ }
63
+ run(`${scriptBase} husky init`);
64
+ });
65
+
66
+ step('remove default pre-commit hook', () => {
67
+ const preCommit = '.husky/pre-commit';
68
+ if (existsSync(preCommit)) {
69
+ unlinkSync(preCommit);
70
+ }
71
+ });
72
+
73
+ step('create commit-msg hook', () => {
74
+ let runner;
75
+ switch (pm) {
76
+ case 'bun':
77
+ runner = 'bunx --bun';
78
+ break;
79
+ case 'pnpm':
80
+ runner = 'pnpm exec';
81
+ break;
82
+ case 'yarn':
83
+ runner = 'yarn run';
84
+ break;
85
+ default:
86
+ runner = 'npx --no --';
87
+ }
88
+ writeFileSync('.husky/commit-msg', `${runner} commitlint --edit $1\n`);
89
+ });
90
+
91
+ step('create commitlint config', () => {
92
+ if (existsSync('commitlint.config.ts')) {
93
+ console.log('\ncommitlint.config.ts already exists, skipping');
94
+ } else {
95
+ writeFileSync(
96
+ 'commitlint.config.ts',
97
+ "export { default } from '@abelspithost/commitlint';\n",
98
+ );
99
+ console.log('\nCreated commitlint.config.ts');
100
+ }
101
+ });
102
+
103
+ console.log('Done! Commitlint with husky is ready.');
@@ -0,0 +1,199 @@
1
+ import type { MockInstance } from 'vitest';
2
+
3
+
4
+ const mockExecSync = vi.fn();
5
+ const mockExistsSync = vi.fn<(path: string) => boolean>();
6
+ const mockUnlinkSync = vi.fn();
7
+ const mockWriteFileSync = vi.fn();
8
+
9
+ vi.mock('node:child_process', () => ({
10
+ execSync: mockExecSync,
11
+ }));
12
+
13
+ vi.mock('node:fs', () => ({
14
+ existsSync: mockExistsSync,
15
+ unlinkSync: mockUnlinkSync,
16
+ writeFileSync: mockWriteFileSync,
17
+ }));
18
+
19
+ async function runCli(): Promise<void> {
20
+ vi.resetModules();
21
+ // @ts-expect-error: CLI function in JavaScript
22
+ await import('./cli.mjs');
23
+ }
24
+
25
+ describe('cli.mjs', () => {
26
+ let exitSpy: MockInstance;
27
+
28
+ beforeEach(() => {
29
+ mockExecSync.mockReturnValue(Buffer.from(''));
30
+ mockExistsSync.mockReturnValue(false);
31
+ exitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined as never);
32
+ vi.spyOn(console, 'log').mockReturnValue(undefined);
33
+ vi.spyOn(console, 'error').mockReturnValue(undefined);
34
+ });
35
+
36
+ afterEach(() => {
37
+ vi.restoreAllMocks();
38
+ });
39
+
40
+ describe('install command', () => {
41
+ it('runs npm install --save-dev for npm', async () => {
42
+ await runCli();
43
+
44
+ expect(mockExecSync).toHaveBeenCalledWith(
45
+ expect.stringContaining('npm install --save-dev'),
46
+ expect.anything(),
47
+ );
48
+ });
49
+
50
+ it('runs pnpm add -D for pnpm', async () => {
51
+ mockExistsSync.mockImplementation((path: string) => path === 'pnpm-lock.yaml');
52
+
53
+ await runCli();
54
+
55
+ expect(mockExecSync).toHaveBeenCalledWith(
56
+ expect.stringContaining('pnpm add -D'),
57
+ expect.anything(),
58
+ );
59
+ });
60
+
61
+ it('runs yarn add -D for yarn', async () => {
62
+ mockExistsSync.mockImplementation((path: string) => path === 'yarn.lock');
63
+
64
+ await runCli();
65
+
66
+ expect(mockExecSync).toHaveBeenCalledWith(
67
+ expect.stringContaining('yarn add -D'),
68
+ expect.anything(),
69
+ );
70
+ });
71
+
72
+ it('runs bun add -D for bun', async () => {
73
+ mockExistsSync.mockImplementation((path: string) => path === 'bun.lockb');
74
+
75
+ await runCli();
76
+
77
+ expect(mockExecSync).toHaveBeenCalledWith(
78
+ expect.stringContaining('bun add -D'),
79
+ expect.anything(),
80
+ );
81
+ });
82
+ });
83
+
84
+ describe('husky initialization', () => {
85
+ it('runs npx husky init for npm', async () => {
86
+ await runCli();
87
+
88
+ expect(mockExecSync).toHaveBeenCalledWith(
89
+ 'npx husky init',
90
+ expect.anything(),
91
+ );
92
+ });
93
+
94
+ it('runs pnpm dlx husky init for pnpm', async () => {
95
+ mockExistsSync.mockImplementation((path: string) => path === 'pnpm-lock.yaml');
96
+
97
+ await runCli();
98
+
99
+ expect(mockExecSync).toHaveBeenCalledWith(
100
+ 'pnpm exec husky init',
101
+ expect.anything(),
102
+ );
103
+ });
104
+ });
105
+
106
+ describe('pre-commit hook removal', () => {
107
+ it('removes the default pre-commit hook when it exists', async () => {
108
+ mockExistsSync.mockImplementation((path: string) => path === '.husky/pre-commit');
109
+
110
+ await runCli();
111
+
112
+ expect(mockUnlinkSync).toHaveBeenCalledWith('.husky/pre-commit');
113
+ });
114
+
115
+ it('skips removal when pre-commit hook does not exist', async () => {
116
+ await runCli();
117
+
118
+ expect(mockUnlinkSync).not.toHaveBeenCalled();
119
+ });
120
+ });
121
+
122
+ describe('commit-msg hook', () => {
123
+ it('writes hook with npx runner for npm', async () => {
124
+ await runCli();
125
+
126
+ expect(mockWriteFileSync).toHaveBeenCalledWith(
127
+ '.husky/commit-msg',
128
+ 'npx --no -- commitlint --edit $1\n',
129
+ );
130
+ });
131
+
132
+ it('writes hook with pnpm exec runner for pnpm', async () => {
133
+ mockExistsSync.mockImplementation((path: string) => path === 'pnpm-lock.yaml');
134
+
135
+ await runCli();
136
+
137
+ expect(mockWriteFileSync).toHaveBeenCalledWith(
138
+ '.husky/commit-msg',
139
+ 'pnpm exec commitlint --edit $1\n',
140
+ );
141
+ });
142
+
143
+ it('writes hook with yarn run runner for yarn', async () => {
144
+ mockExistsSync.mockImplementation((path: string) => path === 'yarn.lock');
145
+
146
+ await runCli();
147
+
148
+ expect(mockWriteFileSync).toHaveBeenCalledWith(
149
+ '.husky/commit-msg',
150
+ 'yarn run commitlint --edit $1\n',
151
+ );
152
+ });
153
+
154
+ it('writes hook with bunx runner for bun', async () => {
155
+ mockExistsSync.mockImplementation((path: string) => path === 'bun.lockb');
156
+
157
+ await runCli();
158
+
159
+ expect(mockWriteFileSync).toHaveBeenCalledWith(
160
+ '.husky/commit-msg',
161
+ 'bunx --bun commitlint --edit $1\n',
162
+ );
163
+ });
164
+ });
165
+
166
+ describe('commitlint config', () => {
167
+ it('creates commitlint.config.ts with the expected export', async () => {
168
+ await runCli();
169
+
170
+ expect(mockWriteFileSync).toHaveBeenCalledWith(
171
+ 'commitlint.config.ts',
172
+ "export { default } from '@abelspithost/commitlint';\n",
173
+ );
174
+ });
175
+
176
+ it('skips commitlint.config.ts if it already exists', async () => {
177
+ mockExistsSync.mockImplementation((path: string) => path === 'commitlint.config.ts');
178
+
179
+ await runCli();
180
+
181
+ expect(mockWriteFileSync).not.toHaveBeenCalledWith(
182
+ 'commitlint.config.ts',
183
+ expect.anything(),
184
+ );
185
+ });
186
+ });
187
+
188
+ describe('error handling', () => {
189
+ it('calls process.exit(1) when a step fails', async () => {
190
+ mockExecSync.mockImplementation(() => {
191
+ throw new Error('command failed');
192
+ });
193
+
194
+ await runCli();
195
+
196
+ expect(exitSpy).toHaveBeenCalledWith(1);
197
+ });
198
+ });
199
+ });
@@ -0,0 +1,45 @@
1
+ import { type UserConfig } from '@commitlint/types';
2
+ /**
3
+ * Default commitlint configuration.
4
+ *
5
+ * Extends `@commitlint/config-conventional` with stricter defaults:
6
+ * - Scope is optional.
7
+ * - Allowed types are restricted to {@link COMMIT_TYPES}.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * // commitlint.config.ts
12
+ * export { default } from '@abelspithost/commitlint';
13
+ * ```
14
+ */
15
+ export declare const configuration: UserConfig;
16
+ /**
17
+ * Create a customized commitlint configuration.
18
+ *
19
+ * Starts from the same base as {@link configuration} (extends
20
+ * `@commitlint/config-conventional`, scope optional) and lets you
21
+ * restrict the allowed scopes and/or override the allowed types.
22
+ *
23
+ * @param options - Configuration options.
24
+ * @param options.scopes - Restrict commits to these scopes. When provided,
25
+ * a scope becomes **required** on every commit.
26
+ * @param options.types - Override the allowed commit types.
27
+ * Defaults to {@link COMMIT_TYPES}.
28
+ * @returns A `UserConfig` object ready to be exported from
29
+ * `commitlint.config.ts`.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // commitlint.config.ts
34
+ * import { createConfig } from '@abelspithost/commitlint';
35
+ *
36
+ * export default createConfig({
37
+ * scopes: ['api', 'ui', 'core'],
38
+ * });
39
+ * ```
40
+ */
41
+ export declare function createConfig({ scopes, types, }: {
42
+ scopes?: string[];
43
+ types?: string[];
44
+ }): UserConfig;
45
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AASxE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,UAK3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,KAAoB,GACrB,EAAG;IACF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,GAAG,UAAU,CAWb"}
@@ -0,0 +1,63 @@
1
+ import { RuleConfigSeverity } from '@commitlint/types';
2
+ import { COMMIT_TYPES } from '../constants/commitTypes.js';
3
+ const baseConfiguration = {
4
+ extends: ['@commitlint/config-conventional'],
5
+ formatter: '@commitlint/format',
6
+ };
7
+ /**
8
+ * Default commitlint configuration.
9
+ *
10
+ * Extends `@commitlint/config-conventional` with stricter defaults:
11
+ * - Scope is optional.
12
+ * - Allowed types are restricted to {@link COMMIT_TYPES}.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // commitlint.config.ts
17
+ * export { default } from '@abelspithost/commitlint';
18
+ * ```
19
+ */
20
+ export const configuration = {
21
+ ...baseConfiguration,
22
+ rules: {
23
+ 'type-enum': [RuleConfigSeverity.Error, 'always', COMMIT_TYPES],
24
+ },
25
+ };
26
+ /**
27
+ * Create a customized commitlint configuration.
28
+ *
29
+ * Starts from the same base as {@link configuration} (extends
30
+ * `@commitlint/config-conventional`, scope optional) and lets you
31
+ * restrict the allowed scopes and/or override the allowed types.
32
+ *
33
+ * @param options - Configuration options.
34
+ * @param options.scopes - Restrict commits to these scopes. When provided,
35
+ * a scope becomes **required** on every commit.
36
+ * @param options.types - Override the allowed commit types.
37
+ * Defaults to {@link COMMIT_TYPES}.
38
+ * @returns A `UserConfig` object ready to be exported from
39
+ * `commitlint.config.ts`.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // commitlint.config.ts
44
+ * import { createConfig } from '@abelspithost/commitlint';
45
+ *
46
+ * export default createConfig({
47
+ * scopes: ['api', 'ui', 'core'],
48
+ * });
49
+ * ```
50
+ */
51
+ export function createConfig({ scopes, types = COMMIT_TYPES, }) {
52
+ return {
53
+ ...baseConfiguration,
54
+ rules: {
55
+ ...(scopes && {
56
+ 'scope-empty': [RuleConfigSeverity.Error, 'never'],
57
+ 'scope-enum': [RuleConfigSeverity.Error, 'always', scopes],
58
+ }),
59
+ 'type-enum': [RuleConfigSeverity.Error, 'always', types],
60
+ },
61
+ };
62
+ }
63
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,iBAAiB,GAAe;IACpC,OAAO,EAAE,CAAC,iCAAiC,CAAC;IAC5C,SAAS,EAAE,oBAAoB;CAChC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAe;IACvC,GAAG,iBAAiB;IACpB,KAAK,EAAE;QACL,WAAW,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC;KAChE;CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,MAAM,EACN,KAAK,GAAG,YAAY,GAIrB;IACC,OAAO;QACL,GAAG,iBAAiB;QACpB,KAAK,EAAE;YACL,GAAG,CAAC,MAAM,IAAI;gBACZ,aAAa,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC;gBAClD,YAAY,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC;aAC3D,CAAC;YACF,WAAW,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC;SACzD;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The default set of allowed conventional commit types.
3
+ *
4
+ * Pass a custom array to {@link createConfig} to override.
5
+ */
6
+ export declare const COMMIT_TYPES: string[];
7
+ //# sourceMappingURL=commitTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commitTypes.d.ts","sourceRoot":"","sources":["../../src/constants/commitTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,YAAY,UAYxB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The default set of allowed conventional commit types.
3
+ *
4
+ * Pass a custom array to {@link createConfig} to override.
5
+ */
6
+ export const COMMIT_TYPES = [
7
+ 'build',
8
+ 'ci',
9
+ 'docs',
10
+ 'feat',
11
+ 'fix',
12
+ 'perf',
13
+ 'refactor',
14
+ 'revert',
15
+ 'test',
16
+ 'chore',
17
+ 'style',
18
+ ];
19
+ //# sourceMappingURL=commitTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commitTypes.js","sourceRoot":"","sources":["../../src/constants/commitTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO;IACP,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,UAAU;IACV,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;CACR,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { RuleConfigSeverity, type UserConfig } from '@commitlint/types';
2
+ export { COMMIT_TYPES } from './constants/commitTypes.js';
3
+ export { configuration, configuration as default, createConfig } from './config/config.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,aAAa,IAAI,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { RuleConfigSeverity } from '@commitlint/types';
2
+ export { COMMIT_TYPES } from './constants/commitTypes.js';
3
+ export { configuration, configuration as default, createConfig } from './config/config.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,aAAa,IAAI,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@abelspithost/commitlint",
3
+ "version": "0.0.1",
4
+ "description": "Shared commitlint preset extending @commitlint/config-conventional with stricter defaults",
5
+ "keywords": [
6
+ "commitlint",
7
+ "commitlint-config",
8
+ "conventional",
9
+ "commits",
10
+ "conventional-commits",
11
+ "husky",
12
+ "git-hooks"
13
+ ],
14
+ "homepage": "https://github.com/aspithost/commitlint#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/aspithost/commitlint.git"
18
+ },
19
+ "license": "ISC",
20
+ "author": {
21
+ "name": "Abel Spithost",
22
+ "url": "https://github.com/aspithost"
23
+ },
24
+ "engines": {
25
+ "node": ">=20"
26
+ },
27
+ "type": "module",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ }
33
+ },
34
+ "bin": {
35
+ "init": "./bin/cli.mjs"
36
+ },
37
+ "files": [
38
+ "bin",
39
+ "dist"
40
+ ],
41
+ "scripts": {
42
+ "build": "npm run clean && tsc -p tsconfig.build.json",
43
+ "clean": "rimraf dist",
44
+ "lint": "eslint .",
45
+ "test:unit": "vitest",
46
+ "test:cov": "vitest run --coverage --coverage.reporter=text",
47
+ "typecheck": "tsc --noEmit",
48
+ "prepare": "husky"
49
+ },
50
+ "dependencies": {
51
+ "@commitlint/config-conventional": "^20.4.1",
52
+ "@commitlint/format": "^20.4.0",
53
+ "@commitlint/types": "^20.4.0"
54
+ },
55
+ "devDependencies": {
56
+ "@abelspithost/eslint-config-ts": "^0.1.3",
57
+ "@abelspithost/tsconfig-node": "^0.0.4",
58
+ "@commitlint/cli": "^20.4.1",
59
+ "@types/node": "^24.10.11",
60
+ "@vitest/coverage-v8": "^4.0.18",
61
+ "commitlint": "^20.4.1",
62
+ "eslint": "^9.39.2",
63
+ "husky": "^9.1.7",
64
+ "jiti": "^2.6.1",
65
+ "rimraf": "^6.1.2",
66
+ "typescript": "^5.9.3",
67
+ "vitest": "^4.0.18"
68
+ }
69
+ }