@icebreakers/commitlint-config 4.0.1 → 4.0.3
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/dist/index.cjs +38 -13
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +33 -12
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
2
5
|
//#region \0rolldown/runtime.js
|
|
3
6
|
var __create = Object.create;
|
|
4
7
|
var __defProp = Object.defineProperty;
|
|
@@ -16,7 +19,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
19
|
}
|
|
17
20
|
return to;
|
|
18
21
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
23
|
value: mod,
|
|
21
24
|
enumerable: true
|
|
22
25
|
}) : target, mod));
|
|
@@ -107,8 +110,10 @@ function buildScopeRules(options) {
|
|
|
107
110
|
"always",
|
|
108
111
|
scopeValues
|
|
109
112
|
];
|
|
110
|
-
if (options.required !== void 0)
|
|
111
|
-
|
|
113
|
+
if (options.required !== void 0) {
|
|
114
|
+
if (options.required) rules["scope-empty"] = [severity, "never"];
|
|
115
|
+
else rules["scope-empty"] = [_commitlint_types.RuleConfigSeverity.Disabled];
|
|
116
|
+
}
|
|
112
117
|
const scopeCases = mergeUnique(asArray(options.case));
|
|
113
118
|
if (scopeCases.length > 0) rules["scope-case"] = [
|
|
114
119
|
severity,
|
|
@@ -126,14 +131,18 @@ function buildSubjectRules(options) {
|
|
|
126
131
|
options.caseCondition ?? "never",
|
|
127
132
|
forbiddenCases
|
|
128
133
|
];
|
|
129
|
-
if (options.allowEmpty !== void 0)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
options.
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
if (options.allowEmpty !== void 0) {
|
|
135
|
+
if (options.allowEmpty) rules["subject-empty"] = [_commitlint_types.RuleConfigSeverity.Disabled];
|
|
136
|
+
else rules["subject-empty"] = [options.allowEmptySeverity ?? _commitlint_types.RuleConfigSeverity.Error, "never"];
|
|
137
|
+
}
|
|
138
|
+
if (options.fullStop !== void 0) {
|
|
139
|
+
if (options.fullStop) rules["subject-full-stop"] = [
|
|
140
|
+
options.fullStopSeverity ?? _commitlint_types.RuleConfigSeverity.Error,
|
|
141
|
+
"always",
|
|
142
|
+
options.fullStopCharacter ?? "."
|
|
143
|
+
];
|
|
144
|
+
else rules["subject-full-stop"] = [_commitlint_types.RuleConfigSeverity.Disabled];
|
|
145
|
+
}
|
|
137
146
|
return rules;
|
|
138
147
|
}
|
|
139
148
|
function buildHeaderRules(options) {
|
|
@@ -151,6 +160,20 @@ function buildHeaderRules(options) {
|
|
|
151
160
|
//#endregion
|
|
152
161
|
//#region src/constants.ts
|
|
153
162
|
const DEFAULT_EXTENDS = [];
|
|
163
|
+
const DEFAULT_PARSER_PRESET = "conventional-changelog-conventionalcommits";
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/parser-preset.ts
|
|
166
|
+
async function loadConventionalParserOpts() {
|
|
167
|
+
const { default: createConventionalPreset } = await import("conventional-changelog-conventionalcommits");
|
|
168
|
+
return (await createConventionalPreset()).parser;
|
|
169
|
+
}
|
|
170
|
+
const conventionalParserOpts = loadConventionalParserOpts();
|
|
171
|
+
function createConventionalParserPreset() {
|
|
172
|
+
return {
|
|
173
|
+
name: DEFAULT_PARSER_PRESET,
|
|
174
|
+
parserOpts: conventionalParserOpts
|
|
175
|
+
};
|
|
176
|
+
}
|
|
154
177
|
//#endregion
|
|
155
178
|
//#region src/prompt.ts
|
|
156
179
|
function mergePrompts(base, override) {
|
|
@@ -190,7 +213,7 @@ function createIcebreakerCommitlintConfig(options = {}) {
|
|
|
190
213
|
const prompt = mergePrompts(typesConfig.prompt ?? _commitlint_config_conventional.default.prompt, options.prompt);
|
|
191
214
|
return {
|
|
192
215
|
...extendsList.length > 0 ? { extends: extendsList } : {},
|
|
193
|
-
parserPreset:
|
|
216
|
+
parserPreset: createConventionalParserPreset(),
|
|
194
217
|
...Object.keys(mergedRules).length > 0 ? { rules: mergedRules } : {},
|
|
195
218
|
...prompt ? { prompt } : {}
|
|
196
219
|
};
|
|
@@ -198,7 +221,9 @@ function createIcebreakerCommitlintConfig(options = {}) {
|
|
|
198
221
|
function icebreaker(options) {
|
|
199
222
|
return createIcebreakerCommitlintConfig(options);
|
|
200
223
|
}
|
|
224
|
+
var src_default = icebreaker();
|
|
201
225
|
//#endregion
|
|
202
226
|
exports.RuleConfigSeverity = _commitlint_types.RuleConfigSeverity;
|
|
203
227
|
exports.createIcebreakerCommitlintConfig = createIcebreakerCommitlintConfig;
|
|
228
|
+
exports.default = src_default;
|
|
204
229
|
exports.icebreaker = icebreaker;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RuleConfigCondition, RuleConfigSeverity, RulesConfig, TargetCaseType, UserConfig, UserConfig as UserConfig$1, UserPromptConfig } from "@commitlint/types";
|
|
2
|
-
|
|
3
2
|
//#region src/types.d.ts
|
|
4
3
|
interface CommitTypeDefinition {
|
|
5
4
|
value: string;
|
|
@@ -48,5 +47,6 @@ interface IcebreakerCommitlintOptions {
|
|
|
48
47
|
declare function createIcebreakerCommitlintConfig(options?: IcebreakerCommitlintOptions): UserConfig$1;
|
|
49
48
|
declare function icebreaker(options?: IcebreakerCommitlintOptions): UserConfig$1;
|
|
50
49
|
type IcebreakerCommitlintConfig = ReturnType<typeof icebreaker>;
|
|
50
|
+
declare const _default: UserConfig$1;
|
|
51
51
|
//#endregion
|
|
52
|
-
export { type CommitHeaderOptions, type CommitScopeOptions, type CommitSubjectOptions, type CommitTypeDefinition, type CommitTypesOptions, type UserConfig as CommitlintUserConfig, IcebreakerCommitlintConfig, type IcebreakerCommitlintOptions, RuleConfigSeverity, createIcebreakerCommitlintConfig, icebreaker };
|
|
52
|
+
export { type CommitHeaderOptions, type CommitScopeOptions, type CommitSubjectOptions, type CommitTypeDefinition, type CommitTypesOptions, type UserConfig as CommitlintUserConfig, IcebreakerCommitlintConfig, type IcebreakerCommitlintOptions, RuleConfigSeverity, createIcebreakerCommitlintConfig, _default as default, icebreaker };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RuleConfigCondition, RuleConfigSeverity, RulesConfig, TargetCaseType, UserConfig, UserConfig as UserConfig$1, UserPromptConfig } from "@commitlint/types";
|
|
2
|
-
|
|
3
2
|
//#region src/types.d.ts
|
|
4
3
|
interface CommitTypeDefinition {
|
|
5
4
|
value: string;
|
|
@@ -48,5 +47,6 @@ interface IcebreakerCommitlintOptions {
|
|
|
48
47
|
declare function createIcebreakerCommitlintConfig(options?: IcebreakerCommitlintOptions): UserConfig$1;
|
|
49
48
|
declare function icebreaker(options?: IcebreakerCommitlintOptions): UserConfig$1;
|
|
50
49
|
type IcebreakerCommitlintConfig = ReturnType<typeof icebreaker>;
|
|
50
|
+
declare const _default: UserConfig$1;
|
|
51
51
|
//#endregion
|
|
52
|
-
export { type CommitHeaderOptions, type CommitScopeOptions, type CommitSubjectOptions, type CommitTypeDefinition, type CommitTypesOptions, type UserConfig as CommitlintUserConfig, IcebreakerCommitlintConfig, type IcebreakerCommitlintOptions, RuleConfigSeverity, createIcebreakerCommitlintConfig, icebreaker };
|
|
52
|
+
export { type CommitHeaderOptions, type CommitScopeOptions, type CommitSubjectOptions, type CommitTypeDefinition, type CommitTypesOptions, type UserConfig as CommitlintUserConfig, IcebreakerCommitlintConfig, type IcebreakerCommitlintOptions, RuleConfigSeverity, createIcebreakerCommitlintConfig, _default as default, icebreaker };
|
package/dist/index.js
CHANGED
|
@@ -83,8 +83,10 @@ function buildScopeRules(options) {
|
|
|
83
83
|
"always",
|
|
84
84
|
scopeValues
|
|
85
85
|
];
|
|
86
|
-
if (options.required !== void 0)
|
|
87
|
-
|
|
86
|
+
if (options.required !== void 0) {
|
|
87
|
+
if (options.required) rules["scope-empty"] = [severity, "never"];
|
|
88
|
+
else rules["scope-empty"] = [RuleConfigSeverity.Disabled];
|
|
89
|
+
}
|
|
88
90
|
const scopeCases = mergeUnique(asArray(options.case));
|
|
89
91
|
if (scopeCases.length > 0) rules["scope-case"] = [
|
|
90
92
|
severity,
|
|
@@ -102,14 +104,18 @@ function buildSubjectRules(options) {
|
|
|
102
104
|
options.caseCondition ?? "never",
|
|
103
105
|
forbiddenCases
|
|
104
106
|
];
|
|
105
|
-
if (options.allowEmpty !== void 0)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
options.
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
if (options.allowEmpty !== void 0) {
|
|
108
|
+
if (options.allowEmpty) rules["subject-empty"] = [RuleConfigSeverity.Disabled];
|
|
109
|
+
else rules["subject-empty"] = [options.allowEmptySeverity ?? RuleConfigSeverity.Error, "never"];
|
|
110
|
+
}
|
|
111
|
+
if (options.fullStop !== void 0) {
|
|
112
|
+
if (options.fullStop) rules["subject-full-stop"] = [
|
|
113
|
+
options.fullStopSeverity ?? RuleConfigSeverity.Error,
|
|
114
|
+
"always",
|
|
115
|
+
options.fullStopCharacter ?? "."
|
|
116
|
+
];
|
|
117
|
+
else rules["subject-full-stop"] = [RuleConfigSeverity.Disabled];
|
|
118
|
+
}
|
|
113
119
|
return rules;
|
|
114
120
|
}
|
|
115
121
|
function buildHeaderRules(options) {
|
|
@@ -127,6 +133,20 @@ function buildHeaderRules(options) {
|
|
|
127
133
|
//#endregion
|
|
128
134
|
//#region src/constants.ts
|
|
129
135
|
const DEFAULT_EXTENDS = [];
|
|
136
|
+
const DEFAULT_PARSER_PRESET = "conventional-changelog-conventionalcommits";
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/parser-preset.ts
|
|
139
|
+
async function loadConventionalParserOpts() {
|
|
140
|
+
const { default: createConventionalPreset } = await import("conventional-changelog-conventionalcommits");
|
|
141
|
+
return (await createConventionalPreset()).parser;
|
|
142
|
+
}
|
|
143
|
+
const conventionalParserOpts = loadConventionalParserOpts();
|
|
144
|
+
function createConventionalParserPreset() {
|
|
145
|
+
return {
|
|
146
|
+
name: DEFAULT_PARSER_PRESET,
|
|
147
|
+
parserOpts: conventionalParserOpts
|
|
148
|
+
};
|
|
149
|
+
}
|
|
130
150
|
//#endregion
|
|
131
151
|
//#region src/prompt.ts
|
|
132
152
|
function mergePrompts(base, override) {
|
|
@@ -166,7 +186,7 @@ function createIcebreakerCommitlintConfig(options = {}) {
|
|
|
166
186
|
const prompt = mergePrompts(typesConfig.prompt ?? conventionalConfig.prompt, options.prompt);
|
|
167
187
|
return {
|
|
168
188
|
...extendsList.length > 0 ? { extends: extendsList } : {},
|
|
169
|
-
parserPreset:
|
|
189
|
+
parserPreset: createConventionalParserPreset(),
|
|
170
190
|
...Object.keys(mergedRules).length > 0 ? { rules: mergedRules } : {},
|
|
171
191
|
...prompt ? { prompt } : {}
|
|
172
192
|
};
|
|
@@ -174,5 +194,6 @@ function createIcebreakerCommitlintConfig(options = {}) {
|
|
|
174
194
|
function icebreaker(options) {
|
|
175
195
|
return createIcebreakerCommitlintConfig(options);
|
|
176
196
|
}
|
|
197
|
+
var src_default = icebreaker();
|
|
177
198
|
//#endregion
|
|
178
|
-
export { RuleConfigSeverity, createIcebreakerCommitlintConfig, icebreaker };
|
|
199
|
+
export { RuleConfigSeverity, createIcebreakerCommitlintConfig, src_default as default, icebreaker };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/commitlint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.3",
|
|
5
5
|
"description": "Commitlint preset from Icebreaker's dev-configs",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -52,7 +52,11 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@commitlint/config-conventional": "^21.2.0",
|
|
54
54
|
"@commitlint/types": "^21.2.0",
|
|
55
|
-
"conventional-changelog-conventionalcommits": "^10.
|
|
55
|
+
"conventional-changelog-conventionalcommits": "^10.3.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@commitlint/lint": "^21.2.0",
|
|
59
|
+
"@commitlint/load": "^21.2.0"
|
|
56
60
|
},
|
|
57
61
|
"scripts": {
|
|
58
62
|
"dev": "tsdown --watch --sourcemap",
|