@icebreakers/commitlint-config 1.2.0 → 1.2.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/dist/index.cjs CHANGED
@@ -1,6 +1,9 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/builders.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/index.ts
2
2
  var _configconventional = require('@commitlint/config-conventional'); var _configconventional2 = _interopRequireDefault(_configconventional);
3
3
 
4
+ // src/builders.ts
5
+
6
+
4
7
  // src/types.ts
5
8
  var _types = require('@commitlint/types');
6
9
 
@@ -164,7 +167,7 @@ function buildHeaderRules(options) {
164
167
  }
165
168
 
166
169
  // src/constants.ts
167
- var DEFAULT_EXTENDS = ["@commitlint/config-conventional"];
170
+ var DEFAULT_EXTENDS = [];
168
171
  var DEFAULT_PARSER_PRESET = "conventional-changelog-conventionalcommits";
169
172
 
170
173
  // src/prompt.ts
@@ -193,9 +196,13 @@ function createIcebreakerCommitlintConfig(options = {}) {
193
196
  const { types, scopes, subject, header } = options;
194
197
  const extendsList = mergeUnique([
195
198
  ...DEFAULT_EXTENDS,
196
- ...mergeUnique(_nullishCoalesce(options.extends, () => ( [])))
199
+ ...asArray(
200
+ _configconventional2.default.extends
201
+ ),
202
+ ...asArray(options.extends)
197
203
  ]);
198
204
  const rules = {
205
+ ..._nullishCoalesce(_configconventional2.default.rules, () => ( {})),
199
206
  ...buildScopeRules(scopes),
200
207
  ...buildSubjectRules(subject),
201
208
  ...buildHeaderRules(header)
@@ -208,10 +215,11 @@ function createIcebreakerCommitlintConfig(options = {}) {
208
215
  ...rules,
209
216
  ..._nullishCoalesce(options.rules, () => ( {}))
210
217
  };
211
- const prompt = mergePrompts(typesConfig.prompt, options.prompt);
218
+ const promptBase = _nullishCoalesce(typesConfig.prompt, () => ( _configconventional2.default.prompt));
219
+ const prompt = mergePrompts(promptBase, options.prompt);
212
220
  return {
213
- extends: extendsList,
214
- parserPreset: DEFAULT_PARSER_PRESET,
221
+ ...extendsList.length > 0 ? { extends: extendsList } : {},
222
+ parserPreset: _nullishCoalesce(_configconventional2.default.parserPreset, () => ( DEFAULT_PARSER_PRESET)),
215
223
  ...Object.keys(mergedRules).length > 0 ? { rules: mergedRules } : {},
216
224
  ...prompt ? { prompt } : {}
217
225
  };
package/dist/index.mjs CHANGED
@@ -1,3 +1,6 @@
1
+ // src/index.ts
2
+ import conventionalConfig2 from "@commitlint/config-conventional";
3
+
1
4
  // src/builders.ts
2
5
  import conventionalConfig from "@commitlint/config-conventional";
3
6
 
@@ -164,7 +167,7 @@ function buildHeaderRules(options) {
164
167
  }
165
168
 
166
169
  // src/constants.ts
167
- var DEFAULT_EXTENDS = ["@commitlint/config-conventional"];
170
+ var DEFAULT_EXTENDS = [];
168
171
  var DEFAULT_PARSER_PRESET = "conventional-changelog-conventionalcommits";
169
172
 
170
173
  // src/prompt.ts
@@ -193,9 +196,13 @@ function createIcebreakerCommitlintConfig(options = {}) {
193
196
  const { types, scopes, subject, header } = options;
194
197
  const extendsList = mergeUnique([
195
198
  ...DEFAULT_EXTENDS,
196
- ...mergeUnique(options.extends ?? [])
199
+ ...asArray(
200
+ conventionalConfig2.extends
201
+ ),
202
+ ...asArray(options.extends)
197
203
  ]);
198
204
  const rules = {
205
+ ...conventionalConfig2.rules ?? {},
199
206
  ...buildScopeRules(scopes),
200
207
  ...buildSubjectRules(subject),
201
208
  ...buildHeaderRules(header)
@@ -208,10 +215,11 @@ function createIcebreakerCommitlintConfig(options = {}) {
208
215
  ...rules,
209
216
  ...options.rules ?? {}
210
217
  };
211
- const prompt = mergePrompts(typesConfig.prompt, options.prompt);
218
+ const promptBase = typesConfig.prompt ?? conventionalConfig2.prompt;
219
+ const prompt = mergePrompts(promptBase, options.prompt);
212
220
  return {
213
- extends: extendsList,
214
- parserPreset: DEFAULT_PARSER_PRESET,
221
+ ...extendsList.length > 0 ? { extends: extendsList } : {},
222
+ parserPreset: conventionalConfig2.parserPreset ?? DEFAULT_PARSER_PRESET,
215
223
  ...Object.keys(mergedRules).length > 0 ? { rules: mergedRules } : {},
216
224
  ...prompt ? { prompt } : {}
217
225
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@icebreakers/commitlint-config",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "description": "icebreaker's commitlint config",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",