ante-erp-cli 1.11.23 ā 1.11.25
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 +1 -1
- package/src/commands/set-domain.js +124 -56
- package/src/commands/update.js +4 -13
package/package.json
CHANGED
|
@@ -402,73 +402,140 @@ export async function setDomain(options) {
|
|
|
402
402
|
if (hasPosApp) posAppUrl = buildURL(ipConfig.ip, ipConfig.posAppPort);
|
|
403
403
|
} else {
|
|
404
404
|
// Manual URL input (domain configuration)
|
|
405
|
-
|
|
405
|
+
|
|
406
|
+
// First, ask if using ante.ph domain setup
|
|
407
|
+
const antePhSetup = await inquirer.prompt([
|
|
406
408
|
{
|
|
407
|
-
type: '
|
|
408
|
-
name: '
|
|
409
|
-
message: '
|
|
410
|
-
default:
|
|
411
|
-
validate: validateUrl
|
|
409
|
+
type: 'confirm',
|
|
410
|
+
name: 'useAntePh',
|
|
411
|
+
message: 'Are you setting up domains on ante.ph?',
|
|
412
|
+
default: false
|
|
412
413
|
}
|
|
413
|
-
];
|
|
414
|
+
]);
|
|
414
415
|
|
|
415
|
-
if (
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
416
|
+
if (antePhSetup.useAntePh) {
|
|
417
|
+
// ante.ph subdomain-based setup
|
|
418
|
+
const subdomainPrompt = await inquirer.prompt([
|
|
419
|
+
{
|
|
420
|
+
type: 'input',
|
|
421
|
+
name: 'subdomain',
|
|
422
|
+
message: 'Enter subdomain prefix (e.g., "test" for test.ante.ph):',
|
|
423
|
+
validate: (input) => {
|
|
424
|
+
if (!input || input.trim() === '') {
|
|
425
|
+
return 'Subdomain cannot be empty';
|
|
426
|
+
}
|
|
427
|
+
// Validate subdomain format (alphanumeric and hyphens only)
|
|
428
|
+
if (!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/i.test(input.trim())) {
|
|
429
|
+
return 'Subdomain must contain only letters, numbers, and hyphens (cannot start or end with hyphen)';
|
|
430
|
+
}
|
|
431
|
+
return true;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
]);
|
|
424
435
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
|
|
436
|
+
const subdomain = subdomainPrompt.subdomain.trim();
|
|
437
|
+
|
|
438
|
+
// Auto-generate URLs with ante.ph pattern
|
|
439
|
+
frontendUrl = `https://${subdomain}.ante.ph`;
|
|
440
|
+
apiUrl = `https://${subdomain}-api.ante.ph`;
|
|
441
|
+
if (hasGateApp) gateAppUrl = `https://${subdomain}-gate.ante.ph`;
|
|
442
|
+
if (hasGuardianApp) guardianAppUrl = `https://${subdomain}-guardian.ante.ph`;
|
|
443
|
+
if (hasFacialWeb) facialWebUrl = `https://${subdomain}-fr.ante.ph`;
|
|
444
|
+
if (hasPosApp) posAppUrl = `https://${subdomain}-pos.ante.ph`;
|
|
445
|
+
|
|
446
|
+
// Display generated domains for confirmation
|
|
447
|
+
console.log(chalk.cyan('\nš Generated Domain Configuration:\n'));
|
|
448
|
+
console.log(chalk.gray(` Frontend: ${frontendUrl}`));
|
|
449
|
+
console.log(chalk.gray(` Backend API: ${apiUrl}`));
|
|
450
|
+
if (hasGateApp) console.log(chalk.gray(` Gate App: ${gateAppUrl}`));
|
|
451
|
+
if (hasGuardianApp) console.log(chalk.gray(` Guardian App: ${guardianAppUrl}`));
|
|
452
|
+
if (hasFacialWeb) console.log(chalk.gray(` Facial Web: ${facialWebUrl}`));
|
|
453
|
+
if (hasPosApp) console.log(chalk.gray(` POS App: ${posAppUrl}`));
|
|
454
|
+
console.log('');
|
|
455
|
+
|
|
456
|
+
const confirmDomains = await inquirer.prompt([
|
|
457
|
+
{
|
|
458
|
+
type: 'confirm',
|
|
459
|
+
name: 'confirmed',
|
|
460
|
+
message: 'Proceed with these domains?',
|
|
461
|
+
default: true
|
|
462
|
+
}
|
|
463
|
+
]);
|
|
434
464
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
465
|
+
if (!confirmDomains.confirmed) {
|
|
466
|
+
console.log(chalk.yellow('\nDomain setup cancelled. Please run the command again.\n'));
|
|
467
|
+
process.exit(0);
|
|
468
|
+
}
|
|
469
|
+
} else {
|
|
470
|
+
// Manual URL input for custom domains
|
|
471
|
+
const domainPrompts = [
|
|
472
|
+
{
|
|
473
|
+
type: 'input',
|
|
474
|
+
name: 'frontendUrl',
|
|
475
|
+
message: 'Frontend URL:\n Examples: https://staging.ante.ph or http://143.198.91.153:8080\n Enter URL',
|
|
476
|
+
default: currentFrontendUrl || 'http://localhost:8080',
|
|
477
|
+
validate: validateUrl
|
|
478
|
+
}
|
|
479
|
+
];
|
|
480
|
+
|
|
481
|
+
if (hasGateApp) {
|
|
482
|
+
domainPrompts.push({
|
|
483
|
+
type: 'input',
|
|
484
|
+
name: 'gateAppUrl',
|
|
485
|
+
message: 'Gate App URL:\n Examples: https://gate.ante.ph or http://143.198.91.153:8081\n Enter URL',
|
|
486
|
+
default: currentGateAppUrl || 'http://localhost:8081',
|
|
487
|
+
validate: validateUrl
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
if (hasGuardianApp) {
|
|
492
|
+
domainPrompts.push({
|
|
493
|
+
type: 'input',
|
|
494
|
+
name: 'guardianAppUrl',
|
|
495
|
+
message: 'Guardian App URL:\n Examples: https://guardian.ante.ph or http://143.198.91.153:8082\n Enter URL',
|
|
496
|
+
default: currentGuardianAppUrl || 'http://localhost:8082',
|
|
497
|
+
validate: validateUrl
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (hasFacialWeb) {
|
|
502
|
+
domainPrompts.push({
|
|
503
|
+
type: 'input',
|
|
504
|
+
name: 'facialWebUrl',
|
|
505
|
+
message: 'Facial Web URL:\n Examples: https://facial.ante.ph or http://143.198.91.153:8083\n Enter URL',
|
|
506
|
+
default: currentFacialWebUrl || 'http://localhost:8083',
|
|
507
|
+
validate: validateUrl
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (hasPosApp) {
|
|
512
|
+
domainPrompts.push({
|
|
513
|
+
type: 'input',
|
|
514
|
+
name: 'posAppUrl',
|
|
515
|
+
message: 'POS App URL:\n Examples: https://pos.ante.ph or http://143.198.91.153:8084\n Enter URL',
|
|
516
|
+
default: currentPosAppUrl || 'http://localhost:8084',
|
|
517
|
+
validate: validateUrl
|
|
518
|
+
});
|
|
519
|
+
}
|
|
444
520
|
|
|
445
|
-
if (hasPosApp) {
|
|
446
521
|
domainPrompts.push({
|
|
447
522
|
type: 'input',
|
|
448
|
-
name: '
|
|
449
|
-
message: '
|
|
450
|
-
default:
|
|
523
|
+
name: 'apiUrl',
|
|
524
|
+
message: 'Backend API URL:\n Examples: https://staging-api.ante.ph or http://143.198.91.153:3001\n Enter URL',
|
|
525
|
+
default: currentApiUrl || 'http://localhost:3001',
|
|
451
526
|
validate: validateUrl
|
|
452
527
|
});
|
|
453
|
-
}
|
|
454
528
|
|
|
455
|
-
|
|
456
|
-
type: 'input',
|
|
457
|
-
name: 'apiUrl',
|
|
458
|
-
message: 'Backend API URL:\n Examples: https://staging-api.ante.ph or http://143.198.91.153:3001\n Enter URL',
|
|
459
|
-
default: currentApiUrl || 'http://localhost:3001',
|
|
460
|
-
validate: validateUrl
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
const answers = await inquirer.prompt(domainPrompts);
|
|
529
|
+
const answers = await inquirer.prompt(domainPrompts);
|
|
464
530
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
531
|
+
// Sanitize URLs to fix common formatting issues
|
|
532
|
+
frontendUrl = sanitizeUrl(answers.frontendUrl);
|
|
533
|
+
apiUrl = sanitizeUrl(answers.apiUrl);
|
|
534
|
+
if (hasGateApp) gateAppUrl = sanitizeUrl(answers.gateAppUrl);
|
|
535
|
+
if (hasGuardianApp) guardianAppUrl = sanitizeUrl(answers.guardianAppUrl);
|
|
536
|
+
if (hasFacialWeb) facialWebUrl = sanitizeUrl(answers.facialWebUrl);
|
|
537
|
+
if (hasPosApp) posAppUrl = sanitizeUrl(answers.posAppUrl);
|
|
538
|
+
}
|
|
472
539
|
}
|
|
473
540
|
} else {
|
|
474
541
|
// Non-interactive mode
|
|
@@ -603,7 +670,8 @@ export async function setDomain(options) {
|
|
|
603
670
|
{
|
|
604
671
|
type: 'input',
|
|
605
672
|
name: 'email',
|
|
606
|
-
message: 'Email address for certificate notifications:',
|
|
673
|
+
message: 'Email address for certificate notifications (default: admin@ante.ph):',
|
|
674
|
+
default: 'admin@ante.ph',
|
|
607
675
|
validate: validateEmail
|
|
608
676
|
}
|
|
609
677
|
]);
|
package/src/commands/update.js
CHANGED
|
@@ -251,7 +251,7 @@ export async function update(options) {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
// Detect which apps are installed
|
|
254
|
-
const { hasGateApp, hasGuardianApp, hasFacialWeb
|
|
254
|
+
const { hasGateApp, hasGuardianApp, hasFacialWeb } = detectInstalledApps(composeFile);
|
|
255
255
|
|
|
256
256
|
// Detect missing services that could be installed
|
|
257
257
|
const missingServices = detectMissingServices(composeFile);
|
|
@@ -267,7 +267,7 @@ export async function update(options) {
|
|
|
267
267
|
if (hasGateApp || missingServices.gateApp) totalSteps++; // Gate App health check
|
|
268
268
|
if (hasGuardianApp || missingServices.guardianApp) totalSteps++; // Guardian App health check
|
|
269
269
|
if (hasFacialWeb || missingServices.facialWeb) totalSteps++; // Facial Web health check
|
|
270
|
-
|
|
270
|
+
// POS App health check removed - not required
|
|
271
271
|
if (!options.skipCleanup) totalSteps++; // Cleanup step
|
|
272
272
|
|
|
273
273
|
// Pre-calculate step numbers for each task (fixes step numbering bug)
|
|
@@ -283,7 +283,7 @@ export async function update(options) {
|
|
|
283
283
|
const stepGateHealth = (hasGateApp || missingServices.gateApp) ? ++currentStep : null;
|
|
284
284
|
const stepGuardianHealth = (hasGuardianApp || missingServices.guardianApp) ? ++currentStep : null;
|
|
285
285
|
const stepFacialHealth = (hasFacialWeb || missingServices.facialWeb) ? ++currentStep : null;
|
|
286
|
-
|
|
286
|
+
// POS App health check removed - not required
|
|
287
287
|
const stepMigrations = ++currentStep;
|
|
288
288
|
const stepCleanup = !options.skipCleanup ? ++currentStep : null;
|
|
289
289
|
|
|
@@ -410,16 +410,7 @@ export async function update(options) {
|
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
},
|
|
413
|
-
|
|
414
|
-
title: stepPosHealth ? formatStepTitle(stepPosHealth, totalSteps, 'Waiting for POS App to be healthy') : '',
|
|
415
|
-
skip: () => !stepPosHealth ? 'POS App not installed' : false,
|
|
416
|
-
task: async () => {
|
|
417
|
-
const healthy = await waitForServiceHealthy(composeFile, 'ante-pos', 60);
|
|
418
|
-
if (!healthy) {
|
|
419
|
-
throw new Error('POS App did not become healthy within 60 seconds');
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
},
|
|
413
|
+
// POS App health check removed - not required
|
|
423
414
|
{
|
|
424
415
|
title: formatStepTitle(stepMigrations, totalSteps, 'Running database migrations'),
|
|
425
416
|
task: async (ctx, task) => {
|