@panoptic-it-solutions/coolify-setup 1.1.3 → 1.1.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/dist/generator.js CHANGED
@@ -25,21 +25,22 @@ function addEsbuildToPackageJson(packageManager) {
25
25
  if (!packageJson.devDependencies) {
26
26
  packageJson.devDependencies = {};
27
27
  }
28
+ let addedEsbuild = false;
28
29
  // Add esbuild if not already present
29
30
  if (!packageJson.devDependencies.esbuild) {
30
31
  packageJson.devDependencies.esbuild = '^0.25.0';
31
32
  writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
32
- // Update the lockfile so Docker build works with frozen-lockfile
33
- const installCmd = packageManager === 'pnpm'
34
- ? 'pnpm install'
35
- : packageManager === 'yarn'
36
- ? 'yarn install'
37
- : 'npm install';
38
- console.log(`Running ${installCmd} to update lockfile...`);
39
- execSync(installCmd, { stdio: 'inherit', cwd: process.cwd() });
40
- return true;
33
+ addedEsbuild = true;
41
34
  }
42
- return false;
35
+ // Always run install to ensure lockfile is in sync
36
+ const installCmd = packageManager === 'pnpm'
37
+ ? 'pnpm install'
38
+ : packageManager === 'yarn'
39
+ ? 'yarn install'
40
+ : 'npm install';
41
+ console.log(`Running ${installCmd} to ensure lockfile is in sync...`);
42
+ execSync(installCmd, { stdio: 'inherit', cwd: process.cwd() });
43
+ return addedEsbuild;
43
44
  }
44
45
  catch (error) {
45
46
  console.log('Warning: Failed to update package.json:', error);
package/dist/git.js CHANGED
@@ -150,17 +150,9 @@ export async function setupGitHub(projectName) {
150
150
  // Don't proceed with operations that would push to the wrong repo
151
151
  return result;
152
152
  }
153
- // Remote exists and is correct, just push
154
- try {
155
- run('git push origin HEAD');
156
- result.repoPushed = true;
157
- }
158
- catch (error) {
159
- result.warnings.push(`Failed to push to existing remote: ${error}`);
160
- }
161
153
  }
162
154
  else {
163
- // Create the repository
155
+ // Create the repository (pushes current branch)
164
156
  try {
165
157
  await runAsync(`gh repo create ${ORG}/${projectName} --private --source=. --push`);
166
158
  result.repoCreated = true;
@@ -170,35 +162,57 @@ export async function setupGitHub(projectName) {
170
162
  throw new Error(`Failed to create repository: ${error}`);
171
163
  }
172
164
  }
173
- // Ensure we're on main and push
174
- const currentBranch = run('git branch --show-current');
175
- if (currentBranch !== 'main') {
176
- run('git checkout -b main 2>/dev/null || git checkout main');
177
- }
178
- // Push main
165
+ // Ensure we're on develop branch and push to it
179
166
  try {
180
- run('git push origin main');
181
- result.mainBranchPushed = true;
167
+ const currentBranch = run('git branch --show-current');
168
+ if (currentBranch !== 'develop') {
169
+ // Check if develop exists locally
170
+ try {
171
+ run('git checkout develop');
172
+ }
173
+ catch {
174
+ // Create develop from current branch
175
+ run('git checkout -b develop');
176
+ }
177
+ }
178
+ run('git push origin develop -u');
179
+ result.developBranchCreated = true;
180
+ result.repoPushed = true;
182
181
  }
183
182
  catch {
184
- result.warnings.push('Failed to push main branch (may already exist)');
183
+ result.warnings.push('Failed to push develop branch');
185
184
  }
186
- // Create staging branch from main
185
+ // Create main branch from develop if it doesn't exist
187
186
  try {
188
- run('git push origin main:staging');
189
- result.stagingBranchCreated = true;
187
+ // Check if main exists remotely
188
+ run('git ls-remote --exit-code --heads origin main');
189
+ result.mainBranchPushed = true; // Already exists
190
190
  }
191
191
  catch {
192
- result.warnings.push('Failed to create staging branch (may already exist)');
192
+ // Main doesn't exist, create it from develop
193
+ try {
194
+ run('git push origin develop:main');
195
+ result.mainBranchPushed = true;
196
+ }
197
+ catch {
198
+ result.warnings.push('Failed to create main branch');
199
+ }
193
200
  }
194
- // Create and checkout develop branch
201
+ // Create staging branch from develop if it doesn't exist
195
202
  try {
196
- run('git checkout -b develop 2>/dev/null || git checkout develop');
197
- run('git push origin develop -u');
198
- result.developBranchCreated = true;
203
+ // Check if staging exists remotely
204
+ run('git ls-remote --exit-code --heads origin staging');
205
+ result.stagingBranchCreated = true; // Already exists
199
206
  }
200
207
  catch {
201
- result.warnings.push('Failed to create develop branch (may already exist)');
208
+ // Staging doesn't exist, create it from develop
209
+ try {
210
+ run('git push origin develop:staging');
211
+ result.stagingBranchCreated = true;
212
+ }
213
+ catch {
214
+ result.warnings.push('Failed to create staging branch');
215
+ }
202
216
  }
203
217
  // Set develop as default branch
204
218
  try {
package/dist/index.js CHANGED
@@ -109,25 +109,7 @@ async function main() {
109
109
  console.log(chalk.green(' ✓ scripts/migrate.ts'));
110
110
  }
111
111
  }
112
- // Commit and push to develop
113
- console.log(chalk.bold('\nCommitting and pushing to develop...'));
114
- try {
115
- const commitResult = await commitAndPushToDevelop(generatedFiles);
116
- if (commitResult.committed) {
117
- console.log(chalk.green(' ✓ Committed changes'));
118
- }
119
- if (commitResult.pushed) {
120
- console.log(chalk.green(' ✓ Pushed to develop branch'));
121
- }
122
- for (const warning of commitResult.warnings) {
123
- console.log(chalk.yellow(` ⚠ ${warning}`));
124
- }
125
- }
126
- catch (error) {
127
- console.log(chalk.yellow(` ⚠ Failed to commit/push: ${error}`));
128
- console.log(chalk.yellow(' You may need to manually commit and push the generated files'));
129
- }
130
- // Setup GitHub
112
+ // Setup GitHub first (creates repo/remote if needed)
131
113
  if (response.createRepo) {
132
114
  console.log(chalk.bold('\nSetting up GitHub...'));
133
115
  try {
@@ -139,17 +121,14 @@ async function main() {
139
121
  else if (result.existingRemote) {
140
122
  console.log(chalk.yellow(` ⚠ Using existing remote: ${result.existingRemote}`));
141
123
  }
142
- if (result.repoPushed) {
143
- console.log(chalk.green(' ✓ Pushed to remote'));
124
+ if (result.developBranchCreated) {
125
+ console.log(chalk.green(' ✓ Pushed to develop branch'));
144
126
  }
145
127
  if (result.mainBranchPushed) {
146
- console.log(chalk.green(' ✓ Pushed main branch'));
128
+ console.log(chalk.green(' ✓ Created/verified main branch'));
147
129
  }
148
130
  if (result.stagingBranchCreated) {
149
- console.log(chalk.green(' ✓ Created staging branch'));
150
- }
151
- if (result.developBranchCreated) {
152
- console.log(chalk.green(' ✓ Created develop branch'));
131
+ console.log(chalk.green(' ✓ Created/verified staging branch'));
153
132
  }
154
133
  if (result.defaultBranchSet) {
155
134
  console.log(chalk.green(' ✓ Set develop as default branch'));
@@ -169,6 +148,24 @@ async function main() {
169
148
  console.log(chalk.yellow(' You can manually run: gh repo create Panoptic-IT-Solutions/' + response.projectName));
170
149
  }
171
150
  }
151
+ // Commit and push generated files to develop
152
+ console.log(chalk.bold('\nCommitting and pushing to develop...'));
153
+ try {
154
+ const commitResult = await commitAndPushToDevelop(generatedFiles);
155
+ if (commitResult.committed) {
156
+ console.log(chalk.green(' ✓ Committed changes'));
157
+ }
158
+ if (commitResult.pushed) {
159
+ console.log(chalk.green(' ✓ Pushed to develop branch'));
160
+ }
161
+ for (const warning of commitResult.warnings) {
162
+ console.log(chalk.yellow(` ⚠ ${warning}`));
163
+ }
164
+ }
165
+ catch (error) {
166
+ console.log(chalk.yellow(` ⚠ Failed to commit/push: ${error}`));
167
+ console.log(chalk.yellow(' You may need to manually commit and push the generated files'));
168
+ }
172
169
  console.log(chalk.bold.green('\n✅ Setup complete!\n'));
173
170
  console.log('Next steps:');
174
171
  console.log(chalk.cyan(' 1. Review the generated files'));
@@ -80,6 +80,14 @@ ENV NODE_ENV=production
80
80
  ENV POSTGRES_URL=postgres://placeholder:placeholder@localhost:5432/placeholder
81
81
  ENV REDIS_URL=redis://localhost:6379
82
82
 
83
+ # Kinde auth placeholder values for build
84
+ ENV KINDE_ISSUER_URL=https://placeholder.kinde.com
85
+ ENV KINDE_CLIENT_ID=placeholder
86
+ ENV KINDE_CLIENT_SECRET=placeholder
87
+ ENV KINDE_POST_LOGOUT_REDIRECT_URL=http://localhost:3000
88
+ ENV KINDE_POST_LOGIN_REDIRECT_URL=http://localhost:3000
89
+ ENV KINDE_SITE_URL=http://localhost:3000
90
+
83
91
  # Build the application
84
92
  RUN ${buildCmd}
85
93
  ${migrationBundle}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoptic-it-solutions/coolify-setup",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "CLI tool for setting up Coolify deployment on Panoptic projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",