genbox 1.0.59 → 1.0.60
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/commands/rebuild.js +5 -64
- package/package.json +1 -1
package/dist/commands/rebuild.js
CHANGED
|
@@ -244,19 +244,12 @@ function buildRebuildPayload(resolved, config, publicKey, privateKey, configLoad
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
//
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
content: setupScript,
|
|
253
|
-
permissions: '0755',
|
|
254
|
-
});
|
|
255
|
-
}
|
|
247
|
+
// NOTE: Setup script generation removed from CLI.
|
|
248
|
+
// The API generates a comprehensive setup script with clone commands at /root/setup-genbox.sh
|
|
249
|
+
// and copies it to /home/dev/setup-genbox.sh via runcmd. This avoids having two conflicting
|
|
250
|
+
// scripts in write_files where the CLI version lacked clone commands.
|
|
251
|
+
// The envFilesToMove variable is kept as API needs this info for .env file movement.
|
|
256
252
|
const postDetails = [];
|
|
257
|
-
if (setupScript) {
|
|
258
|
-
postDetails.push('su - dev -c "/home/dev/setup-genbox.sh"');
|
|
259
|
-
}
|
|
260
253
|
// Build repos
|
|
261
254
|
const repos = {};
|
|
262
255
|
for (const repo of resolved.repos) {
|
|
@@ -298,58 +291,6 @@ function validateGitCredentials(repos, gitToken, privateKey) {
|
|
|
298
291
|
}
|
|
299
292
|
return { warnings, errors };
|
|
300
293
|
}
|
|
301
|
-
/**
|
|
302
|
-
* Generate setup script
|
|
303
|
-
*/
|
|
304
|
-
function generateSetupScript(resolved, config, envFilesToMove = []) {
|
|
305
|
-
const lines = [
|
|
306
|
-
'#!/bin/bash',
|
|
307
|
-
'# Generated by genbox rebuild',
|
|
308
|
-
'set -e',
|
|
309
|
-
'',
|
|
310
|
-
];
|
|
311
|
-
if (envFilesToMove.length > 0) {
|
|
312
|
-
lines.push('# Move .env files from staging to app directories');
|
|
313
|
-
for (const { stagingName, targetPath } of envFilesToMove) {
|
|
314
|
-
lines.push(`if [ -f "/home/dev/.env-staging/${stagingName}" ]; then`);
|
|
315
|
-
lines.push(` mkdir -p "$(dirname "${targetPath}")"`);
|
|
316
|
-
lines.push(` mv "/home/dev/.env-staging/${stagingName}" "${targetPath}"`);
|
|
317
|
-
lines.push(` echo "Moved .env to ${targetPath}"`);
|
|
318
|
-
lines.push('fi');
|
|
319
|
-
}
|
|
320
|
-
lines.push('rm -rf /home/dev/.env-staging 2>/dev/null || true');
|
|
321
|
-
lines.push('');
|
|
322
|
-
}
|
|
323
|
-
if (resolved.repos.length > 0) {
|
|
324
|
-
lines.push(`cd ${resolved.repos[0].path} || exit 1`);
|
|
325
|
-
lines.push('');
|
|
326
|
-
}
|
|
327
|
-
lines.push('# Install dependencies');
|
|
328
|
-
lines.push('if [ -f "pnpm-lock.yaml" ]; then');
|
|
329
|
-
lines.push(' echo "Installing dependencies with pnpm..."');
|
|
330
|
-
lines.push(' pnpm install --frozen-lockfile');
|
|
331
|
-
lines.push('elif [ -f "yarn.lock" ]; then');
|
|
332
|
-
lines.push(' echo "Installing dependencies with yarn..."');
|
|
333
|
-
lines.push(' yarn install --frozen-lockfile');
|
|
334
|
-
lines.push('elif [ -f "bun.lockb" ]; then');
|
|
335
|
-
lines.push(' echo "Installing dependencies with bun..."');
|
|
336
|
-
lines.push(' bun install --frozen-lockfile');
|
|
337
|
-
lines.push('elif [ -f "package-lock.json" ]; then');
|
|
338
|
-
lines.push(' echo "Installing dependencies with npm..."');
|
|
339
|
-
lines.push(' npm ci');
|
|
340
|
-
lines.push('fi');
|
|
341
|
-
const hasLocalApi = resolved.apps.some(a => a.name === 'api' || a.type === 'backend');
|
|
342
|
-
if (hasLocalApi) {
|
|
343
|
-
lines.push('');
|
|
344
|
-
lines.push('echo "Starting Docker services..."');
|
|
345
|
-
lines.push('if [ -f "docker-compose.yml" ] || [ -f "compose.yml" ]; then');
|
|
346
|
-
lines.push(' docker compose up -d');
|
|
347
|
-
lines.push('fi');
|
|
348
|
-
}
|
|
349
|
-
lines.push('');
|
|
350
|
-
lines.push('echo "Setup complete!"');
|
|
351
|
-
return lines.join('\n');
|
|
352
|
-
}
|
|
353
294
|
/**
|
|
354
295
|
* Prompt for branch options interactively
|
|
355
296
|
*/
|