UNPKG

@onboardbase/cli

Version:

[![Version](https://img.shields.io/npm/v/@onboardbase/cli.svg)](https://www.npmjs.com/package/@onboardbase/cli) [![Downloads/week](https://img.shields.io/npm/dw/@onboardbase/cli.svg)](https://www.npmjs.com/package/@onboardbase/cli) [![License](https://img

104 lines (103 loc) 4.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const command_1 = require("@oclif/command"); class Railway extends command_1.Command { async run() { return this.error("This command has been disabled. Pls visit https://app.onboardbase.com to add a railway integration."); // Init config manager // await ConfigManager.init(); // const { flags } = this.parse(Railway); // const { project, environment, token } = flags; // const localConfig = ConfigManager.getLocalConfig(); // const currentProject = project ?? localConfig?.project; // const currentEnvironment = // environment ?? (localConfig?.environment || "development"); // if (!currentProject) this.error("Please specify project name"); // let railwayIsInstalled = false; // try { // const checkIfCliExistCommand = isUnix() ? "type -p railway" : "railway"; // const { stdout, stderr } = await executeCommandUsingChildProcessExec( // checkIfCliExistCommand // ); // railwayIsInstalled = // stdout && stdout.toString().trim() !== "" ? true : false; // } catch (error) { // if (error.stdout) { // console.error(error.stdout.trim()); // process.exit(1); // } else if (error.stderr.length) { // console.error(error.stderr.trim()); // process.exit(1); // } else console.error(error.message); // } // if (!railwayIsInstalled) { // console.log( // chalk.greenBright( // "Railway CLI not found... You need to have the railway cli installed to use this command" // ) // ); // process.exit(1); // } // try { // const { stdout: railwayResponse } = // await executeCommandUsingChildProcessExec("railway variables", { // RAILWAY_TOKEN: token, // }); // console.log( // "railwayResponse", // railwayResponse?.replace( // /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, // "" // ) // ); // // railwayResponse.split("\n").map((secret) => { // // const keyAndValue = secret.split("|"); // // console.log("keyAndValue", keyAndValue); // // }); // return; // const splittedData = railwayResponse.trim().split("\n").slice(1); // let secretStore = {}; // splittedData.map((data) => { // let secret = data.split(" "); // secret = secret.filter((secretData) => secretData !== ""); // if (secret.length) { // const secretKey = String(secret)?.[0] // ?.toString() // ?.replace(":", "") // // remove ANSI code if any // ?.replace( // /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, // "" // ) // .trim(); // const secretValue = secret[1].toString().trim(); // secretStore[secretKey] = secretValue; // } // }); // cli.action.start("Uploading railway variables to onboardbase"); // await uploadSecretsToOnboardbase( // currentProject, // currentEnvironment, // secretStore, // [], // UploadSecretsActionTypes.CREATE // ); // cli.action.stop(); // console.log( // chalk.greenBright( // "Railway secrets successfully imported to Onboardbase" // ) // ); // } catch (error) { // if (error.stdout) { // console.error(error.stdout.trim()); // process.exit(1); // } else if (error.stderr) { // console.error(error.stderr.trim()); // process.exit(1); // } else console.error(error.message); // } } } exports.default = Railway; Railway.description = "Railway Integration";