@pubinfo-pr/commitlint 0.189.2 → 0.197.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/bin/commit.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { runMain } from '../dist/run.js';
2
+ import { runMain } from '../dist/run.mjs';
3
3
 
4
4
  runMain();
@@ -0,0 +1,199 @@
1
+ import { Commit } from "conventional-commits-parser";
2
+
3
+ //#region ../../node_modules/.pnpm/@commitlint+types@20.3.1/node_modules/@commitlint/types/lib/ensure.d.ts
4
+ type TargetCaseType = "camel-case" | "kebab-case" | "snake-case" | "pascal-case" | "start-case" | "upper-case" | "uppercase" | "sentence-case" | "sentencecase" | "lower-case" | "lowercase" | "lowerCase";
5
+ //#endregion
6
+ //#region ../../node_modules/.pnpm/@commitlint+types@20.3.1/node_modules/@commitlint/types/lib/prompt.d.ts
7
+ type RuleField = "header" | "type" | "scope" | "subject" | "body" | "footer";
8
+ type PromptName = RuleField | "isBreaking" | "breakingBody" | "breaking" | "isIssueAffected" | "issuesBody" | "issues";
9
+ type PromptConfig = {
10
+ settings: {
11
+ scopeEnumSeparator: string;
12
+ enableMultipleScopes: boolean;
13
+ };
14
+ messages: PromptMessages;
15
+ questions: Partial<Record<PromptName, {
16
+ description?: string;
17
+ messages?: {
18
+ [K: string]: string;
19
+ };
20
+ enum?: {
21
+ [enumName: string]: {
22
+ description?: string;
23
+ title?: string;
24
+ emoji?: string;
25
+ };
26
+ };
27
+ emojiInHeader?: boolean;
28
+ }>>;
29
+ };
30
+ type PromptMessages = {
31
+ skip: string;
32
+ max: string;
33
+ min: string;
34
+ emptyWarning: string;
35
+ upperLimitWarning: string;
36
+ lowerLimitWarning: string;
37
+ [_key: string]: string;
38
+ };
39
+ type UserPromptConfig = DeepPartial<PromptConfig>;
40
+ type DeepPartial<T> = { [P in keyof T]?: { [K in keyof T[P]]?: T[P][K] } };
41
+ //#endregion
42
+ //#region ../../node_modules/.pnpm/@commitlint+types@20.3.1/node_modules/@commitlint/types/lib/rules.d.ts
43
+ /**
44
+ * Rules match the input either as successful or failed.
45
+ * For example, when `header-full-stop` detects a full stop and is set as "always"; it's true.
46
+ * If the `header-full-stop` discovers a full stop but is set to "never"; it's false.
47
+ */
48
+ type RuleOutcome = Readonly<[boolean, string?]>;
49
+ /**
50
+ * Rules receive a parsed commit, condition, and possible additional settings through value.
51
+ * All rules should provide the most sensible rule condition and value.
52
+ */
53
+ type RuleType = "async" | "sync" | "either";
54
+ type BaseRule<Value = never, Type extends RuleType = "either"> = (parsed: Commit, when?: RuleConfigCondition, value?: Value) => Type extends "either" ? RuleOutcome | Promise<RuleOutcome> : Type extends "async" ? Promise<RuleOutcome> : Type extends "sync" ? RuleOutcome : never;
55
+ type Rule<Value = never> = BaseRule<Value, "either">;
56
+ type AsyncRule<Value = never> = BaseRule<Value, "async">;
57
+ type SyncRule<Value = never> = BaseRule<Value, "sync">;
58
+ /**
59
+ * Rules always have a severity.
60
+ * Severity indicates what to do if the rule is found to be broken
61
+ * 0 - Disable this rule
62
+ * 1 - Warn for violations
63
+ * 2 - Error for violations
64
+ */
65
+ declare enum RuleConfigSeverity {
66
+ Disabled = 0,
67
+ Warning = 1,
68
+ Error = 2,
69
+ }
70
+ /**
71
+ * Rules always have a condition.
72
+ * It can be either "always" (as tested), or "never" (as tested).
73
+ * For example, `header-full-stop` can be enforced as "always" or "never".
74
+ */
75
+ type RuleConfigCondition = "always" | "never";
76
+ type RuleConfigTuple<T> = T extends void ? Readonly<[RuleConfigSeverity.Disabled]> | Readonly<[RuleConfigSeverity, RuleConfigCondition]> : Readonly<[RuleConfigSeverity.Disabled]> | Readonly<[RuleConfigSeverity, RuleConfigCondition, T]>;
77
+ declare enum RuleConfigQuality {
78
+ User = 0,
79
+ Qualified = 1,
80
+ }
81
+ type QualifiedRuleConfig<T> = (() => RuleConfigTuple<T>) | (() => Promise<RuleConfigTuple<T>>) | RuleConfigTuple<T>;
82
+ type RuleConfig<V = RuleConfigQuality.Qualified, T = void> = V extends RuleConfigQuality.Qualified ? RuleConfigTuple<T> : QualifiedRuleConfig<T>;
83
+ type CaseRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, TargetCaseType | TargetCaseType[]>;
84
+ type LengthRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, number>;
85
+ type EnumRuleConfig<V = RuleConfigQuality.User> = RuleConfig<V, string[]>;
86
+ type ObjectRuleConfig<V = RuleConfigQuality.User, T = Record<string, unknown>> = RuleConfig<V, T>;
87
+ type RulesConfig<V = RuleConfigQuality.User> = {
88
+ "body-case": CaseRuleConfig<V>;
89
+ "body-empty": RuleConfig<V>;
90
+ "body-full-stop": RuleConfig<V, string>;
91
+ "body-leading-blank": RuleConfig<V>;
92
+ "body-max-length": LengthRuleConfig<V>;
93
+ "body-max-line-length": LengthRuleConfig<V>;
94
+ "body-min-length": LengthRuleConfig<V>;
95
+ "breaking-change-exclamation-mark": CaseRuleConfig<V>;
96
+ "footer-empty": RuleConfig<V>;
97
+ "footer-leading-blank": RuleConfig<V>;
98
+ "footer-max-length": LengthRuleConfig<V>;
99
+ "footer-max-line-length": LengthRuleConfig<V>;
100
+ "footer-min-length": LengthRuleConfig<V>;
101
+ "header-case": CaseRuleConfig<V>;
102
+ "header-full-stop": RuleConfig<V, string>;
103
+ "header-max-length": LengthRuleConfig<V>;
104
+ "header-min-length": LengthRuleConfig<V>;
105
+ "header-trim": RuleConfig<V>;
106
+ "references-empty": RuleConfig<V>;
107
+ "scope-case": CaseRuleConfig<V> | ObjectRuleConfig<V, {
108
+ cases: TargetCaseType[];
109
+ delimiters?: string[];
110
+ }>;
111
+ "scope-delimiter-style": EnumRuleConfig<V>;
112
+ "scope-empty": RuleConfig<V>;
113
+ "scope-enum": EnumRuleConfig<V> | ObjectRuleConfig<V, {
114
+ scopes: string[];
115
+ delimiters?: string[];
116
+ }>;
117
+ "scope-max-length": LengthRuleConfig<V>;
118
+ "scope-min-length": LengthRuleConfig<V>;
119
+ "signed-off-by": RuleConfig<V, string>;
120
+ "subject-case": CaseRuleConfig<V>;
121
+ "subject-empty": RuleConfig<V>;
122
+ "subject-full-stop": RuleConfig<V, string>;
123
+ "subject-max-length": LengthRuleConfig<V>;
124
+ "subject-min-length": LengthRuleConfig<V>;
125
+ "trailer-exists": RuleConfig<V, string>;
126
+ "type-case": CaseRuleConfig<V>;
127
+ "type-empty": RuleConfig<V>;
128
+ "type-enum": EnumRuleConfig<V>;
129
+ "type-max-length": LengthRuleConfig<V>;
130
+ "type-min-length": LengthRuleConfig<V>;
131
+ [key: string]: AnyRuleConfig<V>;
132
+ };
133
+ type AnyRuleConfig<V> = RuleConfig<V, unknown> | RuleConfig<V, void>;
134
+ //#endregion
135
+ //#region ../../node_modules/.pnpm/@commitlint+types@20.3.1/node_modules/@commitlint/types/lib/load.d.ts
136
+ interface Plugin {
137
+ rules: {
138
+ [ruleName: string]: Rule | AsyncRule | SyncRule;
139
+ };
140
+ }
141
+ interface UserConfig {
142
+ extends?: string | string[];
143
+ formatter?: string;
144
+ rules?: Partial<RulesConfig>;
145
+ parserPreset?: string | ParserPreset | Promise<ParserPreset>;
146
+ ignores?: ((commit: string) => boolean)[];
147
+ defaultIgnores?: boolean;
148
+ plugins?: (string | Plugin)[];
149
+ helpUrl?: string;
150
+ prompt?: UserPromptConfig;
151
+ [key: string]: unknown;
152
+ }
153
+ interface ParserPreset {
154
+ name?: string;
155
+ path?: string;
156
+ parserOpts?: unknown;
157
+ }
158
+ //#endregion
159
+ //#region src/config/index.d.ts
160
+ declare const commitPreset: UserConfig & {
161
+ prompt?: any;
162
+ };
163
+ declare function loadCommitConfig(): UserConfig & {
164
+ prompt?: any;
165
+ };
166
+ //#endregion
167
+ //#region src/config/commitlint.d.ts
168
+ declare function isCommitlintEnabled(): Promise<boolean>;
169
+ //#endregion
170
+ //#region src/init/cz.config.d.ts
171
+ declare function createCzConfig(cwd?: string): boolean;
172
+ declare function runCzConfig(czConfigPath: string, cwd?: string): boolean;
173
+ //#endregion
174
+ //#region src/init/git.message.d.ts
175
+ declare function createGitMessage(rootPath?: string): boolean;
176
+ declare function runGitMessage(rootPath?: string): boolean;
177
+ //#endregion
178
+ //#region src/init/simple.git.hook.d.ts
179
+ declare function runSimpleGitHooks(script?: string, cwd?: string, enabled?: boolean): boolean;
180
+ declare function runNpx(cwd?: string): boolean;
181
+ declare function configureGitHooksPath(enabled?: boolean, cwd?: string): boolean;
182
+ //#endregion
183
+ //#region src/prompt/index.d.ts
184
+ interface PromptResult {
185
+ raw: string;
186
+ }
187
+ declare function runPrompt(): Promise<PromptResult | null>;
188
+ //#endregion
189
+ //#region src/utils/git.d.ts
190
+ /**
191
+ * 判断当前工作目录是否处在 Git 仓库内。
192
+ */
193
+ declare function isInsideGitRepo(): boolean;
194
+ //#endregion
195
+ //#region src/utils/lint.message.d.ts
196
+ declare function lintMessage(message: string): Promise<boolean>;
197
+ declare function lintAndReturn(message: string): Promise<string>;
198
+ //#endregion
199
+ export { commitPreset, configureGitHooksPath, createCzConfig, createGitMessage, isCommitlintEnabled, isInsideGitRepo, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };
@@ -1,3 +1,3 @@
1
- import { a as configureGitHooksPath, c as createGitMessage, d as runCzConfig, f as isCommitlintEnabled, i as runPrompt, l as runGitMessage, m as loadCommitConfig, n as lintMessage, o as runNpx, p as commitPreset, r as isInsideGitRepo, s as runSimpleGitHooks, t as lintAndReturn, u as createCzConfig } from "./lint.message.js";
1
+ import { a as configureGitHooksPath, c as createGitMessage, d as runCzConfig, f as isCommitlintEnabled, i as runPrompt, l as runGitMessage, m as loadCommitConfig, n as lintMessage, o as runNpx, p as commitPreset, r as isInsideGitRepo, s as runSimpleGitHooks, t as lintAndReturn, u as createCzConfig } from "./lint.message.mjs";
2
2
 
3
3
  export { commitPreset, configureGitHooksPath, createCzConfig, createGitMessage, isCommitlintEnabled, isInsideGitRepo, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };
@@ -1,4 +1,4 @@
1
- import { a as configureGitHooksPath, c as createGitMessage, d as runCzConfig, f as isCommitlintEnabled, i as runPrompt, l as runGitMessage, n as lintMessage, o as runNpx, r as isInsideGitRepo, s as runSimpleGitHooks, u as createCzConfig } from "./lint.message.js";
1
+ import { a as configureGitHooksPath, c as createGitMessage, d as runCzConfig, f as isCommitlintEnabled, i as runPrompt, l as runGitMessage, n as lintMessage, o as runNpx, r as isInsideGitRepo, s as runSimpleGitHooks, u as createCzConfig } from "./lint.message.mjs";
2
2
  import { spawnSync } from "node:child_process";
3
3
  import process from "node:process";
4
4
  import fs from "node:fs";
@@ -6,7 +6,7 @@ import { defineCommand, runMain as runMain$1 } from "citty";
6
6
 
7
7
  //#region package.json
8
8
  var name = "@pubinfo-pr/commitlint";
9
- var version = "2.1.5";
9
+ var version = "2.1.8";
10
10
  var description = "commitlint config for Pubinfo projects";
11
11
 
12
12
  //#endregion
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@pubinfo-pr/commitlint",
3
3
  "type": "module",
4
- "version": "0.189.2",
4
+ "version": "0.197.1",
5
5
  "description": "commitlint config for Pubinfo projects",
6
6
  "exports": {
7
- ".": "./dist/index.js"
7
+ ".": "./dist/index.mjs"
8
8
  },
9
- "main": "./dist/index.js",
10
- "module": "./dist/index.js",
11
- "types": "./dist/index.d.ts",
9
+ "main": "./dist/index.mjs",
10
+ "module": "./dist/index.mjs",
11
+ "types": "./dist/index.d.mts",
12
12
  "typesVersions": {
13
13
  "*": {
14
14
  "*": [
@@ -28,13 +28,13 @@
28
28
  "node": "^20.19.0 || >=22.12.0"
29
29
  },
30
30
  "dependencies": {
31
- "@commitlint/config-conventional": "^19.8.1",
32
- "@commitlint/lint": "^19.8.1",
33
- "@commitlint/load": "^19.8.1",
31
+ "@commitlint/config-conventional": "^20.3.1",
32
+ "@commitlint/lint": "^20.3.1",
33
+ "@commitlint/load": "^20.3.1",
34
34
  "citty": "^0.1.6",
35
35
  "czg": "^1.12.0",
36
- "fs-extra": "^11.3.0",
37
- "unconfig": "^7.3.3"
36
+ "fs-extra": "^11.3.3",
37
+ "unconfig": "^7.4.2"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsdown",
package/dist/index.d.ts DELETED
@@ -1,43 +0,0 @@
1
- import { UserConfig } from "@commitlint/types";
2
-
3
- //#region src/config/index.d.ts
4
- declare const commitPreset: UserConfig & {
5
- prompt?: any;
6
- };
7
- declare function loadCommitConfig(): UserConfig & {
8
- prompt?: any;
9
- };
10
- //#endregion
11
- //#region src/config/commitlint.d.ts
12
- declare function isCommitlintEnabled(): Promise<boolean>;
13
- //#endregion
14
- //#region src/init/cz.config.d.ts
15
- declare function createCzConfig(cwd?: string): boolean;
16
- declare function runCzConfig(czConfigPath: string, cwd?: string): boolean;
17
- //#endregion
18
- //#region src/init/git.message.d.ts
19
- declare function createGitMessage(rootPath?: string): boolean;
20
- declare function runGitMessage(rootPath?: string): boolean;
21
- //#endregion
22
- //#region src/init/simple.git.hook.d.ts
23
- declare function runSimpleGitHooks(script?: string, cwd?: string, enabled?: boolean): boolean;
24
- declare function runNpx(cwd?: string): boolean;
25
- declare function configureGitHooksPath(enabled?: boolean, cwd?: string): boolean;
26
- //#endregion
27
- //#region src/prompt/index.d.ts
28
- interface PromptResult {
29
- raw: string;
30
- }
31
- declare function runPrompt(): Promise<PromptResult | null>;
32
- //#endregion
33
- //#region src/utils/git.d.ts
34
- /**
35
- * 判断当前工作目录是否处在 Git 仓库内。
36
- */
37
- declare function isInsideGitRepo(): boolean;
38
- //#endregion
39
- //#region src/utils/lint.message.d.ts
40
- declare function lintMessage(message: string): Promise<boolean>;
41
- declare function lintAndReturn(message: string): Promise<string>;
42
- //#endregion
43
- export { commitPreset, configureGitHooksPath, createCzConfig, createGitMessage, isCommitlintEnabled, isInsideGitRepo, lintAndReturn, lintMessage, loadCommitConfig, runCzConfig, runGitMessage, runNpx, runPrompt, runSimpleGitHooks };
File without changes
File without changes