bunset 1.0.11 → 1.0.12
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/CHANGELOG.md +15 -0
- package/package.json +1 -1
- package/src/changelog.test.ts +27 -0
- package/src/changelog.ts +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.12
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- no gh in the dev container
|
|
8
|
+
- omit packages with empty entries from release notes (#3)
|
|
9
|
+
|
|
10
|
+
### Chores
|
|
11
|
+
|
|
12
|
+
- update dependencies and configuration for bunset
|
|
13
|
+
|
|
14
|
+
### Updated Dependencies
|
|
15
|
+
|
|
16
|
+
- `@types/bun`: 1.3.13
|
|
17
|
+
|
|
3
18
|
## 1.0.11
|
|
4
19
|
|
|
5
20
|
### Features
|
package/package.json
CHANGED
package/src/changelog.test.ts
CHANGED
|
@@ -232,4 +232,31 @@ describe("buildReleaseNotes", () => {
|
|
|
232
232
|
const entry = "### Features\n\n- Plain entry\n";
|
|
233
233
|
expect(buildReleaseNotes([{ pkgName: "pkg-a", entry }])).toBe(entry);
|
|
234
234
|
});
|
|
235
|
+
|
|
236
|
+
test("omits packages with empty entries", () => {
|
|
237
|
+
const result = buildReleaseNotes([
|
|
238
|
+
{ pkgName: "pkg-a", entry: "## 1.2.3\n\n### Features\n\n- A\n" },
|
|
239
|
+
{ pkgName: "pkg-b", entry: "## 1.2.3\n" },
|
|
240
|
+
{ pkgName: "pkg-c", entry: "## 1.2.3\n\n### Bug Fixes\n\n- C\n" },
|
|
241
|
+
]);
|
|
242
|
+
expect(result).toContain("## pkg-a");
|
|
243
|
+
expect(result).not.toContain("## pkg-b");
|
|
244
|
+
expect(result).toContain("## pkg-c");
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
test("strips version heading when only one package has content", () => {
|
|
248
|
+
const result = buildReleaseNotes([
|
|
249
|
+
{ pkgName: "pkg-a", entry: "## 1.2.3\n\n### Features\n\n- A\n" },
|
|
250
|
+
{ pkgName: "pkg-b", entry: "## 1.2.3\n" },
|
|
251
|
+
]);
|
|
252
|
+
expect(result).toBe("### Features\n\n- A\n");
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test("returns empty string when all entries are empty", () => {
|
|
256
|
+
const result = buildReleaseNotes([
|
|
257
|
+
{ pkgName: "pkg-a", entry: "## 1.2.3\n" },
|
|
258
|
+
{ pkgName: "pkg-b", entry: "## 1.2.3\n\n" },
|
|
259
|
+
]);
|
|
260
|
+
expect(result).toBe("");
|
|
261
|
+
});
|
|
235
262
|
});
|
package/src/changelog.ts
CHANGED
|
@@ -88,9 +88,10 @@ export function buildReleaseNotes(
|
|
|
88
88
|
entries: { pkgName: string; entry: string }[],
|
|
89
89
|
): string {
|
|
90
90
|
const stripVersion = (e: string) => e.replace(/^## [^\n]*\n+/, "");
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
91
|
+
const nonEmpty = entries.filter(({ entry }) => stripVersion(entry).trim() !== "");
|
|
92
|
+
if (nonEmpty.length === 0) return "";
|
|
93
|
+
if (nonEmpty.length === 1) return stripVersion(nonEmpty[0]!.entry);
|
|
94
|
+
return nonEmpty
|
|
94
95
|
.map(({ pkgName, entry }) => `## ${pkgName}\n\n${stripVersion(entry)}`)
|
|
95
96
|
.join("\n\n");
|
|
96
97
|
}
|