@forsakringskassan/commitlint-config 1.2.1 → 1.3.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.md +24 -0
- package/bin/commitlint.js +3 -0
- package/bin/install.js +2 -1
- package/dist/commitlint.js +272186 -0
- package/dist/commitlint.schema.json +105 -0
- package/dist/config/default.js +160 -143
- package/dist/config/no-jira.js +154 -132
- package/dist/format.js +521 -1623
- package/dist/install.js +52 -24
- package/dist/parser.js +178 -151
- package/package.json +7 -13
- package/bin/cli.js +0 -2
- package/dist/cli/commitlint.js +0 -40729
- package/dist/cli/templates/commit.hbs +0 -61
- package/dist/cli/templates/footer.hbs +0 -11
- package/dist/cli/templates/header.hbs +0 -25
- package/dist/cli/templates/template.hbs +0 -16
- /package/dist/{config/templates → templates}/commit.hbs +0 -0
- /package/dist/{config/templates → templates}/footer.hbs +0 -0
- /package/dist/{config/templates → templates}/header.hbs +0 -0
- /package/dist/{config/templates → templates}/template.hbs +0 -0
package/dist/install.js
CHANGED
|
@@ -1,13 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { dirname as _$_dirname } from "node:path";
|
|
3
|
+
import { createRequire as _$_createRequire } from "node:module";
|
|
4
|
+
import { fileURLToPath as _$_fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const require = _$_createRequire(import.meta.url);
|
|
7
|
+
const __dirname = _$_dirname(_$_fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
15
|
var __commonJS = (cb, mod) => function __require() {
|
|
4
16
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
17
|
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
6
34
|
|
|
7
35
|
// node_modules/ci-info/vendors.json
|
|
8
36
|
var require_vendors = __commonJS({
|
|
9
|
-
"node_modules/ci-info/vendors.json"(
|
|
10
|
-
|
|
37
|
+
"node_modules/ci-info/vendors.json"(exports, module) {
|
|
38
|
+
module.exports = [
|
|
11
39
|
{
|
|
12
40
|
name: "AppVeyor",
|
|
13
41
|
constant: "APPVEYOR",
|
|
@@ -217,50 +245,50 @@ var require_vendors = __commonJS({
|
|
|
217
245
|
|
|
218
246
|
// node_modules/ci-info/index.js
|
|
219
247
|
var require_ci_info = __commonJS({
|
|
220
|
-
"node_modules/ci-info/index.js"(
|
|
248
|
+
"node_modules/ci-info/index.js"(exports) {
|
|
221
249
|
"use strict";
|
|
222
250
|
var vendors = require_vendors();
|
|
223
251
|
var env = process.env;
|
|
224
|
-
Object.defineProperty(
|
|
252
|
+
Object.defineProperty(exports, "_vendors", {
|
|
225
253
|
value: vendors.map(function(v) {
|
|
226
254
|
return v.constant;
|
|
227
255
|
})
|
|
228
256
|
});
|
|
229
|
-
|
|
230
|
-
|
|
257
|
+
exports.name = null;
|
|
258
|
+
exports.isPR = null;
|
|
231
259
|
vendors.forEach(function(vendor) {
|
|
232
260
|
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
233
261
|
const isCI2 = envs.every(function(obj) {
|
|
234
262
|
return checkEnv(obj);
|
|
235
263
|
});
|
|
236
|
-
|
|
264
|
+
exports[vendor.constant] = isCI2;
|
|
237
265
|
if (isCI2) {
|
|
238
|
-
|
|
266
|
+
exports.name = vendor.name;
|
|
239
267
|
switch (typeof vendor.pr) {
|
|
240
268
|
case "string":
|
|
241
|
-
|
|
269
|
+
exports.isPR = !!env[vendor.pr];
|
|
242
270
|
break;
|
|
243
271
|
case "object":
|
|
244
272
|
if ("env" in vendor.pr) {
|
|
245
|
-
|
|
273
|
+
exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
|
|
246
274
|
} else if ("any" in vendor.pr) {
|
|
247
|
-
|
|
275
|
+
exports.isPR = vendor.pr.any.some(function(key) {
|
|
248
276
|
return !!env[key];
|
|
249
277
|
});
|
|
250
278
|
} else {
|
|
251
|
-
|
|
279
|
+
exports.isPR = checkEnv(vendor.pr);
|
|
252
280
|
}
|
|
253
281
|
break;
|
|
254
282
|
default:
|
|
255
|
-
|
|
283
|
+
exports.isPR = null;
|
|
256
284
|
}
|
|
257
285
|
}
|
|
258
286
|
});
|
|
259
|
-
|
|
287
|
+
exports.isCI = !!(env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
|
|
260
288
|
env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
|
|
261
289
|
env.BUILD_NUMBER || // Jenkins, TeamCity
|
|
262
290
|
env.RUN_ID || // TaskCluster, dsari
|
|
263
|
-
|
|
291
|
+
exports.name || false);
|
|
264
292
|
function checkEnv(obj) {
|
|
265
293
|
if (typeof obj === "string")
|
|
266
294
|
return !!env[obj];
|
|
@@ -273,17 +301,17 @@ var require_ci_info = __commonJS({
|
|
|
273
301
|
|
|
274
302
|
// node_modules/is-ci/index.js
|
|
275
303
|
var require_is_ci = __commonJS({
|
|
276
|
-
"node_modules/is-ci/index.js"(
|
|
304
|
+
"node_modules/is-ci/index.js"(exports, module) {
|
|
277
305
|
"use strict";
|
|
278
|
-
|
|
306
|
+
module.exports = require_ci_info().isCI;
|
|
279
307
|
}
|
|
280
308
|
});
|
|
281
309
|
|
|
282
|
-
// src/install.
|
|
283
|
-
var
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
310
|
+
// src/install.ts
|
|
311
|
+
var import_is_ci = __toESM(require_is_ci(), 1);
|
|
312
|
+
import fs from "node:fs";
|
|
313
|
+
import path from "node:path";
|
|
314
|
+
import { spawnSync } from "node:child_process";
|
|
287
315
|
function findGit(cwd) {
|
|
288
316
|
let current = cwd;
|
|
289
317
|
while (true) {
|
|
@@ -311,6 +339,6 @@ function configureCommitTemplate() {
|
|
|
311
339
|
console.info(`git ${args.join(" ")}`);
|
|
312
340
|
spawnSync("git", args);
|
|
313
341
|
}
|
|
314
|
-
if (!
|
|
342
|
+
if (!import_is_ci.default) {
|
|
315
343
|
configureCommitTemplate();
|
|
316
344
|
}
|
package/dist/parser.js
CHANGED
|
@@ -1,17 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
import { dirname as _$_dirname } from "node:path";
|
|
3
|
+
import { createRequire as _$_createRequire } from "node:module";
|
|
4
|
+
import { fileURLToPath as _$_fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const require = _$_createRequire(import.meta.url);
|
|
7
|
+
const __dirname = _$_dirname(_$_fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
var __create = Object.create;
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
-
var
|
|
13
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
16
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
17
|
+
}) : x)(function(x) {
|
|
18
|
+
if (typeof require !== "undefined")
|
|
19
|
+
return require.apply(this, arguments);
|
|
20
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
21
|
+
});
|
|
22
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
3
23
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
4
24
|
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
34
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
35
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
36
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
37
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
38
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
39
|
+
mod
|
|
40
|
+
));
|
|
41
|
+
|
|
42
|
+
// node_modules/conventional-changelog-conventionalcommits/constants.js
|
|
43
|
+
var require_constants = __commonJS({
|
|
44
|
+
"node_modules/conventional-changelog-conventionalcommits/constants.js"(exports) {
|
|
45
|
+
"use strict";
|
|
46
|
+
var DEFAULT_COMMIT_TYPES = Object.freeze([
|
|
47
|
+
{ type: "feat", section: "Features" },
|
|
48
|
+
{ type: "feature", section: "Features" },
|
|
49
|
+
{ type: "fix", section: "Bug Fixes" },
|
|
50
|
+
{ type: "perf", section: "Performance Improvements" },
|
|
51
|
+
{ type: "revert", section: "Reverts" },
|
|
52
|
+
{ type: "docs", section: "Documentation", hidden: true },
|
|
53
|
+
{ type: "style", section: "Styles", hidden: true },
|
|
54
|
+
{ type: "chore", section: "Miscellaneous Chores", hidden: true },
|
|
55
|
+
{ type: "refactor", section: "Code Refactoring", hidden: true },
|
|
56
|
+
{ type: "test", section: "Tests", hidden: true },
|
|
57
|
+
{ type: "build", section: "Build System", hidden: true },
|
|
58
|
+
{ type: "ci", section: "Continuous Integration", hidden: true }
|
|
59
|
+
].map(Object.freeze));
|
|
60
|
+
exports.DEFAULT_COMMIT_TYPES = DEFAULT_COMMIT_TYPES;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// node_modules/conventional-changelog-conventionalcommits/utils.js
|
|
65
|
+
var require_utils = __commonJS({
|
|
66
|
+
"node_modules/conventional-changelog-conventionalcommits/utils.js"(exports, module) {
|
|
67
|
+
var breakingHeaderPattern = /^(\w*)(?:\((.*)\))?!: (.*)$/;
|
|
68
|
+
module.exports.breakingHeaderPattern = breakingHeaderPattern;
|
|
69
|
+
function addBangNotes(commit) {
|
|
70
|
+
const match = commit.header.match(breakingHeaderPattern);
|
|
71
|
+
if (match && commit.notes.length === 0) {
|
|
72
|
+
const noteText = match[3];
|
|
73
|
+
commit.notes.push({
|
|
74
|
+
text: noteText
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
module.exports.addBangNotes = addBangNotes;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
5
81
|
|
|
6
|
-
// node_modules/conventional-changelog-conventionalcommits/
|
|
7
|
-
var
|
|
8
|
-
"node_modules/conventional-changelog-conventionalcommits/
|
|
82
|
+
// node_modules/conventional-changelog-conventionalcommits/parserOpts.js
|
|
83
|
+
var require_parserOpts = __commonJS({
|
|
84
|
+
"node_modules/conventional-changelog-conventionalcommits/parserOpts.js"(exports, module) {
|
|
9
85
|
"use strict";
|
|
10
|
-
|
|
11
|
-
|
|
86
|
+
var { breakingHeaderPattern } = require_utils();
|
|
87
|
+
function createParserOpts(config) {
|
|
12
88
|
return {
|
|
13
89
|
headerPattern: /^(\w*)(?:\((.*)\))?!?: (.*)$/,
|
|
14
|
-
breakingHeaderPattern
|
|
90
|
+
breakingHeaderPattern,
|
|
15
91
|
headerCorrespondence: [
|
|
16
92
|
"type",
|
|
17
93
|
"scope",
|
|
@@ -20,38 +96,18 @@ var require_parser_opts = __commonJS({
|
|
|
20
96
|
noteKeywords: ["BREAKING CHANGE", "BREAKING-CHANGE"],
|
|
21
97
|
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
|
|
22
98
|
revertCorrespondence: ["header", "hash"],
|
|
23
|
-
issuePrefixes: config
|
|
99
|
+
issuePrefixes: config?.issuePrefixes || ["#"]
|
|
24
100
|
};
|
|
25
|
-
};
|
|
26
|
-
function defaultConfig(config) {
|
|
27
|
-
config = config || {};
|
|
28
|
-
config.issuePrefixes = config.issuePrefixes || ["#"];
|
|
29
|
-
return config;
|
|
30
101
|
}
|
|
31
|
-
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// node_modules/conventional-changelog-conventionalcommits/add-bang-notes.js
|
|
35
|
-
var require_add_bang_notes = __commonJS({
|
|
36
|
-
"node_modules/conventional-changelog-conventionalcommits/add-bang-notes.js"(exports2, module2) {
|
|
37
|
-
var { breakingHeaderPattern } = require_parser_opts()();
|
|
38
|
-
module2.exports = (commit) => {
|
|
39
|
-
const match = commit.header.match(breakingHeaderPattern);
|
|
40
|
-
if (match && commit.notes.length === 0) {
|
|
41
|
-
const noteText = match[3];
|
|
42
|
-
commit.notes.push({
|
|
43
|
-
text: noteText
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
102
|
+
module.exports.createParserOpts = createParserOpts;
|
|
47
103
|
}
|
|
48
104
|
});
|
|
49
105
|
|
|
50
106
|
// node_modules/array-ify/index.js
|
|
51
107
|
var require_array_ify = __commonJS({
|
|
52
|
-
"node_modules/array-ify/index.js"(
|
|
108
|
+
"node_modules/array-ify/index.js"(exports, module) {
|
|
53
109
|
"use strict";
|
|
54
|
-
|
|
110
|
+
module.exports = function(val) {
|
|
55
111
|
return Array.isArray(val) ? val : [val];
|
|
56
112
|
};
|
|
57
113
|
}
|
|
@@ -59,9 +115,9 @@ var require_array_ify = __commonJS({
|
|
|
59
115
|
|
|
60
116
|
// node_modules/is-obj/index.js
|
|
61
117
|
var require_is_obj = __commonJS({
|
|
62
|
-
"node_modules/is-obj/index.js"(
|
|
118
|
+
"node_modules/is-obj/index.js"(exports, module) {
|
|
63
119
|
"use strict";
|
|
64
|
-
|
|
120
|
+
module.exports = (value) => {
|
|
65
121
|
const type = typeof value;
|
|
66
122
|
return value !== null && (type === "object" || type === "function");
|
|
67
123
|
};
|
|
@@ -70,7 +126,7 @@ var require_is_obj = __commonJS({
|
|
|
70
126
|
|
|
71
127
|
// node_modules/dot-prop/index.js
|
|
72
128
|
var require_dot_prop = __commonJS({
|
|
73
|
-
"node_modules/dot-prop/index.js"(
|
|
129
|
+
"node_modules/dot-prop/index.js"(exports, module) {
|
|
74
130
|
"use strict";
|
|
75
131
|
var isObj = require_is_obj();
|
|
76
132
|
var disallowedKeys = [
|
|
@@ -95,7 +151,7 @@ var require_dot_prop = __commonJS({
|
|
|
95
151
|
}
|
|
96
152
|
return parts;
|
|
97
153
|
}
|
|
98
|
-
|
|
154
|
+
module.exports = {
|
|
99
155
|
get(object, path, value) {
|
|
100
156
|
if (!isObj(object) || typeof path !== "string") {
|
|
101
157
|
return value === void 0 ? object : value;
|
|
@@ -179,7 +235,7 @@ var require_dot_prop = __commonJS({
|
|
|
179
235
|
|
|
180
236
|
// node_modules/compare-func/index.js
|
|
181
237
|
var require_compare_func = __commonJS({
|
|
182
|
-
"node_modules/compare-func/index.js"(
|
|
238
|
+
"node_modules/compare-func/index.js"(exports, module) {
|
|
183
239
|
"use strict";
|
|
184
240
|
var arrayify = require_array_ify();
|
|
185
241
|
var dotPropGet = require_dot_prop().get;
|
|
@@ -213,35 +269,44 @@ var require_compare_func = __commonJS({
|
|
|
213
269
|
return ret;
|
|
214
270
|
};
|
|
215
271
|
}
|
|
216
|
-
|
|
272
|
+
module.exports = compareFunc;
|
|
217
273
|
}
|
|
218
274
|
});
|
|
219
275
|
|
|
220
|
-
// node_modules/conventional-changelog-conventionalcommits/
|
|
221
|
-
var
|
|
222
|
-
"node_modules/conventional-changelog-conventionalcommits/
|
|
276
|
+
// node_modules/conventional-changelog-conventionalcommits/writerOpts.js
|
|
277
|
+
var require_writerOpts = __commonJS({
|
|
278
|
+
"node_modules/conventional-changelog-conventionalcommits/writerOpts.js"(exports, module) {
|
|
223
279
|
"use strict";
|
|
224
|
-
var addBangNotes = require_add_bang_notes();
|
|
225
280
|
var compareFunc = require_compare_func();
|
|
226
|
-
var { readFile } =
|
|
227
|
-
var { resolve } =
|
|
228
|
-
var
|
|
281
|
+
var { readFile } = __require("fs").promises;
|
|
282
|
+
var { resolve } = __require("path");
|
|
283
|
+
var { DEFAULT_COMMIT_TYPES } = require_constants();
|
|
284
|
+
var { addBangNotes } = require_utils();
|
|
285
|
+
var releaseAsRegex = /release-as:\s*\w*@?([0-9]+\.[0-9]+\.[0-9a-z]+(-[0-9a-z.]+)?)\s*/i;
|
|
229
286
|
var owner = "{{#if this.owner}}{{~this.owner}}{{else}}{{~@root.owner}}{{/if}}";
|
|
230
287
|
var host = "{{~@root.host}}";
|
|
231
288
|
var repository = "{{#if this.repository}}{{~this.repository}}{{else}}{{~@root.repository}}{{/if}}";
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
289
|
+
async function createWriterOpts(config) {
|
|
290
|
+
const finalConfig = {
|
|
291
|
+
types: DEFAULT_COMMIT_TYPES,
|
|
292
|
+
issueUrlFormat: "{{host}}/{{owner}}/{{repository}}/issues/{{id}}",
|
|
293
|
+
commitUrlFormat: "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
|
|
294
|
+
compareUrlFormat: "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}",
|
|
295
|
+
userUrlFormat: "{{host}}/{{user}}",
|
|
296
|
+
issuePrefixes: ["#"],
|
|
297
|
+
...config
|
|
298
|
+
};
|
|
299
|
+
const commitUrlFormat = expandTemplate(finalConfig.commitUrlFormat, {
|
|
235
300
|
host,
|
|
236
301
|
owner,
|
|
237
302
|
repository
|
|
238
303
|
});
|
|
239
|
-
const compareUrlFormat = expandTemplate(
|
|
304
|
+
const compareUrlFormat = expandTemplate(finalConfig.compareUrlFormat, {
|
|
240
305
|
host,
|
|
241
306
|
owner,
|
|
242
307
|
repository
|
|
243
308
|
});
|
|
244
|
-
const issueUrlFormat = expandTemplate(
|
|
309
|
+
const issueUrlFormat = expandTemplate(finalConfig.issueUrlFormat, {
|
|
245
310
|
host,
|
|
246
311
|
owner,
|
|
247
312
|
repository,
|
|
@@ -259,27 +324,15 @@ var require_writer_opts = __commonJS({
|
|
|
259
324
|
readFile(resolve(__dirname, "./templates/commit.hbs"), "utf-8"),
|
|
260
325
|
readFile(resolve(__dirname, "./templates/footer.hbs"), "utf-8")
|
|
261
326
|
]);
|
|
262
|
-
const writerOpts = getWriterOpts(
|
|
327
|
+
const writerOpts = getWriterOpts(finalConfig);
|
|
263
328
|
writerOpts.mainTemplate = template;
|
|
264
329
|
writerOpts.headerPartial = header.replace(/{{compareUrlFormat}}/g, compareUrlFormat);
|
|
265
330
|
writerOpts.commitPartial = commit.replace(/{{commitUrlFormat}}/g, commitUrlFormat).replace(/{{issueUrlFormat}}/g, issueUrlFormat);
|
|
266
331
|
writerOpts.footerPartial = footer;
|
|
267
332
|
return writerOpts;
|
|
268
|
-
};
|
|
269
|
-
function findTypeEntry(types, commit) {
|
|
270
|
-
const typeKey = (commit.revert ? "revert" : commit.type || "").toLowerCase();
|
|
271
|
-
return types.find((entry) => {
|
|
272
|
-
if (entry.type !== typeKey) {
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
if (entry.scope && entry.scope !== commit.scope) {
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
return true;
|
|
279
|
-
});
|
|
280
333
|
}
|
|
334
|
+
module.exports.createWriterOpts = createWriterOpts;
|
|
281
335
|
function getWriterOpts(config) {
|
|
282
|
-
config = defaultConfig(config);
|
|
283
336
|
const commitGroupOrder = config.types.flatMap((t) => t.section).filter((t) => t);
|
|
284
337
|
return {
|
|
285
338
|
transform: (commit, context) => {
|
|
@@ -287,7 +340,7 @@ var require_writer_opts = __commonJS({
|
|
|
287
340
|
const issues = [];
|
|
288
341
|
const entry = findTypeEntry(config.types, commit);
|
|
289
342
|
addBangNotes(commit);
|
|
290
|
-
if (commit.footer &&
|
|
343
|
+
if (commit.footer && releaseAsRegex.test(commit.footer) || commit.body && releaseAsRegex.test(commit.body)) {
|
|
291
344
|
discard = false;
|
|
292
345
|
}
|
|
293
346
|
commit.notes.forEach((note) => {
|
|
@@ -306,7 +359,7 @@ var require_writer_opts = __commonJS({
|
|
|
306
359
|
}
|
|
307
360
|
if (typeof commit.subject === "string") {
|
|
308
361
|
config.issuePrefixes.join("|");
|
|
309
|
-
const issueRegEx = "(" + config.issuePrefixes.join("|") + ")([
|
|
362
|
+
const issueRegEx = "(" + config.issuePrefixes.join("|") + ")([a-z0-9]+)";
|
|
310
363
|
const re = new RegExp(issueRegEx, "g");
|
|
311
364
|
commit.subject = commit.subject.replace(re, (_, prefix, issue) => {
|
|
312
365
|
issues.push(prefix + issue);
|
|
@@ -353,28 +406,17 @@ var require_writer_opts = __commonJS({
|
|
|
353
406
|
notesSort: compareFunc
|
|
354
407
|
};
|
|
355
408
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
{ type: "refactor", section: "Code Refactoring", hidden: true },
|
|
368
|
-
{ type: "test", section: "Tests", hidden: true },
|
|
369
|
-
{ type: "build", section: "Build System", hidden: true },
|
|
370
|
-
{ type: "ci", section: "Continuous Integration", hidden: true }
|
|
371
|
-
];
|
|
372
|
-
config.issueUrlFormat = config.issueUrlFormat || "{{host}}/{{owner}}/{{repository}}/issues/{{id}}";
|
|
373
|
-
config.commitUrlFormat = config.commitUrlFormat || "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}";
|
|
374
|
-
config.compareUrlFormat = config.compareUrlFormat || "{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}";
|
|
375
|
-
config.userUrlFormat = config.userUrlFormat || "{{host}}/{{user}}";
|
|
376
|
-
config.issuePrefixes = config.issuePrefixes || ["#"];
|
|
377
|
-
return config;
|
|
409
|
+
function findTypeEntry(types, commit) {
|
|
410
|
+
const typeKey = (commit.revert ? "revert" : commit.type || "").toLowerCase();
|
|
411
|
+
return types.find((entry) => {
|
|
412
|
+
if (entry.type !== typeKey) {
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
if (entry.scope && entry.scope !== commit.scope) {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
return true;
|
|
419
|
+
});
|
|
378
420
|
}
|
|
379
421
|
function expandTemplate(template, context) {
|
|
380
422
|
let expanded = template;
|
|
@@ -386,31 +428,29 @@ var require_writer_opts = __commonJS({
|
|
|
386
428
|
}
|
|
387
429
|
});
|
|
388
430
|
|
|
389
|
-
// node_modules/conventional-changelog-conventionalcommits/
|
|
390
|
-
var
|
|
391
|
-
"node_modules/conventional-changelog-conventionalcommits/
|
|
431
|
+
// node_modules/conventional-changelog-conventionalcommits/conventionalChangelog.js
|
|
432
|
+
var require_conventionalChangelog = __commonJS({
|
|
433
|
+
"node_modules/conventional-changelog-conventionalcommits/conventionalChangelog.js"(exports, module) {
|
|
392
434
|
"use strict";
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
};
|
|
435
|
+
function createConventionalChangelogOpts(parserOpts, writerOpts) {
|
|
436
|
+
return {
|
|
437
|
+
parserOpts,
|
|
438
|
+
writerOpts
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
module.exports.createConventionalChangelogOpts = createConventionalChangelogOpts;
|
|
401
442
|
}
|
|
402
443
|
});
|
|
403
444
|
|
|
404
|
-
// node_modules/conventional-changelog-conventionalcommits/
|
|
405
|
-
var
|
|
406
|
-
"node_modules/conventional-changelog-conventionalcommits/
|
|
445
|
+
// node_modules/conventional-changelog-conventionalcommits/conventionalRecommendedBump.js
|
|
446
|
+
var require_conventionalRecommendedBump = __commonJS({
|
|
447
|
+
"node_modules/conventional-changelog-conventionalcommits/conventionalRecommendedBump.js"(exports, module) {
|
|
407
448
|
"use strict";
|
|
408
|
-
var addBangNotes =
|
|
409
|
-
|
|
410
|
-
module2.exports = function(config) {
|
|
449
|
+
var { addBangNotes } = require_utils();
|
|
450
|
+
function createConventionalRecommendedBumpOpts(config, parserOpts) {
|
|
411
451
|
return {
|
|
412
|
-
parserOpts
|
|
413
|
-
whatBump
|
|
452
|
+
parserOpts,
|
|
453
|
+
whatBump(commits) {
|
|
414
454
|
let level = 2;
|
|
415
455
|
let breakings = 0;
|
|
416
456
|
let features = 0;
|
|
@@ -426,7 +466,7 @@ var require_conventional_recommended_bump = __commonJS({
|
|
|
426
466
|
}
|
|
427
467
|
}
|
|
428
468
|
});
|
|
429
|
-
if (config
|
|
469
|
+
if (config?.preMajor && level < 2) {
|
|
430
470
|
level++;
|
|
431
471
|
}
|
|
432
472
|
return {
|
|
@@ -435,57 +475,44 @@ var require_conventional_recommended_bump = __commonJS({
|
|
|
435
475
|
};
|
|
436
476
|
}
|
|
437
477
|
};
|
|
438
|
-
}
|
|
478
|
+
}
|
|
479
|
+
module.exports.createConventionalRecommendedBumpOpts = createConventionalRecommendedBumpOpts;
|
|
439
480
|
}
|
|
440
481
|
});
|
|
441
482
|
|
|
442
483
|
// node_modules/conventional-changelog-conventionalcommits/index.js
|
|
443
484
|
var require_conventional_changelog_conventionalcommits = __commonJS({
|
|
444
|
-
"node_modules/conventional-changelog-conventionalcommits/index.js"(
|
|
485
|
+
"node_modules/conventional-changelog-conventionalcommits/index.js"(exports, module) {
|
|
445
486
|
"use strict";
|
|
446
|
-
var
|
|
447
|
-
var
|
|
448
|
-
var
|
|
449
|
-
var
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
writerOpts: writerOpts2
|
|
467
|
-
});
|
|
468
|
-
});
|
|
469
|
-
} else {
|
|
470
|
-
const config = parameter || {};
|
|
471
|
-
return presetOpts(config);
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
function presetOpts(config) {
|
|
475
|
-
return Promise.all([
|
|
476
|
-
conventionalChangelog(config),
|
|
477
|
-
parserOpts(config),
|
|
478
|
-
recommendedBumpOpts(config),
|
|
479
|
-
writerOpts(config)
|
|
480
|
-
]).then(([conventionalChangelog2, parserOpts2, recommendedBumpOpts2, writerOpts2]) => ({
|
|
481
|
-
conventionalChangelog: conventionalChangelog2,
|
|
482
|
-
parserOpts: parserOpts2,
|
|
483
|
-
recommendedBumpOpts: recommendedBumpOpts2,
|
|
484
|
-
writerOpts: writerOpts2
|
|
485
|
-
}));
|
|
487
|
+
var { DEFAULT_COMMIT_TYPES } = require_constants();
|
|
488
|
+
var { createParserOpts } = require_parserOpts();
|
|
489
|
+
var { createWriterOpts } = require_writerOpts();
|
|
490
|
+
var { createConventionalChangelogOpts } = require_conventionalChangelog();
|
|
491
|
+
var { createConventionalRecommendedBumpOpts } = require_conventionalRecommendedBump();
|
|
492
|
+
async function createPreset(config) {
|
|
493
|
+
const parserOpts = createParserOpts(config);
|
|
494
|
+
const writerOpts = await createWriterOpts(config);
|
|
495
|
+
const recommendedBumpOpts = createConventionalRecommendedBumpOpts(config, parserOpts);
|
|
496
|
+
const conventionalChangelog = createConventionalChangelogOpts(parserOpts, writerOpts);
|
|
497
|
+
return {
|
|
498
|
+
gitRawCommitsOpts: {
|
|
499
|
+
ignore: config?.ignoreCommits,
|
|
500
|
+
noMerges: null
|
|
501
|
+
},
|
|
502
|
+
parserOpts,
|
|
503
|
+
writerOpts,
|
|
504
|
+
recommendedBumpOpts,
|
|
505
|
+
conventionalChangelog
|
|
506
|
+
};
|
|
486
507
|
}
|
|
508
|
+
module.exports = createPreset;
|
|
509
|
+
module.exports.DEFAULT_COMMIT_TYPES = DEFAULT_COMMIT_TYPES;
|
|
487
510
|
}
|
|
488
511
|
});
|
|
489
512
|
|
|
490
|
-
// src/parser.
|
|
491
|
-
|
|
513
|
+
// src/parser.ts
|
|
514
|
+
var import_conventional_changelog_conventionalcommits = __toESM(require_conventional_changelog_conventionalcommits(), 1);
|
|
515
|
+
var parser_default = (0, import_conventional_changelog_conventionalcommits.default)({});
|
|
516
|
+
export {
|
|
517
|
+
parser_default as default
|
|
518
|
+
};
|