bunset 1.0.11 → 1.0.13
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 +33 -0
- package/package.json +2 -2
- package/src/changelog.test.ts +27 -0
- package/src/changelog.ts +5 -4
- package/src/index.ts +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.13
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- show version and notes in commit message
|
|
8
|
+
|
|
9
|
+
### Refactors
|
|
10
|
+
|
|
11
|
+
- update buildReleaseNotes to accept iterable entries
|
|
12
|
+
|
|
13
|
+
### Chores
|
|
14
|
+
|
|
15
|
+
- update deps
|
|
16
|
+
|
|
17
|
+
### Updated Dependencies
|
|
18
|
+
|
|
19
|
+
- `@types/bun`: 1.3.14
|
|
20
|
+
|
|
21
|
+
## 1.0.12
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
- no gh in the dev container
|
|
26
|
+
- omit packages with empty entries from release notes (#3)
|
|
27
|
+
|
|
28
|
+
### Chores
|
|
29
|
+
|
|
30
|
+
- update dependencies and configuration for bunset
|
|
31
|
+
|
|
32
|
+
### Updated Dependencies
|
|
33
|
+
|
|
34
|
+
- `@types/bun`: 1.3.13
|
|
35
|
+
|
|
3
36
|
## 1.0.11
|
|
4
37
|
|
|
5
38
|
### Features
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunset",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"module": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"bunset": "src/index.ts"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@types/bun": "1.3.
|
|
10
|
+
"@types/bun": "1.3.14"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"typescript": "^6.0.3"
|
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
|
@@ -85,12 +85,13 @@ export function buildChangelogEntry(
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export function buildReleaseNotes(
|
|
88
|
-
entries: { pkgName: string; entry: string }
|
|
88
|
+
entries: Iterable<{ 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
|
}
|
package/src/index.ts
CHANGED
|
@@ -268,8 +268,10 @@ if (options.dryRun) {
|
|
|
268
268
|
const msg =
|
|
269
269
|
packages.length === 1
|
|
270
270
|
? `chore: release ${packages[0]!.name}@${releaseVersion}`
|
|
271
|
-
: `chore: release ${packages.length} packages`;
|
|
272
|
-
|
|
271
|
+
: `chore: release ${releaseVersion} for ${packages.length} packages`;
|
|
272
|
+
|
|
273
|
+
const notes = buildReleaseNotes([...tagEntries.values()].flat());
|
|
274
|
+
console.log(`Would commit: ${msg}\n\n${notes}`);
|
|
273
275
|
} else {
|
|
274
276
|
console.log("Will not commit (--commit not set).");
|
|
275
277
|
}
|
|
@@ -367,12 +369,14 @@ changedFiles.push(`${cwd}/bun.lock`);
|
|
|
367
369
|
debug("updated bun.lock");
|
|
368
370
|
|
|
369
371
|
if (options.commit) {
|
|
372
|
+
const releaseVersion = (await Bun.file(packages[0]!.packageJsonPath).json()).version;
|
|
370
373
|
const msg =
|
|
371
374
|
packages.length === 1
|
|
372
|
-
? `chore: release ${packages[0]!.name}@${
|
|
373
|
-
: `chore: release ${packages.length} packages`;
|
|
374
|
-
|
|
375
|
-
|
|
375
|
+
? `chore: release ${packages[0]!.name}@${releaseVersion}`
|
|
376
|
+
: `chore: release ${releaseVersion} for ${packages.length} packages`;
|
|
377
|
+
const notes = buildReleaseNotes([...tagEntries.values()].flat());
|
|
378
|
+
await commitAndTag(cwd, msg + "\n\n" + notes, options.tag ? uniqueTags : [], changedFiles);
|
|
379
|
+
console.log(`Committed: ${msg}\n\n${notes}`);
|
|
376
380
|
if (uniqueTags.length > 0) {
|
|
377
381
|
console.log(`Tagged: ${uniqueTags.join(", ")}`);
|
|
378
382
|
}
|