@panoptic-it-solutions/coolify-setup 1.1.24 → 1.1.26

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.
Files changed (2) hide show
  1. package/dist/git.js +25 -3
  2. package/package.json +1 -1
package/dist/git.js CHANGED
@@ -89,10 +89,32 @@ export async function commitAndPushToDevelop(files, originalBranch) {
89
89
  }
90
90
  else {
91
91
  // On a feature branch - need to merge into develop
92
+ // First check if develop exists remotely
93
+ let developExistsRemotely = false;
92
94
  try {
93
95
  run('git fetch origin develop');
94
- // Develop exists remotely, checkout and merge feature branch
95
- run('git checkout develop');
96
+ developExistsRemotely = true;
97
+ }
98
+ catch {
99
+ // Develop doesn't exist remotely
100
+ }
101
+ if (developExistsRemotely) {
102
+ // Check if develop exists locally
103
+ let developExistsLocally = false;
104
+ try {
105
+ run('git rev-parse --verify develop');
106
+ developExistsLocally = true;
107
+ }
108
+ catch {
109
+ // develop doesn't exist locally
110
+ }
111
+ if (developExistsLocally) {
112
+ run('git checkout develop');
113
+ }
114
+ else {
115
+ run('git checkout -b develop origin/develop');
116
+ }
117
+ // Pull latest changes
96
118
  try {
97
119
  run('git pull --rebase origin develop');
98
120
  }
@@ -103,7 +125,7 @@ export async function commitAndPushToDevelop(files, originalBranch) {
103
125
  run(`git merge ${sourceBranch} --no-edit`);
104
126
  run('git push origin develop');
105
127
  }
106
- catch {
128
+ else {
107
129
  // Develop doesn't exist remotely, create it from source branch
108
130
  run(`git push origin ${sourceBranch}:develop`);
109
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",