@docupace/pipeline 1.0.80 → 1.0.81-alpha.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docupace/pipeline",
3
- "version": "1.0.80",
3
+ "version": "1.0.81-alpha.1",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {
@@ -428,6 +428,10 @@ async function mergeAll(verbose = false) {
428
428
  verbose,
429
429
  );
430
430
 
431
+ if (i < config.mergeBranches - 1) {
432
+ await new Promise((res) => setTimeout(res, 1000));
433
+ }
434
+
431
435
  if (!branchResult.success) {
432
436
  console.log(`Exiting due to failure of one or more merges`);
433
437
  process.exit(1);
@@ -216,9 +216,27 @@ function mergeIntoTarget(
216
216
  stdio: verbose ? 'inherit' : 'pipe',
217
217
  });
218
218
 
219
- execSync(`git branch -d ${mergeBranchName}`, {
220
- stdio: verbose ? 'inherit' : 'pipe',
221
- });
219
+ // Delete local merge branch
220
+ try {
221
+ execSync(`git branch -d ${mergeBranchName}`, {
222
+ stdio: 'pipe',
223
+ });
224
+ if (verbose)
225
+ console.log(`🗑️ Deleted local merge branch: ${mergeBranchName}`);
226
+ } catch {
227
+ // Branch doesn't exist, which is fine
228
+ }
229
+
230
+ // Delete remote merge branch
231
+ try {
232
+ execSync(`git push origin --delete ${mergeBranchName}`, {
233
+ stdio: 'pipe',
234
+ });
235
+ if (verbose)
236
+ console.log(`🗑️ Deleted remote merge branch: ${mergeBranchName}`);
237
+ } catch {
238
+ // Remote branch doesn't exist, which is fine
239
+ }
222
240
 
223
241
  if (verbose) console.log(`✅ Successfully merged into ${targetBranch}`);
224
242
  } else {
@@ -269,6 +287,56 @@ function cleanupFailedMerge(verbose = false) {
269
287
  }
270
288
  }
271
289
 
290
+ /**
291
+ * Check if source branch has uncommitted changesets
292
+ */
293
+ function checkForUncommittedChangesets(sourceBranch, verbose = false) {
294
+ if (verbose)
295
+ console.log(`🔍 Checking for uncommitted changesets in ${sourceBranch}`);
296
+
297
+ // Store current branch
298
+ const currentBranch = execSync('git branch --show-current', {
299
+ encoding: 'utf8',
300
+ stdio: 'pipe',
301
+ }).trim();
302
+
303
+ try {
304
+ // Checkout source branch
305
+ execSync(`git checkout ${sourceBranch}`, {
306
+ stdio: 'pipe',
307
+ });
308
+
309
+ // Check for .md files in .changeset directory (excluding README.md)
310
+ try {
311
+ const changesetFiles = execSync(
312
+ 'find .changeset -name "*.md" -not -name "README.md" 2>/dev/null | head -1',
313
+ {
314
+ encoding: 'utf8',
315
+ stdio: 'pipe',
316
+ },
317
+ ).trim();
318
+
319
+ if (changesetFiles) {
320
+ throw new Error(
321
+ `Cannot merge a branch where version has not been bumped. Found changesets in ${sourceBranch}`,
322
+ );
323
+ }
324
+ } catch (error) {
325
+ if (error.message.includes('Cannot merge')) {
326
+ throw error;
327
+ }
328
+ // If find command fails (no .changeset directory), that's fine
329
+ }
330
+
331
+ if (verbose) console.log('✅ No uncommitted changesets found');
332
+ } finally {
333
+ // Return to original branch
334
+ execSync(`git checkout ${currentBranch}`, {
335
+ stdio: 'pipe',
336
+ });
337
+ }
338
+ }
339
+
272
340
  export function setupMerge(program) {
273
341
  program
274
342
  .command('merge')
@@ -306,6 +374,11 @@ export function setupMerge(program) {
306
374
  );
307
375
  }
308
376
 
377
+ // Check for uncommitted changesets in source branch
378
+ if (!mergeFail && !mergeSuccess) {
379
+ checkForUncommittedChangesets(sourceBranch, verbose);
380
+ }
381
+
309
382
  // 1. Create merge branch from target branch
310
383
  const mergeBranchName = createMergeBranch(
311
384
  sourceBranch,