bunset 1.0.4 → 1.0.5

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.5
4
+
5
+ ### Bug Fixes
6
+
7
+ - only stage known changed files instead of git add -A
8
+
3
9
  ## 1.0.4
4
10
 
5
11
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunset",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "bin": {
package/src/git.ts CHANGED
@@ -63,8 +63,9 @@ export async function commitAndTag(
63
63
  cwd: string,
64
64
  message: string,
65
65
  tags: string[] = [],
66
+ files: string[] = [],
66
67
  ): Promise<void> {
67
- await $`git -C ${cwd} add -A`.quiet();
68
+ await $`git -C ${cwd} add ${files}`.quiet();
68
69
  await $`git -C ${cwd} commit -m ${message}`.quiet();
69
70
  const skipped: string[] = [];
70
71
  for (const tag of tags) {
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
+ import { $ } from "bun";
3
4
  import { resolveOptions } from "./cli.ts";
4
5
  import { loadConfig } from "./config.ts";
5
6
  import {
@@ -148,6 +149,7 @@ if (options.dryRun) {
148
149
  if (!dbg) console.log("--- Dry Run ---\n");
149
150
 
150
151
  const tags: string[] = [];
152
+ const filesToCommit: string[] = [];
151
153
 
152
154
  for (const pkg of packages) {
153
155
  const groups = getPackageGroups(pkg, parsed);
@@ -179,6 +181,7 @@ if (options.dryRun) {
179
181
  const oldVersion = pkg.version ?? "0.0.0";
180
182
  const newVersion = bumpVersion(oldVersion, options.bump);
181
183
  console.log(`${pkg.name}: ${oldVersion} → ${newVersion}`);
184
+ filesToCommit.push(pkg.packageJsonPath, `${pkg.path}/CHANGELOG.md`);
182
185
 
183
186
  const updatedDeps = await getUpdatedDependencies(
184
187
  cwd,
@@ -206,6 +209,8 @@ if (options.dryRun) {
206
209
 
207
210
  const uniqueTags = [...new Set(tags)];
208
211
 
212
+ filesToCommit.push(`${cwd}/bun.lock`);
213
+
209
214
  if (options.commit) {
210
215
  const msg =
211
216
  packages.length === 1
@@ -222,11 +227,15 @@ if (options.dryRun) {
222
227
  console.log("Will not tag (--tag not set).");
223
228
  }
224
229
 
225
- console.log("\nNo files were modified.");
230
+ console.log(`\nFiles that would be modified (${filesToCommit.length}):`);
231
+ for (const f of filesToCommit) {
232
+ console.log(` ${f}`);
233
+ }
226
234
  process.exit(0);
227
235
  }
228
236
 
229
237
  const tags: string[] = [];
238
+ const changedFiles: string[] = [];
230
239
 
231
240
  for (const pkg of packages) {
232
241
  const groups = getPackageGroups(pkg, parsed);
@@ -242,6 +251,7 @@ for (const pkg of packages) {
242
251
  pkg.packageJsonPath,
243
252
  options.bump,
244
253
  );
254
+ changedFiles.push(pkg.packageJsonPath);
245
255
  console.log(`${pkg.name}: ${oldVersion} → ${newVersion}`);
246
256
 
247
257
  const updatedDeps = await getUpdatedDependencies(
@@ -256,6 +266,7 @@ for (const pkg of packages) {
256
266
  options.sections,
257
267
  );
258
268
  await writeChangelog(pkg.path, entry);
269
+ changedFiles.push(`${pkg.path}/CHANGELOG.md`);
259
270
 
260
271
  if (options.tag) {
261
272
  if (options.perPackageTags) {
@@ -268,12 +279,17 @@ for (const pkg of packages) {
268
279
 
269
280
  const uniqueTags = [...new Set(tags)];
270
281
 
282
+ // Update lockfile after package.json versions changed
283
+ await $`bun install --lockfile-only`.cwd(cwd).quiet();
284
+ changedFiles.push(`${cwd}/bun.lock`);
285
+ debug("updated bun.lock");
286
+
271
287
  if (options.commit) {
272
288
  const msg =
273
289
  packages.length === 1
274
290
  ? `chore: release ${packages[0]!.name}@${(await Bun.file(packages[0]!.packageJsonPath).json()).version}`
275
291
  : `chore: release ${packages.length} packages`;
276
- await commitAndTag(cwd, msg, options.tag ? uniqueTags : []);
292
+ await commitAndTag(cwd, msg, options.tag ? uniqueTags : [], changedFiles);
277
293
  console.log(`Committed: ${msg}`);
278
294
  if (uniqueTags.length > 0) {
279
295
  console.log(`Tagged: ${uniqueTags.join(", ")}`);