bunset 1.0.7 → 1.0.9
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 +12 -0
- package/package.json +1 -1
- package/src/cli.ts +7 -2
- package/src/config.ts +4 -0
- package/src/git.ts +10 -0
- package/src/index.ts +16 -11
- package/src/types.ts +1 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -18,6 +18,7 @@ Options:
|
|
|
18
18
|
--per-package-tags Use package-scoped tags (pkg@version) instead of prefixed
|
|
19
19
|
--tag-prefix <str> Tag prefix (auto-detected from last tag, or "v" if no tags)
|
|
20
20
|
--sections <list> Comma-separated changelog sections (default: feat,fix,perf)
|
|
21
|
+
--push Push commit and tags to remote after tagging
|
|
21
22
|
--dry-run Preview changes without writing files, committing, or tagging
|
|
22
23
|
--debug Show detailed inclusion/exclusion reasoning (implies --dry-run)
|
|
23
24
|
--no-filter-by-package
|
|
@@ -73,6 +74,7 @@ Config file (.bunset.toml):
|
|
|
73
74
|
per-package-tags = false # pkg@version tags (monorepo)
|
|
74
75
|
tag-prefix = "v" # tag prefix (default: auto-detect)
|
|
75
76
|
sections = ["feat", "fix", "perf"] # changelog sections and order
|
|
77
|
+
push = false # push after tagging (default: false)
|
|
76
78
|
dry-run = false # preview without writing
|
|
77
79
|
debug = false # detailed reasoning (implies dry-run)
|
|
78
80
|
filter-by-package = true # per-package filtering (monorepo)`);
|
|
@@ -96,6 +98,7 @@ export function resolveOptions(
|
|
|
96
98
|
tag: { type: "boolean" },
|
|
97
99
|
"per-package-tags": { type: "boolean", default: false },
|
|
98
100
|
sections: { type: "string" },
|
|
101
|
+
push: { type: "boolean", default: false },
|
|
99
102
|
"dry-run": { type: "boolean", default: false },
|
|
100
103
|
"filter-by-package": { type: "boolean", default: true },
|
|
101
104
|
"tag-prefix": { type: "string" },
|
|
@@ -134,6 +137,7 @@ export function resolveOptions(
|
|
|
134
137
|
?? config.sections
|
|
135
138
|
?? DEFAULT_SECTIONS;
|
|
136
139
|
|
|
140
|
+
const push = values.push ? true : (config.push ?? false);
|
|
137
141
|
const debug = values.debug ? true : (config.debug ?? false);
|
|
138
142
|
const dryRun = debug || values["dry-run"] ? true : (config.dryRun ?? false);
|
|
139
143
|
|
|
@@ -146,11 +150,11 @@ export function resolveOptions(
|
|
|
146
150
|
?? null;
|
|
147
151
|
|
|
148
152
|
if (bump && scope && commit !== null && tag !== null) {
|
|
149
|
-
return { scope, bump, commit, tag, perPackageTags, sections, dryRun, filterByPackage, tagPrefix, debug };
|
|
153
|
+
return { scope, bump, commit, tag, perPackageTags, sections, dryRun, filterByPackage, tagPrefix, push, debug };
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
return promptForMissing(
|
|
153
|
-
{ commit, tag, perPackageTags, sections, dryRun, filterByPackage, tagPrefix, debug },
|
|
157
|
+
{ commit, tag, perPackageTags, sections, dryRun, filterByPackage, tagPrefix, push, debug },
|
|
154
158
|
bump,
|
|
155
159
|
scope,
|
|
156
160
|
isWs,
|
|
@@ -192,6 +196,7 @@ interface MergedDefaults {
|
|
|
192
196
|
dryRun: boolean;
|
|
193
197
|
filterByPackage: boolean;
|
|
194
198
|
tagPrefix: string | null;
|
|
199
|
+
push: boolean;
|
|
195
200
|
debug: boolean;
|
|
196
201
|
}
|
|
197
202
|
|
package/src/config.ts
CHANGED
package/src/git.ts
CHANGED
|
@@ -79,3 +79,13 @@ export async function commitAndTag(
|
|
|
79
79
|
console.warn(`⚠ Skipped existing tags: ${skipped.join(", ")}`);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
export async function gitPush(
|
|
84
|
+
cwd: string,
|
|
85
|
+
tags: string[] = [],
|
|
86
|
+
): Promise<void> {
|
|
87
|
+
await $`git -C ${cwd} push`.quiet();
|
|
88
|
+
if (tags.length > 0) {
|
|
89
|
+
await $`git -C ${cwd} push --tags`.quiet();
|
|
90
|
+
}
|
|
91
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getCommitsSince,
|
|
15
15
|
getCommitFiles,
|
|
16
16
|
commitAndTag,
|
|
17
|
+
gitPush,
|
|
17
18
|
} from "./git.ts";
|
|
18
19
|
import { getUpdatedDependencies } from "./deps.ts";
|
|
19
20
|
import {
|
|
@@ -66,8 +67,8 @@ debug(`last tag: ${lastTag ?? "(none)"}`);
|
|
|
66
67
|
debug(`raw commits since tag: ${rawCommits.length}`);
|
|
67
68
|
|
|
68
69
|
if (rawCommits.length === 0) {
|
|
69
|
-
console.
|
|
70
|
-
process.exit(
|
|
70
|
+
console.error("No commits found since last tag. Nothing to do.");
|
|
71
|
+
process.exit(1);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
const parsed = rawCommits.map((c) => parseCommit(c.hash, c.message, c.body));
|
|
@@ -115,11 +116,6 @@ if (shouldFilter) {
|
|
|
115
116
|
|
|
116
117
|
const globalGroups = groupCommits(parsed);
|
|
117
118
|
|
|
118
|
-
if (options.sections.every((type) => globalGroups[type].length === 0)) {
|
|
119
|
-
console.log("No categorized commits found. Nothing to do.");
|
|
120
|
-
process.exit(0);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
119
|
let packages =
|
|
124
120
|
options.scope === "changed"
|
|
125
121
|
? await getChangedPackages(cwd, allPackages, lastTag)
|
|
@@ -128,8 +124,8 @@ let packages =
|
|
|
128
124
|
debug(`scope: ${options.scope}, packages to process: ${packages.map((p) => p.name).join(", ") || "(none)"}`);
|
|
129
125
|
|
|
130
126
|
if (packages.length === 0) {
|
|
131
|
-
console.
|
|
132
|
-
process.exit(
|
|
127
|
+
console.error("No changed packages found. Nothing to do.");
|
|
128
|
+
process.exit(1);
|
|
133
129
|
}
|
|
134
130
|
|
|
135
131
|
function getPackageGroups(
|
|
@@ -244,6 +240,10 @@ if (options.dryRun) {
|
|
|
244
240
|
console.log("Will not tag (--tag not set).");
|
|
245
241
|
}
|
|
246
242
|
|
|
243
|
+
if (options.push) {
|
|
244
|
+
console.log("Would push commit and tags to remote.");
|
|
245
|
+
}
|
|
246
|
+
|
|
247
247
|
console.log(`\nFiles that would be modified (${filesToCommit.length}):`);
|
|
248
248
|
for (const f of filesToCommit) {
|
|
249
249
|
console.log(` ${f}`);
|
|
@@ -296,8 +296,8 @@ for (const pkg of packages) {
|
|
|
296
296
|
const uniqueTags = [...new Set(tags)];
|
|
297
297
|
|
|
298
298
|
if (changedFiles.length === 0) {
|
|
299
|
-
console.
|
|
300
|
-
process.exit(
|
|
299
|
+
console.error("No packages were updated. Nothing to do.");
|
|
300
|
+
process.exit(1);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
// Update lockfile after package.json versions changed
|
|
@@ -315,6 +315,11 @@ if (options.commit) {
|
|
|
315
315
|
if (uniqueTags.length > 0) {
|
|
316
316
|
console.log(`Tagged: ${uniqueTags.join(", ")}`);
|
|
317
317
|
}
|
|
318
|
+
|
|
319
|
+
if (options.push) {
|
|
320
|
+
await gitPush(cwd, uniqueTags);
|
|
321
|
+
console.log("Pushed to remote.");
|
|
322
|
+
}
|
|
318
323
|
}
|
|
319
324
|
|
|
320
325
|
console.log("Done.");
|