bunset 1.0.2 → 1.0.4
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 +30 -20
- package/src/git.ts +9 -1
- package/src/index.ts +9 -5
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -82,26 +82,36 @@ export function resolveOptions(
|
|
|
82
82
|
isWs: boolean,
|
|
83
83
|
config: Partial<CliOptions> = {},
|
|
84
84
|
): CliOptions | Promise<CliOptions> {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
85
|
+
let values: ReturnType<typeof parseArgs>["values"];
|
|
86
|
+
try {
|
|
87
|
+
({ values } = parseArgs({
|
|
88
|
+
args: Bun.argv.slice(2),
|
|
89
|
+
options: {
|
|
90
|
+
all: { type: "boolean", default: false },
|
|
91
|
+
changed: { type: "boolean", default: false },
|
|
92
|
+
patch: { type: "boolean", default: false },
|
|
93
|
+
minor: { type: "boolean", default: false },
|
|
94
|
+
major: { type: "boolean", default: false },
|
|
95
|
+
commit: { type: "boolean", default: true },
|
|
96
|
+
tag: { type: "boolean", default: true },
|
|
97
|
+
"per-package-tags": { type: "boolean", default: false },
|
|
98
|
+
sections: { type: "string" },
|
|
99
|
+
"dry-run": { type: "boolean", default: false },
|
|
100
|
+
"filter-by-package": { type: "boolean", default: true },
|
|
101
|
+
"tag-prefix": { type: "string" },
|
|
102
|
+
debug: { type: "boolean", default: false },
|
|
103
|
+
help: { type: "boolean", short: "h", default: false },
|
|
104
|
+
},
|
|
105
|
+
strict: true,
|
|
106
|
+
}));
|
|
107
|
+
} catch (err) {
|
|
108
|
+
if (err instanceof TypeError && (err as any).code === "ERR_PARSE_ARGS_UNKNOWN_OPTION") {
|
|
109
|
+
console.error(err.message);
|
|
110
|
+
console.error("\nRun bunset --help to see available options.");
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
throw err;
|
|
114
|
+
}
|
|
105
115
|
|
|
106
116
|
if (values.help) {
|
|
107
117
|
printHelp();
|
package/src/git.ts
CHANGED
|
@@ -66,7 +66,15 @@ export async function commitAndTag(
|
|
|
66
66
|
): Promise<void> {
|
|
67
67
|
await $`git -C ${cwd} add -A`.quiet();
|
|
68
68
|
await $`git -C ${cwd} commit -m ${message}`.quiet();
|
|
69
|
+
const skipped: string[] = [];
|
|
69
70
|
for (const tag of tags) {
|
|
70
|
-
|
|
71
|
+
try {
|
|
72
|
+
await $`git -C ${cwd} tag ${tag}`.quiet();
|
|
73
|
+
} catch {
|
|
74
|
+
skipped.push(tag);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (skipped.length > 0) {
|
|
78
|
+
console.warn(`⚠ Skipped existing tags: ${skipped.join(", ")}`);
|
|
71
79
|
}
|
|
72
80
|
}
|
package/src/index.ts
CHANGED
|
@@ -204,6 +204,8 @@ if (options.dryRun) {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
const uniqueTags = [...new Set(tags)];
|
|
208
|
+
|
|
207
209
|
if (options.commit) {
|
|
208
210
|
const msg =
|
|
209
211
|
packages.length === 1
|
|
@@ -214,8 +216,8 @@ if (options.dryRun) {
|
|
|
214
216
|
console.log("Will not commit (--commit not set).");
|
|
215
217
|
}
|
|
216
218
|
|
|
217
|
-
if (
|
|
218
|
-
console.log(`Would tag: ${
|
|
219
|
+
if (uniqueTags.length > 0) {
|
|
220
|
+
console.log(`Would tag: ${uniqueTags.join(", ")}`);
|
|
219
221
|
} else if (!options.tag) {
|
|
220
222
|
console.log("Will not tag (--tag not set).");
|
|
221
223
|
}
|
|
@@ -264,15 +266,17 @@ for (const pkg of packages) {
|
|
|
264
266
|
}
|
|
265
267
|
}
|
|
266
268
|
|
|
269
|
+
const uniqueTags = [...new Set(tags)];
|
|
270
|
+
|
|
267
271
|
if (options.commit) {
|
|
268
272
|
const msg =
|
|
269
273
|
packages.length === 1
|
|
270
274
|
? `chore: release ${packages[0]!.name}@${(await Bun.file(packages[0]!.packageJsonPath).json()).version}`
|
|
271
275
|
: `chore: release ${packages.length} packages`;
|
|
272
|
-
await commitAndTag(cwd, msg, options.tag ?
|
|
276
|
+
await commitAndTag(cwd, msg, options.tag ? uniqueTags : []);
|
|
273
277
|
console.log(`Committed: ${msg}`);
|
|
274
|
-
if (
|
|
275
|
-
console.log(`Tagged: ${
|
|
278
|
+
if (uniqueTags.length > 0) {
|
|
279
|
+
console.log(`Tagged: ${uniqueTags.join(", ")}`);
|
|
276
280
|
}
|
|
277
281
|
}
|
|
278
282
|
|