@eldrforge/kodrdriv 1.2.12 → 1.2.14
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/dist/arguments.js +13 -4
- package/dist/arguments.js.map +1 -1
- package/dist/commands/development.js +133 -3
- package/dist/commands/development.js.map +1 -1
- package/dist/commands/publish.js +194 -135
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.js +12 -10
- package/dist/commands/release.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/util/git.js +58 -30
- package/dist/util/git.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/publish.js
CHANGED
|
@@ -446,7 +446,7 @@ const execute = async (runConfig)=>{
|
|
|
446
446
|
if (pr) {
|
|
447
447
|
logger.info(`Found existing pull request for branch: ${pr.html_url}`);
|
|
448
448
|
} else {
|
|
449
|
-
var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7;
|
|
449
|
+
var _runConfig_publish4, _runConfig_publish5, _runConfig_publish6, _runConfig_publish7, _runConfig_publish8, _runConfig_publish9, _runConfig_publish10, _runConfig_publish11;
|
|
450
450
|
logger.info('No open pull request found, starting new release publishing process...');
|
|
451
451
|
// STEP 1: Prepare for release (update dependencies and run prepublish checks) with NO version bump yet
|
|
452
452
|
logger.verbose('Preparing for release: switching from workspace to remote dependencies.');
|
|
@@ -476,103 +476,108 @@ const execute = async (runConfig)=>{
|
|
|
476
476
|
logger.verbose('No dependency changes to commit, skipping commit.');
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
// STEP 3: Merge target branch into working branch
|
|
480
|
-
|
|
481
|
-
if (
|
|
482
|
-
logger.
|
|
479
|
+
// STEP 3: Merge target branch into working branch (optional - now skipped by default since post-publish sync keeps branches in sync)
|
|
480
|
+
const skipPreMerge = ((_runConfig_publish5 = runConfig.publish) === null || _runConfig_publish5 === void 0 ? void 0 : _runConfig_publish5.skipPrePublishMerge) !== false; // Default to true (skip)
|
|
481
|
+
if (skipPreMerge) {
|
|
482
|
+
logger.verbose(`⏭️ Skipping pre-publish merge (post-publish sync will handle branch synchronization)`);
|
|
483
483
|
} else {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
mergeSucceeded =
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
'
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
484
|
+
logger.info(`Merging target branch '${targetBranch}' into current branch to avoid version conflicts...`);
|
|
485
|
+
if (isDryRun) {
|
|
486
|
+
logger.info(`Would merge ${targetBranch} into current branch`);
|
|
487
|
+
} else {
|
|
488
|
+
// Fetch the latest target branch
|
|
489
|
+
try {
|
|
490
|
+
await run(`git fetch origin ${targetBranch}:${targetBranch}`);
|
|
491
|
+
logger.info(`✅ Fetched latest ${targetBranch}`);
|
|
492
|
+
} catch (fetchError) {
|
|
493
|
+
logger.warn(`⚠️ Could not fetch ${targetBranch}: ${fetchError.message}`);
|
|
494
|
+
logger.warn('Continuing without merge - PR may have conflicts...');
|
|
495
|
+
}
|
|
496
|
+
// Check if merge is needed (avoid unnecessary merge commits)
|
|
497
|
+
try {
|
|
498
|
+
const { stdout: mergeBase } = await run(`git merge-base HEAD ${targetBranch}`);
|
|
499
|
+
const { stdout: targetCommit } = await run(`git rev-parse ${targetBranch}`);
|
|
500
|
+
if (mergeBase.trim() === targetCommit.trim()) {
|
|
501
|
+
logger.info(`ℹ️ Already up-to-date with ${targetBranch}, no merge needed`);
|
|
502
|
+
} else {
|
|
503
|
+
// Try to merge target branch into current branch
|
|
504
|
+
let mergeSucceeded = false;
|
|
505
|
+
try {
|
|
506
|
+
await run(`git merge ${targetBranch} --no-edit -m "Merge ${targetBranch} to sync before version bump"`);
|
|
507
|
+
logger.info(`✅ Merged ${targetBranch} into current branch`);
|
|
508
|
+
mergeSucceeded = true;
|
|
509
|
+
} catch (mergeError) {
|
|
510
|
+
// If merge conflicts occur, check if they're only in version-related files
|
|
511
|
+
const errorText = [
|
|
512
|
+
mergeError.message || '',
|
|
513
|
+
mergeError.stdout || '',
|
|
514
|
+
mergeError.stderr || ''
|
|
515
|
+
].join(' ');
|
|
516
|
+
if (errorText.includes('CONFLICT')) {
|
|
517
|
+
logger.warn(`⚠️ Merge conflicts detected, attempting automatic resolution...`);
|
|
518
|
+
// Get list of conflicted files
|
|
519
|
+
const { stdout: conflictedFiles } = await run('git diff --name-only --diff-filter=U');
|
|
520
|
+
const conflicts = conflictedFiles.trim().split('\n').filter(Boolean);
|
|
521
|
+
logger.verbose(`Conflicted files: ${conflicts.join(', ')}`);
|
|
522
|
+
// Check if conflicts are only in package.json and package-lock.json
|
|
523
|
+
const versionFiles = [
|
|
524
|
+
'package.json',
|
|
525
|
+
'package-lock.json'
|
|
526
|
+
];
|
|
527
|
+
const nonVersionConflicts = conflicts.filter((f)=>!versionFiles.includes(f));
|
|
528
|
+
if (nonVersionConflicts.length > 0) {
|
|
529
|
+
logger.error(`❌ Cannot auto-resolve: conflicts in non-version files: ${nonVersionConflicts.join(', ')}`);
|
|
530
|
+
logger.error('');
|
|
531
|
+
logger.error('Please resolve conflicts manually:');
|
|
532
|
+
logger.error(' 1. Resolve conflicts in the files listed above');
|
|
533
|
+
logger.error(' 2. git add <resolved-files>');
|
|
534
|
+
logger.error(' 3. git commit');
|
|
535
|
+
logger.error(' 4. kodrdriv publish (to continue)');
|
|
536
|
+
logger.error('');
|
|
537
|
+
throw new Error(`Merge conflicts in non-version files. Please resolve manually.`);
|
|
538
|
+
}
|
|
539
|
+
// Auto-resolve version conflicts by accepting current branch versions
|
|
540
|
+
// (keep our working branch's version, which is likely already updated)
|
|
541
|
+
logger.info(`Auto-resolving version conflicts by keeping current branch versions...`);
|
|
542
|
+
for (const file of conflicts){
|
|
543
|
+
if (versionFiles.includes(file)) {
|
|
544
|
+
await run(`git checkout --ours ${file}`);
|
|
545
|
+
await run(`git add ${file}`);
|
|
546
|
+
logger.verbose(`Resolved ${file} using current branch version`);
|
|
547
|
+
}
|
|
543
548
|
}
|
|
549
|
+
// Complete the merge
|
|
550
|
+
await run(`git commit --no-edit -m "Merge ${targetBranch} to sync before version bump (auto-resolved version conflicts)"`);
|
|
551
|
+
logger.info(`✅ Auto-resolved version conflicts and completed merge`);
|
|
552
|
+
mergeSucceeded = true;
|
|
553
|
+
} else {
|
|
554
|
+
// Not a conflict error, re-throw
|
|
555
|
+
throw mergeError;
|
|
544
556
|
}
|
|
545
|
-
// Complete the merge
|
|
546
|
-
await run(`git commit --no-edit -m "Merge ${targetBranch} to sync before version bump (auto-resolved version conflicts)"`);
|
|
547
|
-
logger.info(`✅ Auto-resolved version conflicts and completed merge`);
|
|
548
|
-
mergeSucceeded = true;
|
|
549
|
-
} else {
|
|
550
|
-
// Not a conflict error, re-throw
|
|
551
|
-
throw mergeError;
|
|
552
557
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
558
|
+
// Only run npm install if merge actually happened
|
|
559
|
+
if (mergeSucceeded) {
|
|
560
|
+
// Run npm install to update package-lock.json based on merged package.json
|
|
561
|
+
logger.info('Running npm install after merge...');
|
|
562
|
+
await run('npm install');
|
|
563
|
+
logger.info('✅ npm install completed');
|
|
564
|
+
// Commit any changes from npm install (e.g., package-lock.json updates)
|
|
565
|
+
const { stdout: mergeChangesStatus } = await run('git status --porcelain');
|
|
566
|
+
if (mergeChangesStatus.trim()) {
|
|
567
|
+
logger.verbose('Staging post-merge changes for commit');
|
|
568
|
+
await run('git add package.json package-lock.json');
|
|
569
|
+
if (await hasStagedChanges()) {
|
|
570
|
+
logger.verbose('Committing post-merge changes...');
|
|
571
|
+
await execute$1(runConfig);
|
|
572
|
+
}
|
|
568
573
|
}
|
|
569
574
|
}
|
|
570
575
|
}
|
|
576
|
+
} catch (error) {
|
|
577
|
+
// Only catch truly unexpected errors here
|
|
578
|
+
logger.error(`❌ Unexpected error during merge: ${error.message}`);
|
|
579
|
+
throw error;
|
|
571
580
|
}
|
|
572
|
-
} catch (error) {
|
|
573
|
-
// Only catch truly unexpected errors here
|
|
574
|
-
logger.error(`❌ Unexpected error during merge: ${error.message}`);
|
|
575
|
-
throw error;
|
|
576
581
|
}
|
|
577
582
|
}
|
|
578
583
|
// STEP 4: Determine and set target version AFTER checks, dependency commit, and target branch merge
|
|
@@ -582,7 +587,7 @@ const execute = async (runConfig)=>{
|
|
|
582
587
|
logger.info('Would determine target version and update package.json');
|
|
583
588
|
newVersion = '1.0.0'; // Mock version for dry run
|
|
584
589
|
} else {
|
|
585
|
-
var
|
|
590
|
+
var _runConfig_publish12;
|
|
586
591
|
const packageJsonContents = await storage.readFile('package.json', 'utf-8');
|
|
587
592
|
const parsed = safeJsonParse(packageJsonContents, 'package.json');
|
|
588
593
|
const packageJson = validatePackageJson(parsed, 'package.json');
|
|
@@ -599,9 +604,9 @@ const execute = async (runConfig)=>{
|
|
|
599
604
|
// Update targetBranch for the rest of the function
|
|
600
605
|
targetBranch = finalTargetBranch;
|
|
601
606
|
} else {
|
|
602
|
-
var
|
|
607
|
+
var _runConfig_publish13;
|
|
603
608
|
// Use existing logic for backward compatibility
|
|
604
|
-
const targetVersionInput = ((
|
|
609
|
+
const targetVersionInput = ((_runConfig_publish13 = runConfig.publish) === null || _runConfig_publish13 === void 0 ? void 0 : _runConfig_publish13.targetVersion) || 'patch';
|
|
605
610
|
proposedVersion = calculateTargetVersion(currentVersion, targetVersionInput);
|
|
606
611
|
}
|
|
607
612
|
const targetTagName = `v${proposedVersion}`;
|
|
@@ -609,9 +614,9 @@ const execute = async (runConfig)=>{
|
|
|
609
614
|
if (tagExists) {
|
|
610
615
|
throw new Error(`Tag ${targetTagName} already exists. Please choose a different version or delete the existing tag.`);
|
|
611
616
|
}
|
|
612
|
-
if ((
|
|
613
|
-
var
|
|
614
|
-
newVersion = await confirmVersionInteractively(currentVersion, proposedVersion, (
|
|
617
|
+
if ((_runConfig_publish12 = runConfig.publish) === null || _runConfig_publish12 === void 0 ? void 0 : _runConfig_publish12.interactive) {
|
|
618
|
+
var _runConfig_publish14;
|
|
619
|
+
newVersion = await confirmVersionInteractively(currentVersion, proposedVersion, (_runConfig_publish14 = runConfig.publish) === null || _runConfig_publish14 === void 0 ? void 0 : _runConfig_publish14.targetVersion);
|
|
615
620
|
const confirmedTagName = `v${newVersion}`;
|
|
616
621
|
const confirmedTagExists = await checkIfTagExists(confirmedTagName);
|
|
617
622
|
if (confirmedTagExists) {
|
|
@@ -639,33 +644,33 @@ const execute = async (runConfig)=>{
|
|
|
639
644
|
}
|
|
640
645
|
}
|
|
641
646
|
logger.info('Generating release notes...');
|
|
647
|
+
// Use the existing currentBranch variable for tag detection
|
|
648
|
+
logger.debug(`Current branch for release notes: ${currentBranch}`);
|
|
642
649
|
// Create a modified config for release notes generation that includes the publish --from, --interactive, and --from-main options
|
|
643
650
|
const releaseConfig = {
|
|
644
651
|
...runConfig
|
|
645
652
|
};
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
fromMain: runConfig.publish.fromMain
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
if (runConfig.publish.from) {
|
|
661
|
-
logger.verbose(`Using custom 'from' reference for release notes: ${runConfig.publish.from}`);
|
|
662
|
-
}
|
|
663
|
-
if (runConfig.publish.interactive) {
|
|
664
|
-
logger.verbose('Interactive mode enabled for release notes generation');
|
|
665
|
-
}
|
|
666
|
-
if (runConfig.publish.fromMain) {
|
|
667
|
-
logger.verbose('Forcing comparison against main branch for release notes');
|
|
653
|
+
releaseConfig.release = {
|
|
654
|
+
...runConfig.release,
|
|
655
|
+
currentBranch: currentBranch,
|
|
656
|
+
...((_runConfig_publish6 = runConfig.publish) === null || _runConfig_publish6 === void 0 ? void 0 : _runConfig_publish6.from) && {
|
|
657
|
+
from: runConfig.publish.from
|
|
658
|
+
},
|
|
659
|
+
...((_runConfig_publish7 = runConfig.publish) === null || _runConfig_publish7 === void 0 ? void 0 : _runConfig_publish7.interactive) && {
|
|
660
|
+
interactive: runConfig.publish.interactive
|
|
661
|
+
},
|
|
662
|
+
...((_runConfig_publish8 = runConfig.publish) === null || _runConfig_publish8 === void 0 ? void 0 : _runConfig_publish8.fromMain) && {
|
|
663
|
+
fromMain: runConfig.publish.fromMain
|
|
668
664
|
}
|
|
665
|
+
};
|
|
666
|
+
if ((_runConfig_publish9 = runConfig.publish) === null || _runConfig_publish9 === void 0 ? void 0 : _runConfig_publish9.from) {
|
|
667
|
+
logger.verbose(`Using custom 'from' reference for release notes: ${runConfig.publish.from}`);
|
|
668
|
+
}
|
|
669
|
+
if ((_runConfig_publish10 = runConfig.publish) === null || _runConfig_publish10 === void 0 ? void 0 : _runConfig_publish10.interactive) {
|
|
670
|
+
logger.verbose('Interactive mode enabled for release notes generation');
|
|
671
|
+
}
|
|
672
|
+
if ((_runConfig_publish11 = runConfig.publish) === null || _runConfig_publish11 === void 0 ? void 0 : _runConfig_publish11.fromMain) {
|
|
673
|
+
logger.verbose('Forcing comparison against main branch for release notes');
|
|
669
674
|
}
|
|
670
675
|
const releaseSummary = await execute$2(releaseConfig);
|
|
671
676
|
if (isDryRun) {
|
|
@@ -702,12 +707,12 @@ const execute = async (runConfig)=>{
|
|
|
702
707
|
}
|
|
703
708
|
logger.info(`Waiting for PR #${pr.number} checks to complete...`);
|
|
704
709
|
if (!isDryRun) {
|
|
705
|
-
var
|
|
710
|
+
var _runConfig_publish15, _runConfig_publish16, _runConfig_publish17;
|
|
706
711
|
// Configure timeout and user confirmation behavior
|
|
707
|
-
const timeout = ((
|
|
708
|
-
const senditMode = ((
|
|
712
|
+
const timeout = ((_runConfig_publish15 = runConfig.publish) === null || _runConfig_publish15 === void 0 ? void 0 : _runConfig_publish15.checksTimeout) || KODRDRIV_DEFAULTS.publish.checksTimeout;
|
|
713
|
+
const senditMode = ((_runConfig_publish16 = runConfig.publish) === null || _runConfig_publish16 === void 0 ? void 0 : _runConfig_publish16.sendit) || false;
|
|
709
714
|
// sendit flag overrides skipUserConfirmation - if sendit is true, skip confirmation
|
|
710
|
-
const skipUserConfirmation = senditMode || ((
|
|
715
|
+
const skipUserConfirmation = senditMode || ((_runConfig_publish17 = runConfig.publish) === null || _runConfig_publish17 === void 0 ? void 0 : _runConfig_publish17.skipUserConfirmation) || false;
|
|
711
716
|
await waitForPullRequestChecks(pr.number, {
|
|
712
717
|
timeout,
|
|
713
718
|
skipUserConfirmation
|
|
@@ -908,9 +913,9 @@ const execute = async (runConfig)=>{
|
|
|
908
913
|
}
|
|
909
914
|
logger.info('Creating GitHub release...');
|
|
910
915
|
if (isDryRun) {
|
|
911
|
-
var
|
|
916
|
+
var _runConfig_publish18;
|
|
912
917
|
logger.info('Would read package.json version and create GitHub release with retry logic');
|
|
913
|
-
const milestonesEnabled = !((
|
|
918
|
+
const milestonesEnabled = !((_runConfig_publish18 = runConfig.publish) === null || _runConfig_publish18 === void 0 ? void 0 : _runConfig_publish18.noMilestones);
|
|
914
919
|
if (milestonesEnabled) {
|
|
915
920
|
logger.info('Would close milestone for released version');
|
|
916
921
|
} else {
|
|
@@ -926,11 +931,11 @@ const execute = async (runConfig)=>{
|
|
|
926
931
|
let retries = 3;
|
|
927
932
|
while(retries > 0){
|
|
928
933
|
try {
|
|
929
|
-
var
|
|
934
|
+
var _runConfig_publish19;
|
|
930
935
|
await createRelease(tagName, releaseTitle, releaseNotesContent);
|
|
931
936
|
logger.info(`GitHub release created successfully for tag: ${tagName}`);
|
|
932
937
|
// Close milestone for this version if enabled
|
|
933
|
-
const milestonesEnabled = !((
|
|
938
|
+
const milestonesEnabled = !((_runConfig_publish19 = runConfig.publish) === null || _runConfig_publish19 === void 0 ? void 0 : _runConfig_publish19.noMilestones);
|
|
934
939
|
if (milestonesEnabled) {
|
|
935
940
|
logger.info('🏁 Closing milestone for released version...');
|
|
936
941
|
const version = tagName.replace(/^v/, ''); // Remove 'v' prefix if present
|
|
@@ -963,12 +968,12 @@ const execute = async (runConfig)=>{
|
|
|
963
968
|
if (isDryRun) {
|
|
964
969
|
logger.info('Would monitor GitHub Actions workflows triggered by release');
|
|
965
970
|
} else {
|
|
966
|
-
var
|
|
967
|
-
const workflowTimeout = ((
|
|
968
|
-
const senditMode = ((
|
|
969
|
-
const skipUserConfirmation = senditMode || ((
|
|
971
|
+
var _runConfig_publish20, _runConfig_publish21, _runConfig_publish22, _runConfig_publish23;
|
|
972
|
+
const workflowTimeout = ((_runConfig_publish20 = runConfig.publish) === null || _runConfig_publish20 === void 0 ? void 0 : _runConfig_publish20.releaseWorkflowsTimeout) || KODRDRIV_DEFAULTS.publish.releaseWorkflowsTimeout;
|
|
973
|
+
const senditMode = ((_runConfig_publish21 = runConfig.publish) === null || _runConfig_publish21 === void 0 ? void 0 : _runConfig_publish21.sendit) || false;
|
|
974
|
+
const skipUserConfirmation = senditMode || ((_runConfig_publish22 = runConfig.publish) === null || _runConfig_publish22 === void 0 ? void 0 : _runConfig_publish22.skipUserConfirmation) || false;
|
|
970
975
|
// Get workflow names - either from config or auto-detect
|
|
971
|
-
let workflowNames = (
|
|
976
|
+
let workflowNames = (_runConfig_publish23 = runConfig.publish) === null || _runConfig_publish23 === void 0 ? void 0 : _runConfig_publish23.releaseWorkflowNames;
|
|
972
977
|
if (!workflowNames || workflowNames.length === 0) {
|
|
973
978
|
logger.info('No specific workflow names configured, auto-detecting workflows triggered by release events...');
|
|
974
979
|
try {
|
|
@@ -992,10 +997,64 @@ const execute = async (runConfig)=>{
|
|
|
992
997
|
} else {
|
|
993
998
|
logger.verbose('Skipping waiting for release workflows (disabled in config).');
|
|
994
999
|
}
|
|
995
|
-
// Switch to
|
|
996
|
-
logger.info(
|
|
997
|
-
|
|
998
|
-
|
|
1000
|
+
// Switch back to source branch and sync with target
|
|
1001
|
+
logger.info('');
|
|
1002
|
+
logger.info('🔄 Syncing source branch with target after publish...');
|
|
1003
|
+
await runWithDryRunSupport(`git checkout ${currentBranch}`, isDryRun);
|
|
1004
|
+
if (!isDryRun) {
|
|
1005
|
+
// Merge target into source (should be fast-forward since PR just merged)
|
|
1006
|
+
logger.info(`Merging ${targetBranch} into ${currentBranch}...`);
|
|
1007
|
+
try {
|
|
1008
|
+
await run(`git merge ${targetBranch} --ff-only`);
|
|
1009
|
+
logger.info(`✅ Merged ${targetBranch} into ${currentBranch}`);
|
|
1010
|
+
} catch (error) {
|
|
1011
|
+
// If ff-only fails, something is wrong - source diverged somehow
|
|
1012
|
+
logger.error(`❌ Failed to fast-forward merge ${targetBranch} into ${currentBranch}`);
|
|
1013
|
+
logger.error(' This suggests the source branch has commits not in target.');
|
|
1014
|
+
logger.error(' This should not happen after a successful PR merge.');
|
|
1015
|
+
logger.warn('⚠️ Attempting regular merge...');
|
|
1016
|
+
await run(`git merge ${targetBranch} --no-edit`);
|
|
1017
|
+
}
|
|
1018
|
+
// Determine version bump based on branch configuration
|
|
1019
|
+
let versionCommand = 'prepatch'; // Default
|
|
1020
|
+
let versionTag = 'dev'; // Default
|
|
1021
|
+
if (branchDependentVersioning && runConfig.branches) {
|
|
1022
|
+
const sourceBranchConfig = runConfig.branches[currentBranch];
|
|
1023
|
+
if (sourceBranchConfig === null || sourceBranchConfig === void 0 ? void 0 : sourceBranchConfig.version) {
|
|
1024
|
+
// Use configured version strategy for source branch
|
|
1025
|
+
if (sourceBranchConfig.version.increment) {
|
|
1026
|
+
versionCommand = `pre${sourceBranchConfig.version.increment}`;
|
|
1027
|
+
}
|
|
1028
|
+
if (sourceBranchConfig.version.tag) {
|
|
1029
|
+
versionTag = sourceBranchConfig.version.tag;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
// Bump to next development version
|
|
1034
|
+
logger.info(`Bumping to next development version...`);
|
|
1035
|
+
try {
|
|
1036
|
+
const { stdout: newVersion } = await run(`npm version ${versionCommand} --preid=${versionTag}`);
|
|
1037
|
+
logger.info(`✅ Version bumped to: ${newVersion.trim()}`);
|
|
1038
|
+
} catch (versionError) {
|
|
1039
|
+
logger.warn(`⚠️ Failed to bump version: ${versionError.message}`);
|
|
1040
|
+
logger.warn(' You may need to manually bump the version for next development cycle.');
|
|
1041
|
+
}
|
|
1042
|
+
// Push updated source branch
|
|
1043
|
+
logger.info(`Pushing updated ${currentBranch} branch...`);
|
|
1044
|
+
try {
|
|
1045
|
+
await run(`git push origin ${currentBranch}`);
|
|
1046
|
+
logger.info(`✅ Pushed ${currentBranch} to origin`);
|
|
1047
|
+
} catch (pushError) {
|
|
1048
|
+
logger.warn(`⚠️ Failed to push ${currentBranch}: ${pushError.message}`);
|
|
1049
|
+
logger.warn(` Please push manually: git push origin ${currentBranch}`);
|
|
1050
|
+
}
|
|
1051
|
+
} else {
|
|
1052
|
+
logger.info(`Would merge ${targetBranch} into ${currentBranch} with --ff-only`);
|
|
1053
|
+
logger.info(`Would bump version to next development version`);
|
|
1054
|
+
logger.info(`Would push ${currentBranch} to origin`);
|
|
1055
|
+
}
|
|
1056
|
+
logger.info('');
|
|
1057
|
+
logger.info(`✅ Publish complete - on ${currentBranch} with next development version`);
|
|
999
1058
|
};
|
|
1000
1059
|
|
|
1001
1060
|
export { execute };
|