@magic-mustard/sqlsync
Version:
SQLSync simplifies database schema evolution by allowing a declarative approach to table management
48 lines (47 loc) • 1.99 kB
JavaScript
;
/**
* Entry point for SQLSync v0.2.0
* This file initializes and invokes the CLI, which manages all user interaction and parses arguments only.
* Orchestration is handled here, not in the CLI.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const cli_1 = require("./cli");
const generate_orchestrator_1 = require("./orchestrator/generate-orchestrator");
const logger_1 = require("./utils/logger");
function main() {
return __awaiter(this, void 0, void 0, function* () {
const cli = new cli_1.SqlSyncCli();
cli.initCli();
const { command, args } = cli.parseArgs();
console.log(args);
try {
switch (command) {
case 'generate':
const orchestrator = new generate_orchestrator_1.GenerateOrchestrator();
yield orchestrator.run(args);
break;
// Add more commands as needed
default:
logger_1.logger.error(`Unknown command: ${command}`);
process.exit(1);
}
}
catch (err) {
logger_1.logger.error('Orchestration failed:', err);
process.exit(1);
}
});
}
if (require.main === module) {
main();
}