@hadl-labs/changelog-github 0.4.5 → 0.5.0
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.js +39 -36
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,39 +4,60 @@ var __defProp = Object.defineProperty;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
7
12
|
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
8
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
21
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
22
|
for (let key of __getOwnPropNames(mod))
|
|
11
23
|
if (!__hasOwnProp.call(to, key))
|
|
12
24
|
__defProp(to, key, {
|
|
13
|
-
get: (
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
14
26
|
enumerable: true
|
|
15
27
|
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
16
30
|
return to;
|
|
17
31
|
};
|
|
18
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
19
32
|
var __toCommonJS = (from) => {
|
|
20
|
-
var entry = __moduleCache.get(from), desc;
|
|
33
|
+
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
21
34
|
if (entry)
|
|
22
35
|
return entry;
|
|
23
36
|
entry = __defProp({}, "__esModule", { value: true });
|
|
24
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
38
|
+
for (var key of __getOwnPropNames(from))
|
|
39
|
+
if (!__hasOwnProp.call(entry, key))
|
|
40
|
+
__defProp(entry, key, {
|
|
41
|
+
get: __accessProp.bind(from, key),
|
|
42
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
43
|
+
});
|
|
44
|
+
}
|
|
29
45
|
__moduleCache.set(from, entry);
|
|
30
46
|
return entry;
|
|
31
47
|
};
|
|
48
|
+
var __moduleCache;
|
|
32
49
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
50
|
+
var __returnValue = (v) => v;
|
|
51
|
+
function __exportSetter(name, newValue) {
|
|
52
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
53
|
+
}
|
|
33
54
|
var __export = (target, all) => {
|
|
34
55
|
for (var name in all)
|
|
35
56
|
__defProp(target, name, {
|
|
36
57
|
get: all[name],
|
|
37
58
|
enumerable: true,
|
|
38
59
|
configurable: true,
|
|
39
|
-
set: (
|
|
60
|
+
set: __exportSetter.bind(all, name)
|
|
40
61
|
});
|
|
41
62
|
};
|
|
42
63
|
|
|
@@ -482,26 +503,8 @@ async function getInfoFromPullRequest(request) {
|
|
|
482
503
|
|
|
483
504
|
// src/index.ts
|
|
484
505
|
var changelogFunctions = {
|
|
485
|
-
getDependencyReleaseLine: async (
|
|
486
|
-
|
|
487
|
-
throw new Error(`Please provide a repo to this changelog generator like this:
|
|
488
|
-
"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]`);
|
|
489
|
-
}
|
|
490
|
-
if (dependenciesUpdated.length === 0)
|
|
491
|
-
return "";
|
|
492
|
-
const changesetLink = `- Updated dependencies [${(await Promise.all(changesets.map(async (cs) => {
|
|
493
|
-
if (cs.commit) {
|
|
494
|
-
let { links } = await getInfo({
|
|
495
|
-
repo: options["repo"],
|
|
496
|
-
commit: cs.commit
|
|
497
|
-
});
|
|
498
|
-
return links.commit;
|
|
499
|
-
}
|
|
500
|
-
return null;
|
|
501
|
-
}))).filter((_) => _).join(", ")}]:`;
|
|
502
|
-
const updatedDepenenciesList = dependenciesUpdated.map((dependency) => ` - ${dependency.name}@${dependency.newVersion}`);
|
|
503
|
-
return [changesetLink, ...updatedDepenenciesList].join(`
|
|
504
|
-
`);
|
|
506
|
+
getDependencyReleaseLine: async () => {
|
|
507
|
+
return "";
|
|
505
508
|
},
|
|
506
509
|
getReleaseLine: async (changeset, _type, options) => {
|
|
507
510
|
if (!options || !options["repo"]) {
|
|
@@ -511,7 +514,7 @@ var changelogFunctions = {
|
|
|
511
514
|
let prFromSummary;
|
|
512
515
|
let commitFromSummary;
|
|
513
516
|
let usersFromSummary = [];
|
|
514
|
-
let
|
|
517
|
+
let cardLinks = [];
|
|
515
518
|
const replacedChangelog = changeset.summary.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => {
|
|
516
519
|
let num = Number(pr);
|
|
517
520
|
if (!isNaN(num))
|
|
@@ -523,8 +526,8 @@ var changelogFunctions = {
|
|
|
523
526
|
}).replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => {
|
|
524
527
|
usersFromSummary.push(user);
|
|
525
528
|
return "";
|
|
526
|
-
}).replace(/^\s*
|
|
527
|
-
|
|
529
|
+
}).replace(/^\s*card:\s*(https?:\/\/[^\s]+)/gim, (_, link) => {
|
|
530
|
+
cardLinks.push(link);
|
|
528
531
|
return "";
|
|
529
532
|
}).trim();
|
|
530
533
|
const [firstLine, ...futureLines] = replacedChangelog.split(`
|
|
@@ -559,15 +562,15 @@ var changelogFunctions = {
|
|
|
559
562
|
};
|
|
560
563
|
})();
|
|
561
564
|
const users = usersFromSummary.length ? usersFromSummary.map((userFromSummary) => `[@${userFromSummary}](https://github.com/${userFromSummary})`).join(", ") : links.user;
|
|
562
|
-
const
|
|
563
|
-
const
|
|
564
|
-
return `[${
|
|
565
|
+
const cardPart = cardLinks.length > 0 ? ` Card: ${cardLinks.map((link) => {
|
|
566
|
+
const slug = link.split("/").filter(Boolean).pop();
|
|
567
|
+
return `[${slug}](${link})`;
|
|
565
568
|
}).join(", ")}` : "";
|
|
566
569
|
const prefix = [
|
|
567
570
|
links.pull === null ? "" : ` ${links.pull}`,
|
|
568
571
|
links.commit === null ? "" : ` ${links.commit}`,
|
|
569
572
|
users === null ? "" : ` Thanks ${users}!`,
|
|
570
|
-
|
|
573
|
+
cardPart
|
|
571
574
|
].join("");
|
|
572
575
|
return `
|
|
573
576
|
|