UNPKG

@forzalabs/remora

Version:

A powerful CLI tool for seamless data translation.

82 lines (81 loc) 3.59 kB
#!/usr/bin/env node "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const dotenv_1 = __importDefault(require("dotenv")); const compile_1 = require("./actions/compile"); const debug_1 = require("./actions/debug"); const deploy_1 = require("./actions/deploy"); const init_1 = require("./actions/init"); const run_1 = require("./actions/run"); const Constants_1 = __importDefault(require("./Constants")); const discover_1 = require("./actions/discover"); const automap_1 = require("./actions/automap"); const create_producer_1 = require("./actions/create_producer"); const create_consumer_1 = require("./actions/create_consumer"); const LicenceManager_1 = __importDefault(require("./licencing/LicenceManager")); dotenv_1.default.configDotenv(); const program = new commander_1.Command(); const remoraLicenceKey = process.env.REMORA_LICENCE_KEY; const check = LicenceManager_1.default.validate(remoraLicenceKey); if (!check.valid) { console.error(`Invalid Remora licence key, the product is not active: remember to set "REMORA_LICENCE_KEY" environment variable.`); process.exit(1); } program .version(Constants_1.default.cliVersion + '', '-v, --version', 'Display the version of the CLI') .description('CLI tool for setting up and managing Data-Remora'); program .command('version') .description('Display the version of the CLI') .action(() => { const packageJson = require('../package.json'); console.log(`Data-Remora CLI version: ${packageJson.version}`); }); program .command('init') .description('Initialize the application and set up configuration') .action(init_1.init); program .command('compile') .description('Compile the config and check for errors') .action(compile_1.compile); program .command('debug') .description('Check the connection with sources and producers') .action(debug_1.debug); program .command('deploy') .description('Deploy the application to the specified environment') .option('-e, --env <environment>', 'Target environment (staging, production)', 'staging') .option('--skip-tests', 'Skip running tests before deployment') .option('--build-only', 'Build without deploying') .action(deploy_1.deploy); program .command('run [name]') .description('Execute consumers. Optionally specify a single consumers name to run.') .action(run_1.run); program .command('discover') .description('Discover the data shape of a producer and automatically create the resource for it.') .argument('<producer>', 'The producer to discover') .action(discover_1.discover); program .command('automap') .description('Automatically map a producer to consumers using specified schemas.') .argument('<producer>', 'The producer to analyze') .argument('<schemas...>', 'One or more schema names to map against') .action(automap_1.automap); program .command('create-producer <name>') .description('Create a new producer configuration with default settings') .action(create_producer_1.create_producer); program .command('create-consumer <name>') .description('Create a new consumer configuration with default settings') .option('-p, --producer <name>', 'Producer to create a one-to-one mapping from') .action((name, options) => (0, create_consumer_1.create_consumer)(name, options.producer)); program.parse(process.argv);