ante-erp-cli 1.11.43 → 1.11.44

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": "ante-erp-cli",
3
- "version": "1.11.43",
3
+ "version": "1.11.44",
4
4
  "description": "Comprehensive CLI tool for managing ANTE ERP self-hosted installations",
5
5
  "type": "module",
6
6
  "bin": {
@@ -240,6 +240,7 @@ COMPANY_ID=1
240
240
  /**
241
241
  * Ensure customer app JWT configuration exists in .env file
242
242
  * @param {string} envFile - Path to .env file
243
+ * @returns {boolean} True if any modifications were made
243
244
  */
244
245
  function ensureCustomerAppJwtConfig(envFile) {
245
246
  let envContent = readFileSync(envFile, 'utf8');
@@ -314,6 +315,43 @@ function ensureCustomerAppJwtConfig(envFile) {
314
315
  return modified;
315
316
  }
316
317
 
318
+ /**
319
+ * Refresh docker-compose.yml to ensure it has latest environment variable mappings
320
+ * This regenerates the docker-compose.yml without adding new services
321
+ * @param {string} composeFile - Path to docker-compose.yml
322
+ * @param {string} envFile - Path to .env file
323
+ */
324
+ function refreshDockerCompose(composeFile, envFile) {
325
+ const envConfig = parseEnvFile(envFile);
326
+ const currentInstalled = detectInstalledApps(composeFile);
327
+
328
+ // Generate new docker-compose.yml with existing services only
329
+ const newCompose = generateDockerCompose({
330
+ frontendPort: parseInt(envConfig.FRONTEND_PORT) || 8080,
331
+ backendPort: parseInt(envConfig.BACKEND_PORT) || 3001,
332
+ gateAppPort: parseInt(envConfig.GATE_APP_PORT) || 8081,
333
+ guardianAppPort: parseInt(envConfig.GUARDIAN_APP_PORT) || 8082,
334
+ facialWebPort: parseInt(envConfig.FACIAL_WEB_PORT) || 8083,
335
+ posAppPort: parseInt(envConfig.POS_APP_PORT) || 8084,
336
+ clientAppPort: parseInt(envConfig.CLIENT_APP_PORT) || 9005,
337
+ installMain: true,
338
+ installGate: currentInstalled.hasGateApp,
339
+ installGuardian: currentInstalled.hasGuardianApp,
340
+ installFacial: currentInstalled.hasFacialWeb,
341
+ installPos: currentInstalled.hasPosApp,
342
+ installClient: currentInstalled.hasClientApp,
343
+ companyId: parseInt(envConfig.COMPANY_ID) || 1
344
+ });
345
+
346
+ // Backup existing docker-compose.yml
347
+ const timestamp = new Date().toISOString().split('.')[0].replace(/:/g, '-').replace('T', '_');
348
+ renameSync(composeFile, `${composeFile}.${timestamp}.bak`);
349
+
350
+ // Write new docker-compose.yml
351
+ writeFileSync(composeFile, newCompose);
352
+ console.log('✅ Docker Compose configuration refreshed');
353
+ }
354
+
317
355
  /**
318
356
  * Format step title with numbering
319
357
  * @param {number} step - Current step number
@@ -378,7 +416,13 @@ export async function update(options) {
378
416
 
379
417
  // Ensure customer app JWT configuration exists (run before tasks)
380
418
  console.log(chalk.gray('Checking customer app JWT configuration...'));
381
- ensureCustomerAppJwtConfig(envFile);
419
+ const envModified = ensureCustomerAppJwtConfig(envFile);
420
+
421
+ // Refresh docker-compose.yml if .env was modified to ensure containers get new variables
422
+ if (envModified) {
423
+ console.log(chalk.gray('Refreshing Docker Compose configuration...'));
424
+ refreshDockerCompose(composeFile, envFile);
425
+ }
382
426
 
383
427
  // Pre-calculate step numbers for each task (fixes step numbering bug)
384
428
  let currentStep = 0;