From 8f63c31c9fa263f889df9b0fed116a611279905c Mon Sep 17 00:00:00 2001 From: Kasra Bigdeli Date: Thu, 3 Jan 2019 23:48:38 -0800 Subject: [PATCH] commands converted to ts --- app-cli/built/commands/captainduckduck.js | 61 ++--- app-cli/built/commands/captainduckduck.js.map | 2 +- app-cli/built/commands/deploy.js | 84 +++--- app-cli/built/commands/deploy.js.map | 2 +- app-cli/built/commands/list.js | 19 +- app-cli/built/commands/list.js.map | 2 +- app-cli/built/commands/login.js | 80 +++--- app-cli/built/commands/login.js.map | 2 +- app-cli/built/commands/logout.js | 25 +- app-cli/built/commands/logout.js.map | 2 +- app-cli/built/commands/serversetup.js | 103 ++++---- app-cli/built/commands/serversetup.js.map | 2 +- app-cli/built/helpers/MachineHelper.js | 6 +- app-cli/built/helpers/MachineHelper.js.map | 2 +- app-cli/built/utils/fileHelper.js | 1 - app-cli/built/utils/fileHelper.js.map | 2 +- app-cli/built/utils/loginHelpers.js | 7 +- app-cli/built/utils/loginHelpers.js.map | 2 +- app-cli/built/utils/machineUtils.js | 1 - app-cli/built/utils/machineUtils.js.map | 2 +- app-cli/built/utils/validationsHandler.js | 14 +- app-cli/built/utils/validationsHandler.js.map | 2 +- app-cli/src/commands/captainduckduck.js | 87 ------- app-cli/src/commands/captainduckduck.ts | 67 +++++ app-cli/src/commands/deploy.js | 216 ---------------- app-cli/src/commands/deploy.ts | 200 +++++++++++++++ app-cli/src/commands/list.js | 26 -- app-cli/src/commands/list.ts | 22 ++ app-cli/src/commands/login.js | 158 ------------ app-cli/src/commands/login.ts | 145 +++++++++++ app-cli/src/commands/logout.js | 42 --- app-cli/src/commands/logout.ts | 42 +++ app-cli/src/commands/serversetup.js | 241 ------------------ app-cli/src/commands/serversetup.ts | 218 ++++++++++++++++ app-cli/src/helpers/MachineHelper.ts | 8 +- app-cli/src/utils/fileHelper.ts | 3 +- app-cli/src/utils/loginHelpers.ts | 9 +- app-cli/src/utils/machineUtils.ts | 2 +- app-cli/src/utils/validationsHandler.ts | 18 +- 39 files changed, 924 insertions(+), 1003 deletions(-) delete mode 100755 app-cli/src/commands/captainduckduck.js create mode 100755 app-cli/src/commands/captainduckduck.ts delete mode 100644 app-cli/src/commands/deploy.js create mode 100644 app-cli/src/commands/deploy.ts delete mode 100644 app-cli/src/commands/list.js create mode 100644 app-cli/src/commands/list.ts delete mode 100644 app-cli/src/commands/login.js create mode 100644 app-cli/src/commands/login.ts delete mode 100644 app-cli/src/commands/logout.js create mode 100644 app-cli/src/commands/logout.ts delete mode 100644 app-cli/src/commands/serversetup.js create mode 100644 app-cli/src/commands/serversetup.ts diff --git a/app-cli/built/commands/captainduckduck.js b/app-cli/built/commands/captainduckduck.js index 8191e16..ec2b943 100755 --- a/app-cli/built/commands/captainduckduck.js +++ b/app-cli/built/commands/captainduckduck.js @@ -1,59 +1,54 @@ #!/usr/bin/env node -const { printError } = require("../utils/messageHandler"); -const packagejson = require("../../package.json"); -const updateNotifier = require("update-notifier"); -const program = require("commander"); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const logout = require("./logout"); +const { printError } = require('../utils/messageHandler'); +const packagejson = require('../../package.json'); +const updateNotifier = require('update-notifier'); +const program = require('commander'); updateNotifier({ pkg: packagejson }).notify({ isGlobal: true }); // Command actions -const serversetup = require("./serversetup"); -const { login } = require("./login"); -const logout = require("./logout"); -const list = require("./list"); -const deploy = require("./deploy"); +const serversetup = require('./serversetup'); +const { login } = require('./login'); +const list = require('./list'); +const deploy = require('./deploy'); // Setup program.version(packagejson.version).description(packagejson.description); // Commands program - .command("serversetup") - .description("Performs necessary actions and prepares your Captain server.") + .command('serversetup') + .description('Performs necessary actions and prepares your Captain server.') .action(() => { serversetup(); }); program - .command("login") - .description("Login to a CaptainDuckDuck machine. You can be logged in to multiple machines simultaneously.") + .command('login') + .description('Login to a CaptainDuckDuck machine. You can be logged in to multiple machines simultaneously.') .action(() => { login(); }); -program - .command("logout") - .description("Logout from a specific Captain machine.") - .action(() => { +program.command('logout').description('Logout from a specific Captain machine.').action(() => { logout(); }); -program - .command("list") - .alias("ls") - .description("List all Captain machines currently logged in.") - .action(() => { +program.command('list').alias('ls').description('List all Captain machines currently logged in.').action(() => { list(); }); program - .command("deploy") + .command('deploy') .description("Deploy your app (current directory) to a specific Captain machine. You'll be prompted to choose your Captain machine.") - .option("-t, --tarFile ", "Specify file to be uploaded (rather than using git archive)") - .option("-d, --default", "Run with default options") - .option("-s, --stateless", "Run deploy stateless") - .option("-h, --host ", "Only for stateless mode: Host of the captain machine") - .option("-a, --appName ", "Only for stateless mode: Name of the app") - .option("-p, --pass ", "Only for stateless mode: Password for Captain") - .option("-b, --branch ", "Only for stateless mode: Branch name (default master)") - .action(options => { + .option('-t, --tarFile ', 'Specify file to be uploaded (rather than using git archive)') + .option('-d, --default', 'Run with default options') + .option('-s, --stateless', 'Run deploy stateless') + .option('-h, --host ', 'Only for stateless mode: Host of the captain machine') + .option('-a, --appName ', 'Only for stateless mode: Name of the app') + .option('-p, --pass ', 'Only for stateless mode: Password for Captain') + .option('-b, --branch ', 'Only for stateless mode: Branch name (default master)') + .action((options) => { deploy(options); }); // Error on unknown commands -program.on("command:*", () => { - const wrongCommands = program.args.join(" "); +program.on('command:*', () => { + const wrongCommands = program.args.join(' '); printError(`\nInvalid command: ${wrongCommands}\nSee --help for a list of available commands.`, true); }); program.parse(process.argv); diff --git a/app-cli/built/commands/captainduckduck.js.map b/app-cli/built/commands/captainduckduck.js.map index 4989592..d55a2d8 100755 --- a/app-cli/built/commands/captainduckduck.js.map +++ b/app-cli/built/commands/captainduckduck.js.map @@ -1 +1 @@ -{"version":3,"file":"captainduckduck.js","sourceRoot":"","sources":["../../src/commands/captainduckduck.js"],"names":[],"mappings":";AAEA,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AACzD,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACjD,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC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C,CAAA;AAEJ,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CACV,uHAAuH,CACxH;KACA,MAAM,CACL,uBAAuB,EACvB,6DAA6D,CAC9D;KACA,MAAM,CAAC,eAAe,EAAE,0BAA0B,CAAC;KACnD,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;KACjD,MAAM,CACL,oBAAoB,EACpB,sDAAsD,CACvD;KACA,MAAM,CAAC,uBAAuB,EAAE,0CAA0C,CAAC;KAC3E,MAAM,CAAC,oBAAoB,EAAE,+CAA+C,CAAC;KAC7E,MAAM,CACL,sBAAsB,EACtB,uDAAuD,CACxD;KACA,MAAM,CAAC,OAAO,CAAC,EAAE;IAChB,MAAM,CAAC,OAAO,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA;AAEJ,4BAA4B;AAC5B,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;IAC3B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAE5C,UAAU,CACR,sBAAsB,aAAa,gDAAgD,EACnF,IAAI,CACL,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"captainduckduck.js","sourceRoot":"","sources":["../../src/commands/captainduckduck.ts"],"names":[],"mappings":";;;AAEA,mCAAoC;AAEpC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClD,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAClD,MAAM,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAErC,cAAc,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,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,EAAE,sBAAsB,CAAC;KACjD,MAAM,CAAC,oBAAoB,EAAE,sDAAsD,CAAC;KACpF,MAAM,CAAC,uBAAuB,EAAE,0CAA0C,CAAC;KAC3E,MAAM,CAAC,oBAAoB,EAAE,+CAA+C,CAAC;KAC7E,MAAM,CAAC,sBAAsB,EAAE,uDAAuD,CAAC;KACvF,MAAM,CAAC,CAAC,OAAY,EAAE,EAAE;IACxB,MAAM,CAAC,OAAO,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC;AAEJ,4BAA4B;AAC5B,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;IAC5B,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE7C,UAAU,CAAC,sBAAsB,aAAa,gDAAgD,EAAE,IAAI,CAAC,CAAC;AACvG,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/app-cli/built/commands/deploy.js b/app-cli/built/commands/deploy.js index 5b57bb6..4574360 100755 --- a/app-cli/built/commands/deploy.js +++ b/app-cli/built/commands/deploy.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -7,18 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const MachineHelper = require("../helpers/MachineHelper"); -const DeployApi = require("../api/DeployApi"); -const LoginApi = require("../api/LoginApi"); -const { printError, printMessage } = require("../utils/messageHandler"); -const { validateIsGitRepository, validateDefinitionFile, optionIsNotGiven, validateAuthentication } = require("../utils/validationsHandler"); -const { uploadFile } = require("../utils/fileHelper"); -const { gitArchiveFile } = require("../utils/fileHelper"); -const fs = require("fs-extra"); -const path = require("path"); -const inquirer = require("inquirer"); -const commandExistsSync = require("command-exists").sync; -const { initMachineFromLocalStorage } = require("../utils/machineUtils"); +Object.defineProperty(exports, "__esModule", { value: true }); +const MachineHelper_1 = require("../helpers/MachineHelper"); +const inquirer = require('inquirer'); +const DeployApi = require('../api/DeployApi'); +const LoginApi = require('../api/LoginApi'); +const { printError, printMessage } = require('../utils/messageHandler'); +const { validateIsGitRepository, validateDefinitionFile, optionIsNotGiven, validateAuthentication } = require('../utils/validationsHandler'); +const { uploadFile } = require('../utils/fileHelper'); +const { gitArchiveFile } = require('../utils/fileHelper'); +const fs = require('fs-extra'); +const path = require('path'); +const commandExistsSync = require('command-exists').sync; +const { initMachineFromLocalStorage } = require('../utils/machineUtils'); function deployAsDefaultValues() { return __awaiter(this, void 0, void 0, function* () { try { @@ -26,13 +28,13 @@ function deployAsDefaultValues() { if (isValidAuthentication) { const { appName, branchToPush, machineToDeploy } = DeployApi; if (!appName || !branchToPush || !machineToDeploy) { - printError("Default deploy failed. There are no default options selected.", true); + printError('Default deploy failed. There are no default options selected.', true); } printMessage(`Deploying to ${machineToDeploy.name}`); deployFromGitProject(); } else { - printError("Incorrect login details", true); + printError('Incorrect login details', true); } } catch (e) { @@ -51,14 +53,14 @@ function deployAsStateless(host, appName, branch, pass) { const data = JSON.parse(response); const newToken = data.token; // Update the token to the machine that corresponds (if needed) - MachineHelper.updateMachineAuthToken(name, newToken); + MachineHelper_1.default.updateMachineAuthToken(name, newToken); if (data) { printMessage(`Starting stateless deploy to\n${host}\n${branch}\n${appName}`); deployFromGitProject(); } } else { - printError("You are missing parameters for deploying on stateless. "); + printError('You are missing parameters for deploying on stateless. '); } }); } @@ -69,11 +71,11 @@ function deployFromTarFile(tarFile) { if (isValidAuthentication) { // Send from tar file const filePath = tarFile; - const gitHash = "sendviatarfile"; + const gitHash = 'sendviatarfile'; yield uploadFile(filePath, gitHash); } else { - printError("Incorrect login details", true); + printError('Incorrect login details', true); } } catch (e) { @@ -82,11 +84,11 @@ function deployFromTarFile(tarFile) { }); } function deployFromGitProject() { - if (!commandExistsSync("git")) { + if (!commandExistsSync('git')) { printError("'git' command not found..."); printError("Captain needs 'git' to create tar file of your source files...", true); } - const zipFileNameToDeploy = "temporary-captain-to-deploy.tar"; + const zipFileNameToDeploy = 'temporary-captain-to-deploy.tar'; const zipFileFullPath = path.join(process.cwd(), zipFileNameToDeploy); printMessage(`Saving tar file to:\n${zipFileFullPath}\n`); // Removes the temporarly file created @@ -109,7 +111,7 @@ function deploy(options) { validateIsGitRepository(); validateDefinitionFile(); } - printMessage("Preparing deployment to Captain...\n"); + printMessage('Preparing deployment to Captain...\n'); if (options.default) { deployAsDefaultValues(); } @@ -122,38 +124,38 @@ function deploy(options) { else { const questions = [ { - type: "list", - name: "captainNameToDeploy", - default: DeployApi.machineToDeploy.name || "", - message: "Select the Captain Machine you want to deploy to:", - choices: MachineHelper.getMachinesAsOptions(), - when: () => optionIsNotGiven(options, "host") + type: 'list', + name: 'captainNameToDeploy', + default: DeployApi.machineToDeploy.name || '', + message: 'Select the Captain Machine you want to deploy to:', + choices: MachineHelper_1.default.getMachinesAsOptions(), + when: () => optionIsNotGiven(options, 'host') }, { - type: "input", - default: DeployApi.branchToPush || "master", - name: "branchToPush", + type: 'input', + default: DeployApi.branchToPush || 'master', + name: 'branchToPush', message: "Enter the 'git' branch you would like to deploy:", - when: () => optionIsNotGiven(options, "branch") + when: () => optionIsNotGiven(options, 'branch') }, { - type: "input", + type: 'input', default: DeployApi.appName, - name: "appName", - message: "Enter the Captain app name this directory will be deployed to:", - when: () => optionIsNotGiven(options, "appName") + name: 'appName', + message: 'Enter the Captain app name this directory will be deployed to:', + when: () => optionIsNotGiven(options, 'appName') }, { - type: "confirm", - name: "confirmedToDeploy", - message: "Note that uncommitted files and files in gitignore (if any) will not be pushed to server. Please confirm so that deployment process can start.", + type: 'confirm', + name: 'confirmedToDeploy', + message: 'Note that uncommitted files and files in gitignore (if any) will not be pushed to server. Please confirm so that deployment process can start.', default: true, - when: () => optionIsNotGiven(options, "stateless") + when: () => optionIsNotGiven(options, 'stateless') } ]; const answers = yield inquirer.prompt(questions); if (!answers.confirmedToDeploy && !options.stateless) { - printMessage("\nOperation cancelled by the user...\n"); + printMessage('\nOperation cancelled by the user...\n'); process.exit(0); } const captainNameToDeploy = answers.captainNameToDeploy; @@ -171,7 +173,7 @@ function deploy(options) { deployFromGitProject(); } else { - printError("Incorrect login details", true); + printError('Incorrect login details', true); } } catch (e) { diff --git a/app-cli/built/commands/deploy.js.map b/app-cli/built/commands/deploy.js.map index ca1b4f7..36aca3e 100755 --- a/app-cli/built/commands/deploy.js.map +++ b/app-cli/built/commands/deploy.js.map @@ -1 +1 @@ -{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.js"],"names":[],"mappings":";;;;;;;;;AAEA,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;AACzD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAC3C,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AACvE,MAAM,EACJ,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACvB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAA;AAC1C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AACrD,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AACzD,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACpC,MAAM,iBAAiB,GAAG,OAA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aACD;SACD;IACF,CAAC;CAAA;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/app-cli/built/commands/list.js b/app-cli/built/commands/list.js index c78e2ae..ea9639c 100755 --- a/app-cli/built/commands/list.js +++ b/app-cli/built/commands/list.js @@ -1,19 +1,18 @@ #!/usr/bin/env node -const chalk = require("chalk"); -const MachineHelper = require("../helpers/MachineHelper"); -const { printMessage } = require("../utils/messageHandler"); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const chalk = require('chalk'); +const MachineHelper_1 = require("../helpers/MachineHelper"); +const { printMessage } = require('../utils/messageHandler'); function _displayMachine(machine) { - console.log(">> " + - chalk.greenBright(machine.name) + - " at " + - chalk.cyan(machine.baseUrl)); + console.log('>> ' + chalk.greenBright(machine.name) + ' at ' + chalk.cyan(machine.baseUrl)); } function list() { - printMessage("\nLogged in Captain Machines:\n"); - MachineHelper.machines.map(machine => { + printMessage('\nLogged in Captain Machines:\n'); + MachineHelper_1.default.getMachines().map((machine) => { _displayMachine(machine); }); - printMessage(""); + printMessage(''); } module.exports = list; //# sourceMappingURL=list.js.map \ No newline at end of file diff --git a/app-cli/built/commands/list.js.map b/app-cli/built/commands/list.js.map index 9b2415a..0e6f965 100755 --- a/app-cli/built/commands/list.js.map +++ b/app-cli/built/commands/list.js.map @@ -1 +1 @@ -{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.js"],"names":[],"mappings":";AAEA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9B,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;AACzD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAE3D,SAAS,eAAe,CAAC,OAAO;IAC9B,OAAO,CAAC,GAAG,CACT,KAAK;QACH,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;QAC/B,MAAM;QACN,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAC9B,CAAA;AACH,CAAC;AAED,SAAS,IAAI;IACX,YAAY,CAAC,iCAAiC,CAAC,CAAA;IAE/C,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QACnC,eAAe,CAAC,OAAO,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,YAAY,CAAC,EAAE,CAAC,CAAA;AAClB,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA"} \ No newline at end of file +{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":";;;AAEA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,4DAAqD;AAErD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAE5D,SAAS,eAAe,CAAC,OAAiB;IACzC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7F,CAAC;AAED,SAAS,IAAI;IACZ,YAAY,CAAC,iCAAiC,CAAC,CAAC;IAEhD,uBAAa,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3C,eAAe,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,YAAY,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC"} \ No newline at end of file diff --git a/app-cli/built/commands/login.js b/app-cli/built/commands/login.js index 6b01fe0..5856751 100755 --- a/app-cli/built/commands/login.js +++ b/app-cli/built/commands/login.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -7,28 +8,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const MachineHelper = require("../helpers/MachineHelper"); -const { printMessage, printGreenMessage, printError } = require("../utils/messageHandler"); -const inquirer = require("inquirer"); -const DeployApi = require("../api/DeployApi"); -const { cleanUpUrl, findDefaultCaptainName } = require("../utils/loginHelpers"); -const { SAMPLE_DOMAIN } = require("../utils/constants"); -const LoginApi = require("../api/LoginApi"); +Object.defineProperty(exports, "__esModule", { value: true }); +const MachineHelper_1 = require("../helpers/MachineHelper"); +const { printMessage, printGreenMessage, printError } = require('../utils/messageHandler'); +const inquirer = require('inquirer'); +const DeployApi = require('../api/DeployApi'); +const { cleanUpUrl, findDefaultCaptainName } = require('../utils/loginHelpers'); +const { SAMPLE_DOMAIN } = require('../utils/constants'); +const LoginApi = require('../api/LoginApi'); // In case the token is expired function requestLogin() { return __awaiter(this, void 0, void 0, function* () { const { baseUrl, name } = DeployApi.machineToDeploy; - printMessage("Your auth token is not valid anymore. Try to login again."); + printMessage('Your auth token is not valid anymore. Try to login again.'); const questions = [ { - type: "password", - name: "captainPassword", - message: "Please enter your password for " + baseUrl, - validate: function (value) { + type: 'password', + name: 'captainPassword', + message: 'Please enter your password for ' + baseUrl, + validate: (value) => { if (value && value.trim()) { return true; } - return "Please enter your password for " + baseUrl; + return 'Please enter your password for ' + baseUrl; } } ]; @@ -40,26 +42,26 @@ function requestLogin() { if (!newToken) return false; // Update the token to the machine that corresponds - MachineHelper.updateMachineAuthToken(name, newToken); + MachineHelper_1.default.updateMachineAuthToken(name, newToken); return true; }); } function login() { return __awaiter(this, void 0, void 0, function* () { - printMessage("Login to a Captain Machine"); + printMessage('Login to a Captain Machine'); const questions = [ { - type: "input", + type: 'input', default: SAMPLE_DOMAIN, - name: "captainAddress", - message: "\nEnter address of the Captain machine. \nIt is captain.[your-captain-root-domain] :", - validate: value => { + name: 'captainAddress', + message: '\nEnter address of the Captain machine. \nIt is captain.[your-captain-root-domain] :', + validate: (value) => { if (value === SAMPLE_DOMAIN) { - return "Enter a valid URL"; + return 'Enter a valid URL'; } if (!cleanUpUrl(value)) - return "This is an invalid URL: " + value; - MachineHelper.machines.map(machine => { + return 'This is an invalid URL: ' + value; + MachineHelper_1.default.getMachines().map((machine) => { if (cleanUpUrl(machine.baseUrl) === cleanUpUrl(value)) { return `${value} already exist as ${machine.name}. If you want to replace the existing entry, you have to first use command, and then re-login.`; } @@ -67,33 +69,33 @@ function login() { if (value && value.trim()) { return true; } - return "Please enter a valid address."; + return 'Please enter a valid address.'; } }, { - type: "confirm", - name: "captainHasRootSsl", - message: "Is HTTPS activated for this Captain machine?", + type: 'confirm', + name: 'captainHasRootSsl', + message: 'Is HTTPS activated for this Captain machine?', default: true }, { - type: "password", - name: "captainPassword", - message: "Enter your password:", - validate: value => { + type: 'password', + name: 'captainPassword', + message: 'Enter your password:', + validate: (value) => { if (value && value.trim()) { return true; } - return "Please enter your password."; + return 'Please enter your password.'; } }, { - type: "input", - name: "captainName", - message: "Enter a name for this Captain machine:", + type: 'input', + name: 'captainName', + message: 'Enter a name for this Captain machine:', default: findDefaultCaptainName(), - validate: value => { - MachineHelper.machines.map(machine => { + validate: (value) => { + MachineHelper_1.default.getMachines().map((machine) => { if (machine.name === value) { return `${value} already exist. If you want to replace the existing entry, you have to first use command, and then re-login.`; } @@ -101,13 +103,13 @@ function login() { if (value.match(/^[-\d\w]+$/i)) { return true; } - return "Please enter a Captain Name."; + return 'Please enter a Captain Name.'; } } ]; const answers = yield inquirer.prompt(questions); const { captainHasRootSsl, captainPassword, captainAddress, captainName } = answers; - const handleHttp = captainHasRootSsl ? "https://" : "http://"; + const handleHttp = captainHasRootSsl ? 'https://' : 'http://'; const baseUrl = `${handleHttp}${cleanUpUrl(captainAddress)}`; try { const data = yield LoginApi.loginMachine(baseUrl, captainPassword); @@ -121,7 +123,7 @@ function login() { baseUrl, name: captainName }; - MachineHelper.addMachine(newMachine); + MachineHelper_1.default.addMachine(newMachine); printGreenMessage(`Logged in successfully to ${baseUrl}`); printGreenMessage(`Authorization token is now saved as ${captainName} \n`); } diff --git a/app-cli/built/commands/login.js.map b/app-cli/built/commands/login.js.map index f1a7868..73dc2ca 100755 --- a/app-cli/built/commands/login.js.map +++ b/app-cli/built/commands/login.js.map @@ -1 +1 @@ -{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.js"],"names":[],"mappings":";;;;;;;;;AAEA,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;AACzD,MAAM,EACJ,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACX,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACpC,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAC7C,MAAM,EAAE,UAAU,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AAC/E,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE3C,+BAA+B;AAC/B,SAAe,YAAY;;QACzB,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,eAAe,CAAA;QAEnD,YAAY,CAAC,2DAA2D,CAAC,CAAA;QAEzE,MAAM,SAAS,GAAG;YAChB;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EAAE,iCAAiC,GAAG,OAAO;gBACpD,QAAQ,EAAE,UAAS,KAAK;oBACtB,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE;wBACzB,OAAO,IAAI,CAAA;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YAErC,iBAAiB,CAAC,6BAA6B,OAAO,EAAE,CAAC,CAAC;YAE1D,iBAAiB,CAAC,uCAAuC,WAAW,KAAK,CAAC,CAAC;SAC3E;QAAC,OAAO,KAAK,EAAE;YACf,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;YAE3D,UAAU,CAAC,wCAAwC,WAAW,OAAO,YAAY,EAAE,CAAC,CAAC;SACrF;IACF,CAAC;CAAA;AAED,MAAM,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC"} \ No newline at end of file diff --git a/app-cli/built/commands/logout.js b/app-cli/built/commands/logout.js index 7d8b72d..2693deb 100755 --- a/app-cli/built/commands/logout.js +++ b/app-cli/built/commands/logout.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -7,35 +8,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const MachineHelper = require("../helpers/MachineHelper"); -const { printMessage } = require("../utils/messageHandler"); -const inquirer = require("inquirer"); +const MachineHelper = require('../helpers/MachineHelper'); +const { printMessage } = require('../utils/messageHandler'); +const inquirer = require('inquirer'); function generateQuestions() { const listOfMachines = MachineHelper.getMachinesAsOptions(); return [ { - type: "list", - name: "captainNameToLogout", - message: "Select the Captain Machine you want to logout from:", + type: 'list', + name: 'captainNameToLogout', + message: 'Select the Captain Machine you want to logout from:', choices: listOfMachines }, { - type: "confirm", - name: "confirmedToLogout", - message: "Are you sure you want to logout from this Captain machine?", + type: 'confirm', + name: 'confirmedToLogout', + message: 'Are you sure you want to logout from this Captain machine?', default: false, - when: answers => answers.captainNameToLogout + when: (answers) => answers.captainNameToLogout } ]; } function logout() { return __awaiter(this, void 0, void 0, function* () { const questions = generateQuestions(); - printMessage("Logout from a Captain Machine and clear auth info"); + printMessage('Logout from a Captain Machine and clear auth info'); const answers = yield inquirer.prompt(questions); const { captainNameToLogout } = answers; if (!captainNameToLogout) { - printMessage("\nOperation cancelled by the user...\n", true); + printMessage('\nOperation cancelled by the user...\n', true); } MachineHelper.logoutMachine(captainNameToLogout); }); diff --git a/app-cli/built/commands/logout.js.map b/app-cli/built/commands/logout.js.map index 976e792..26dfc25 100755 --- a/app-cli/built/commands/logout.js.map +++ b/app-cli/built/commands/logout.js.map @@ -1 +1 @@ -{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.js"],"names":[],"mappings":";;;;;;;;;AAEA,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;AACzD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAEpC,SAAS,iBAAiB;IACxB,MAAM,cAAc,GAAG,aAAa,CAAC,oBAAoB,EAAE,CAAA;IAE3D,OAAO;QACL;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,qBAAqB;YAC3B,OAAO,EAAE,qDAAqD;YAC9D,OAAO,EAAE,cAAc;SACxB;QACD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,4DAA4D;YACrE,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,mBAAmB;SAC7C;KACF,CAAA;AACH,CAAC;AAED,SAAe,MAAM;;QACnB,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAA;QAErC,YAAY,CAAC,mDAAmD,CAAC,CAAA;QAEjE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAChD,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAA;QAEvC,IAAI,CAAC,mBAAmB,EAAE;YACxB,YAAY,CAAC,wCAAwC,EAAE,IAAI,CAAC,CAAA;SAC7D;QAED,aAAa,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAA;IAClD,CAAC;CAAA;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file +{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAC1D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AAC5D,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAErC,SAAS,iBAAiB;IACzB,MAAM,cAAc,GAAG,aAAa,CAAC,oBAAoB,EAAE,CAAC;IAE5D,OAAO;QACN;YACC,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,qBAAqB;YAC3B,OAAO,EAAE,qDAAqD;YAC9D,OAAO,EAAE,cAAc;SACvB;QACD;YACC,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,4DAA4D;YACrE,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,mBAAmB;SACnD;KACD,CAAC;AACH,CAAC;AAED,SAAe,MAAM;;QACpB,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;QAEtC,YAAY,CAAC,mDAAmD,CAAC,CAAC;QAElE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC;QAExC,IAAI,CAAC,mBAAmB,EAAE;YACzB,YAAY,CAAC,wCAAwC,EAAE,IAAI,CAAC,CAAC;SAC7D;QAED,aAAa,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAClD,CAAC;CAAA;AAED,iBAAS,MAAM,CAAC"} \ No newline at end of file diff --git a/app-cli/built/commands/serversetup.js b/app-cli/built/commands/serversetup.js index 8cc26a0..6e9e3a2 100755 --- a/app-cli/built/commands/serversetup.js +++ b/app-cli/built/commands/serversetup.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -7,39 +8,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const MachineHelper = require("../helpers/MachineHelper"); -const SystemApi = require("../api/SystemApi"); -const LoginApi = require("../api/LoginApi"); -const inquirer = require("inquirer"); -const { findDefaultCaptainName } = require("../utils/loginHelpers"); -const { isIpAddress } = require("../utils/validationsHandler"); -const { SAMPLE_IP, DEFAULT_PASSWORD } = require("../utils/constants"); -const { printMessage, printError, printMessageAndExit, errorHandler } = require("../utils/messageHandler"); +const validationsHandler_1 = require("../utils/validationsHandler"); +const SystemApi = require('../api/SystemApi'); +const LoginApi = require('../api/LoginApi'); +const inquirer = require('inquirer'); +const { findDefaultCaptainName } = require('../utils/loginHelpers'); +const { SAMPLE_IP, DEFAULT_PASSWORD } = require('../utils/constants'); +const { printMessage, printError, printMessageAndExit, errorHandler } = require('../utils/messageHandler'); +const MachineHelper_1 = require("../helpers/MachineHelper"); let newPasswordFirstTry = undefined; const questions = [ { - type: "list", - name: "hasInstalledCaptain", - message: "Have you already installed Captain on your server by running the following line:" + - "\nmkdir /captain && docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock dockersaturn/captainduckduck ?", - default: "Yes", - choices: ["Yes", "No"], - filter: value => { + type: 'list', + name: 'hasInstalledCaptain', + message: 'Have you already installed Captain on your server by running the following line:' + + '\nmkdir /captain && docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock dockersaturn/captainduckduck ?', + default: 'Yes', + choices: ['Yes', 'No'], + filter: (value) => { const answerFromUser = value.trim(); - if (answerFromUser === "Yes") + if (answerFromUser === 'Yes') return answerFromUser; - printMessage("\n\nCannot start the setup process if Captain is not installed."); - printMessageAndExit("Please read tutorial on CaptainDuckDuck.com to learn how to install CaptainDuckDuck on a server."); + printMessage('\n\nCannot start the setup process if Captain is not installed.'); + printMessageAndExit('Please read tutorial on CaptainDuckDuck.com to learn how to install CaptainDuckDuck on a server.'); } }, { - type: "input", + type: 'input', default: SAMPLE_IP, - name: "captainAddress", - message: "Enter IP address of your captain server:", + name: 'captainAddress', + message: 'Enter IP address of your captain server:', filter: (value) => __awaiter(this, void 0, void 0, function* () { const ipFromUser = value.trim(); - if (ipFromUser === SAMPLE_IP || !isIpAddress(ipFromUser)) { + if (ipFromUser === SAMPLE_IP || !validationsHandler_1.isIpAddress(ipFromUser)) { printError(`\nThis is an invalid IP Address: ${ipFromUser}`, true); } try { @@ -56,9 +57,9 @@ const questions = [ }) }, { - type: "password", - name: "captainOriginalPassword", - message: "Enter your current password:", + type: 'password', + name: 'captainOriginalPassword', + message: 'Enter your current password:', when: () => !LoginApi.token, filter: (value) => __awaiter(this, void 0, void 0, function* () { try { @@ -75,11 +76,11 @@ const questions = [ }) }, { - type: "input", - name: "captainRootDomain", - message: "Enter a root domain for this Captain server. For example, enter test.yourdomain.com if you" + - " setup your DNS to point *.test.yourdomain.com to ip address of your server" + - ": ", + type: 'input', + name: 'captainRootDomain', + message: 'Enter a root domain for this Captain server. For example, enter test.yourdomain.com if you' + + ' setup your DNS to point *.test.yourdomain.com to ip address of your server' + + ': ', filter: (value) => __awaiter(this, void 0, void 0, function* () { try { const captainRootDomainFromUser = value.trim(); @@ -96,8 +97,8 @@ const questions = [ }) }, { - type: "input", - name: "emailAddress", + type: 'input', + name: 'emailAddress', message: "Enter your 'valid' email address to enable HTTPS: ", filter: (value) => __awaiter(this, void 0, void 0, function* () { try { @@ -114,25 +115,25 @@ const questions = [ }) }, { - type: "password", - name: "newPasswordFirstTry", - message: "Enter a new password:", - filter: value => { + type: 'password', + name: 'newPasswordFirstTry', + message: 'Enter a new password:', + filter: (value) => { newPasswordFirstTry = value; return value; } }, { - type: "password", - name: "newPassword", - message: "Enter a new password:", + type: 'password', + name: 'newPassword', + message: 'Enter a new password:', filter: (value) => __awaiter(this, void 0, void 0, function* () { const { customDomainFromUser } = SystemApi; try { const confirmPasswordValueFromUser = value; const machineUrl = `https://${customDomainFromUser}`; if (newPasswordFirstTry !== confirmPasswordValueFromUser) { - printError("Passwords do not match", true); + printError('Passwords do not match', true); } const changePassData = yield LoginApi.changePass(machineUrl, confirmPasswordValueFromUser); if (changePassData) { @@ -142,32 +143,32 @@ const questions = [ } } catch (e) { - printError("\nIMPORTANT!! Server setup is completed by password is not changed."); - printError("\nYou CANNOT use serversetup anymore. To continue:"); + printError('\nIMPORTANT!! Server setup is completed by password is not changed.'); + printError('\nYou CANNOT use serversetup anymore. To continue:'); printError(`\n- Go to https://${customDomainFromUser} login with default password and change the password in settings.`); printError(`\n- In terminal (here), type captainduckduck login and enter this as your root domain: ${customDomainFromUser}`, true); } }) }, { - type: "input", - name: "captainName", - message: "Enter a name for this Captain machine:", + type: 'input', + name: 'captainName', + message: 'Enter a name for this Captain machine:', default: findDefaultCaptainName(), - validate: value => { + validate: (value) => { const newMachineName = value.trim(); - MachineHelper.machines.map(machine => machine.name === newMachineName && + MachineHelper_1.default.getMachines().map((machine) => machine.name === newMachineName && `${newMachineName} already exist. If you want to replace the existing entry, you have to first use command, and then re-login.`); if (value.match(/^[-\d\w]+$/i)) { return true; } - return "Please enter a Captain Name."; + return 'Please enter a Captain Name.'; } } ]; function serversetup() { return __awaiter(this, void 0, void 0, function* () { - printMessage("\nSetup your Captain server\n"); + printMessage('\nSetup your Captain server\n'); const answers = yield inquirer.prompt(questions); const captainAddress = `https://${SystemApi.customDomainFromUser}`; const newMachine = { @@ -175,9 +176,9 @@ function serversetup() { baseUrl: captainAddress, name: answers.captainName }; - MachineHelper.addMachine(newMachine); + MachineHelper_1.default.addMachine(newMachine); printMessage(`\n\nCaptain is available at ${captainAddress}`); - printMessage("\nFor more details and docs see http://www.captainduckduck.com\n\n"); + printMessage('\nFor more details and docs see http://www.captainduckduck.com\n\n'); }); } module.exports = serversetup; diff --git a/app-cli/built/commands/serversetup.js.map b/app-cli/built/commands/serversetup.js.map index 91d6e11..4f526c7 100755 --- a/app-cli/built/commands/serversetup.js.map +++ b/app-cli/built/commands/serversetup.js.map @@ -1 +1 @@ -{"version":3,"file":"serversetup.js","sourceRoot":"","sources":["../../src/commands/serversetup.js"],"names":[],"mappings":";;;;;;;;;AAEA,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;AACzD,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACpC,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACnE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAA;AAC9D,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AACrE,MAAM,EACJ,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,YAAY,EACb,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAA;AACtC,IAAI,mBAAmB,GAAG,SAAS,CAAA;AACnC,MAAM,SAAS,GAAG;IAChB;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,qBAAqB;QAC3B,OAAO,EACL,kFAAkF;YAClF,6IAA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mEAAmE,CAC7G,CAAA;gBAED,UAAU,CACR,0FAA0F,oBAAoB,EAAE,EAChH,IAAI,CACL,CAAA;aACF;QACH,CAAC,CAAA;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,wCAAwC;QACjD,OAAO,EAAE,sBAAsB,EAAE;QACjC,QAAQ,EAAE,KAAK,CAAC,EAAE;YAChB,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,EAAE,CAAA;YAEnC,aAAa,CAAC,QAAQ,CAAC,GAAG,CACxB,OAAO,CAAC,EAAE,CACR,OAAO,CAAC,IAAI,KAAK,cAAc;gBAC/B,GAAG,cAAc,uHAAuH,CAC3I,CAAA;YAED,IAAI,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;gBAC9B,OAAO,IAAI,CAAA;aACZ;YAED,OAAO,8BAA8B,CAAA;QACvC,CAAC;KACF;CACF,CAAA;AAED,SAAe,WAAW;;QACxB,YAAY,CAAC,+BAA+B,CAAC,CAAA;QAE7C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAChD,MAAM,cAAc,GAAG,WAAW,SAAS,CAAC,oBAAoB,EAAE,CAAA;QAClE,MAAM,UAAU,GAAG;YACjB,SAAS,EAAE,QAAQ,CAAC,KAAK;YACzB,OAAO,EAAE,cAAc;YACvB,IAAI,EAAE,OAAO,CAAC,WAAW;SAC1B,CAAA;QAED,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;QAEpC,YAAY,CAAC,+BAA+B,cAAc,EAAE,CAAC,CAAA;QAE7D,YAAY,CACV,oEAAoE,CACrE,CAAA;IACH,CAAC;CAAA;AAED,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file +{"version":3,"file":"serversetup.js","sourceRoot":"","sources":["../../src/commands/serversetup.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,oEAA0D;AAE1D,MAAM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CACD,CAAC;AAEF,SAAe,WAAW;;QACzB,YAAY,CAAC,+BAA+B,CAAC,CAAC;QAE9C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,cAAc,GAAG,WAAW,SAAS,CAAC,oBAAoB,EAAE,CAAC;QACnE,MAAM,UAAU,GAAG;YAClB,SAAS,EAAE,QAAQ,CAAC,KAAK;YACzB,OAAO,EAAE,cAAc;YACvB,IAAI,EAAE,OAAO,CAAC,WAAW;SACzB,CAAC;QAEF,uBAAa,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAErC,YAAY,CAAC,+BAA+B,cAAc,EAAE,CAAC,CAAC;QAE9D,YAAY,CAAC,oEAAoE,CAAC,CAAC;IACpF,CAAC;CAAA;AAED,iBAAS,WAAW,CAAC"} \ No newline at end of file diff --git a/app-cli/built/helpers/MachineHelper.js b/app-cli/built/helpers/MachineHelper.js index 94afcbe..89b2ff3 100755 --- a/app-cli/built/helpers/MachineHelper.js +++ b/app-cli/built/helpers/MachineHelper.js @@ -28,6 +28,9 @@ class MachineHelper { }); return [...firstItemInOption, ...listOfMachines]; } + getMachines() { + return this.machines; + } setMachines(newMachines) { this.machines = newMachines; configs.set('captainMachines', newMachines); @@ -73,5 +76,6 @@ class MachineHelper { printMessage(`You are now logged out from ${removedMachine.name} at ${removedMachine.baseUrl}...\n`); } } -module.exports = new MachineHelper(); +const instance = new MachineHelper(); +exports.default = instance; //# sourceMappingURL=MachineHelper.js.map \ No newline at end of file diff --git a/app-cli/built/helpers/MachineHelper.js.map b/app-cli/built/helpers/MachineHelper.js.map index 69f8f40..789e74b 100755 --- a/app-cli/built/helpers/MachineHelper.js.map +++ b/app-cli/built/helpers/MachineHelper.js.map @@ -1 +1 @@ -{"version":3,"file":"MachineHelper.js","sourceRoot":"","sources":["../../src/helpers/MachineHelper.ts"],"names":[],"mappings":";;AAEA,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC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AAO,GAAG,CAAC;QACZ,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,CAAC,OAAe;QACtB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QAEpB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,UAAU,CAAC,UAAoB;QAC9B,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC;QACnC,MAAM,WAAW,GAAG,CAAE,GAAG,YAAY,EAAE,UAAU,CAAE,CAAC;QAEpD,uBAAuB;QACvB,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;QAE5C,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,aAAa,CAAC,WAAmB;QAChC,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1F,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;QAEpF,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAE9B,YAAY,CAAC,+BAA+B,cAAc,CAAC,IAAI,OAAO,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC;IACtG,CAAC;CACD;AAED,MAAM,QAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;AAErC,kBAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/app-cli/built/utils/fileHelper.js b/app-cli/built/utils/fileHelper.js index dce7778..8156914 100755 --- a/app-cli/built/utils/fileHelper.js +++ b/app-cli/built/utils/fileHelper.js @@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -Object.defineProperty(exports, "__esModule", { value: true }); const { printMessage, printError, printGreenMessage, printMagentaMessage } = require('./messageHandler'); const SpinnerHelper = require('../helpers/SpinnerHelper'); const child_process_1 = require("child_process"); diff --git a/app-cli/built/utils/fileHelper.js.map b/app-cli/built/utils/fileHelper.js.map index 44dc849..216292f 100755 --- a/app-cli/built/utils/fileHelper.js.map +++ b/app-cli/built/utils/fileHelper.js.map @@ -1 +1 @@ -{"version":3,"file":"fileHelper.js","sourceRoot":"","sources":["../../src/utils/fileHelper.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACzG,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAC1D,iDAAqC;AACrC,+BAA+B;AAC/B,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACxC,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,MAAM,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACvE,IAAI,qBAAqB,GAAG,CAAC,KAAK,CAAC,CAAC,2CAA2C;AAW/E,SAAS,cAAc,CAAC,eAAuB,EAAE,YAAoB;IACpE,oBAAI,CAAC,sCAAsC,eAAe,KAAK,YAAY,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QACtG,IAAI,GAAG,EAAE;YACR,UAAU,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;YAExC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;YAE/B,OAAO;SACP;QAED,oBAAI,CAAC,iBAAiB,YAAY,EAAE,EAAE,CAAC,GAAG,EAA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M,KAAK,GAAG,CAAC;YAEnD,IAAI,kBAAkB,EAAE;gBACvB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;aAC/C;YAED,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB;YAE/C,4BAA4B;YAC5B,yBAAyB,EAAE,CAAC;YAE5B,IAAI,qBAAqB,EAAE;gBAC1B,sBAAsB,EAAE,CAAC;aACzB;YAED,IAAI,sBAAsB,EAAE;gBAC3B,iBAAiB,CAAC,0BAA0B,SAAS,CAAC,OAAO,IAAI,EAAE,IAAI,CAAC,CAAC;aACzE;SACD;QAAC,OAAO,CAAC,EAAE;YACX,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SAC5B;IACF,CAAC;CAAA;AAED,SAAS,kBAAkB,CAAC,QAAgB;IAC3C,IAAI,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QAChC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;KACxB;AACF,CAAC;AACD,iBAAS;IACR,cAAc;IACd,aAAa;IACb,UAAU;IACV,sBAAsB;CACtB,CAAC"} \ No newline at end of file diff --git a/app-cli/built/utils/loginHelpers.js b/app-cli/built/utils/loginHelpers.js index 543693a..13a102e 100755 --- a/app-cli/built/utils/loginHelpers.js +++ b/app-cli/built/utils/loginHelpers.js @@ -1,6 +1,5 @@ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const MachineHelper = require('../helpers/MachineHelper'); +const MachineHelper_1 = require("../helpers/MachineHelper"); function cleanUpUrl(url) { if (!url || !url.length) return null; @@ -13,7 +12,7 @@ function cleanUpUrl(url) { return cleanedUrl.replace('http://', '').replace('https://', '').trim(); } function findDefaultCaptainName() { - let currentSuffix = MachineHelper.machines.length + 1; + let currentSuffix = MachineHelper_1.default.getMachines().length + 1; while (!isSuffixValid(currentSuffix)) { currentSuffix++; } @@ -23,7 +22,7 @@ function getCaptainFullName(suffix) { const formatSuffix = suffix < 10 ? `0${suffix}` : suffix; return `captain-${formatSuffix}`; } -const isSuffixValid = (suffixNumber) => MachineHelper.machines.map((machine) => { +const isSuffixValid = (suffixNumber) => MachineHelper_1.default.getMachines().map((machine) => { machine.name !== getCaptainFullName(suffixNumber); }); module.exports = { diff --git a/app-cli/built/utils/loginHelpers.js.map b/app-cli/built/utils/loginHelpers.js.map index 11494f8..f624f74 100755 --- a/app-cli/built/utils/loginHelpers.js.map +++ b/app-cli/built/utils/loginHelpers.js.map @@ -1 +1 @@ -{"version":3,"file":"loginHelpers.js","sourceRoot":"","sources":["../../src/utils/loginHelpers.ts"],"names":[],"mappings":";;AAEA,MAAM,aAAa,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAE1D,SAAS,UAAU,CAAC,GAAW;IAC9B,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,UAAU,GAAG,GAAG,CAAC;IACrB,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC;IAE/D,IAAI,gBAAgB,EAAE;QACrB,8BAA8B;QAC9B,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACzE,CAAC;AAED,SAAS,sBAAsB;IAC9B,IAAI,aAAa,GAAG,aAAa,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IAEtD,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE;QACrC,aAAa,EAAE,CAAC;KAChB;IA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uBAAa,CAAC,WAAW,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IAE3D,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE;QACrC,aAAa,EAAE,CAAC;KAChB;IAED,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAc;IACzC,MAAM,YAAY,GAAG,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IAEzD,OAAO,WAAW,YAAY,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,aAAa,GAAG,CAAC,YAAoB,EAAE,EAAE,CAC9C,uBAAa,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,CAAC,OAAiB,EAAE,EAAE;IACrD,OAAO,CAAC,IAAI,KAAK,kBAAkB,CAAC,YAAY,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEJ,iBAAS;IACR,UAAU;IACV,sBAAsB;IACtB,aAAa;IACb,kBAAkB;CAClB,CAAC"} \ No newline at end of file diff --git a/app-cli/built/utils/machineUtils.js b/app-cli/built/utils/machineUtils.js index 505bfcf..a955848 100755 --- a/app-cli/built/utils/machineUtils.js +++ b/app-cli/built/utils/machineUtils.js @@ -1,5 +1,4 @@ "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); const DeployApi = require('../api/DeployApi'); const MachineHelper = require('../helpers/MachineHelper'); function initMachineFromLocalStorage() { diff --git a/app-cli/built/utils/machineUtils.js.map b/app-cli/built/utils/machineUtils.js.map index 03de31e..906656f 100755 --- a/app-cli/built/utils/machineUtils.js.map +++ b/app-cli/built/utils/machineUtils.js.map @@ -1 +1 @@ -{"version":3,"file":"machineUtils.js","sourceRoot":"","sources":["../../src/utils/machineUtils.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,MAAM,aAAa,GAAG,OAAO,CAA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AO;gBAC1B,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,eAAe,EAAE,SAAS,CAAC,eAAe;aAC1C,CAAC;SACF;QAED,OAAO,GAAG,CAAC;IACZ,CAAC,CAAC,CAAC;IAEH,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAEnC,IAAI,CAAC,SAAS,EAAE;QACf,MAAM,MAAM,GAAG;YACd,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,OAAO,EAAE,SAAS,CAAC,OAAO;YAC1B,YAAY,EAAE,SAAS,CAAC,YAAY;YACpC,eAAe,EAAE,SAAS,CAAC,eAAe;SAC1C,CAAC;QAEF,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEzB,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KAC5B;AACF,CAAC;AAED,iBAAS;IACR,2BAA2B;IAC3B,yBAAyB;CACzB,CAAC"} \ No newline at end of file diff --git a/app-cli/built/utils/validationsHandler.js b/app-cli/built/utils/validationsHandler.js index 5080b7f..fc1bd61 100755 --- a/app-cli/built/utils/validationsHandler.js +++ b/app-cli/built/utils/validationsHandler.js @@ -1,3 +1,4 @@ +"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } @@ -6,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +Object.defineProperty(exports, "__esModule", { value: true }); const fs = require('fs-extra'); const DeployApi = require('../api/DeployApi'); const { printError } = require('./messageHandler'); @@ -17,6 +19,7 @@ function validateIsGitRepository() { printError('\n**** ERROR: You are not in a git root directory. This command will only deploys the current directory ****\n', true); } } +exports.validateIsGitRepository = validateIsGitRepository; function validateDefinitionFile() { const captainDefinitionExists = fs.pathExistsSync('./captain-definition'); if (!captainDefinitionExists) { @@ -42,6 +45,7 @@ function validateDefinitionFile() { } } } +exports.validateDefinitionFile = validateDefinitionFile; // Only show that question if there is no option given as argument function optionIsNotGiven(allOptions, option) { // console.log(allOptions) @@ -50,12 +54,14 @@ function optionIsNotGiven(allOptions, option) { } return true; } +exports.optionIsNotGiven = optionIsNotGiven; function isIpAddress(ipaddress) { if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress)) { return true; } return false; } +exports.isIpAddress = isIpAddress; function validateAuthentication() { return __awaiter(this, void 0, void 0, function* () { // 1. Check if valid auth @@ -74,11 +80,5 @@ function validateAuthentication() { } }); } -module.exports = { - validateAuthentication, - validateIsGitRepository, - validateDefinitionFile, - isIpAddress, - optionIsNotGiven -}; +exports.validateAuthentication = validateAuthentication; //# sourceMappingURL=validationsHandler.js.map \ No newline at end of file diff --git a/app-cli/built/utils/validationsHandler.js.map b/app-cli/built/utils/validationsHandler.js.map index 6ce3cdb..d09000e 100755 --- a/app-cli/built/utils/validationsHandler.js.map +++ b/app-cli/built/utils/validationsHandler.js.map @@ -1 +1 @@ -{"version":3,"file":"validationsHandler.js","sourceRoot":"","sources":["../../src/utils/validationsHandler.ts"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACnD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACtD,MAAM,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEzE,SAAS,uBAAuB;I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ACC,kKAAkK,CAAC,IAAI,CACtK,SAAS,CACT,EACA;QACD,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAe,sBAAsB;;QACpC,yBAAyB;QACzB,MAAM,eAAe,GAAG,MAAM,SAAS,CAAC,gBAAgB,EAAE,CAAC;QAE3D,mBAAmB;QACnB,WAAW;QACX,kBAAkB;QAClB,IAAI,CAAC,eAAe,EAAE;YACrB,MAAM,cAAc,GAAG,MAAM,YAAY,EAAE,CAAC;YAE5C,6BAA6B;YAC7B,2BAA2B,EAAE,CAAC;YAE9B,OAAO,cAAc,CAAC;SACtB;aAAM;YACN,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;SAChC;IACF,CAAC;CAAA;AAED,MAAM,CAAC,OAAO,GAAG;IAChB,sBAAsB;IACtB,uBAAuB;IACvB,sBAAsB;IACtB,WAAW;IACX,gBAAgB;CAChB,CAAC"} \ No newline at end of file +{"version":3,"file":"validationsHandler.js","sourceRoot":"","sources":["../../src/utils/validationsHandler.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACnD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACtD,MAAM,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEzE,SAAgB,uBAAuB;IACtC,MAAM,eAAe,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEpD,IAAI,CAAC,eAAe,EAAE;QACrB,UAAU,CACT,gHAAgH,EAChH,IAAI,CACJ,CAAC;KACF;AACF,CAAC;AATD,0DASC;AAED,SAAgB,sBAAsB;IACrC,MAAM,uBAA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,eAAe,GAAG,MAAM,SAAS,CAAC,gBAAgB,EAAE,CAAC;QAE3D,mBAAmB;QACnB,WAAW;QACX,kBAAkB;QAClB,IAAI,CAAC,eAAe,EAAE;YACrB,MAAM,cAAc,GAAG,MAAM,YAAY,EAAE,CAAC;YAE5C,6BAA6B;YAC7B,2BAA2B,EAAE,CAAC;YAE9B,OAAO,cAAc,CAAC;SACtB;aAAM;YACN,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;SAChC;IACF,CAAC;CAAA;AAjBD,wDAiBC"} \ No newline at end of file diff --git a/app-cli/src/commands/captainduckduck.js b/app-cli/src/commands/captainduckduck.js deleted file mode 100755 index c72825f..0000000 --- a/app-cli/src/commands/captainduckduck.js +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env node - -const { printError } = require("../utils/messageHandler") -const packagejson = require("../../package.json") -const updateNotifier = require("update-notifier") -const program = require("commander") - -updateNotifier({ pkg: packagejson }).notify({ isGlobal: true }) - -// Command actions -const serversetup = require("./serversetup") -const { login } = require("./login") -const logout = require("./logout") -const list = require("./list") -const deploy = require("./deploy") - -// Setup -program.version(packagejson.version).description(packagejson.description) - -// Commands -program - .command("serversetup") - .description("Performs necessary actions and prepares your Captain server.") - .action(() => { - serversetup() - }) - -program - .command("login") - .description( - "Login to a CaptainDuckDuck machine. You can be logged in to multiple machines simultaneously." - ) - .action(() => { - login() - }) - -program - .command("logout") - .description("Logout from a specific Captain machine.") - .action(() => { - logout() - }) - -program - .command("list") - .alias("ls") - .description("List all Captain machines currently logged in.") - .action(() => { - list() - }) - -program - .command("deploy") - .description( - "Deploy your app (current directory) to a specific Captain machine. You'll be prompted to choose your Captain machine." - ) - .option( - "-t, --tarFile ", - "Specify file to be uploaded (rather than using git archive)" - ) - .option("-d, --default", "Run with default options") - .option("-s, --stateless", "Run deploy stateless") - .option( - "-h, --host ", - "Only for stateless mode: Host of the captain machine" - ) - .option("-a, --appName ", "Only for stateless mode: Name of the app") - .option("-p, --pass ", "Only for stateless mode: Password for Captain") - .option( - "-b, --branch ", - "Only for stateless mode: Branch name (default master)" - ) - .action(options => { - deploy(options) - }) - -// Error on unknown commands -program.on("command:*", () => { - const wrongCommands = program.args.join(" ") - - printError( - `\nInvalid command: ${wrongCommands}\nSee --help for a list of available commands.`, - true - ) -}) - -program.parse(process.argv) diff --git a/app-cli/src/commands/captainduckduck.ts b/app-cli/src/commands/captainduckduck.ts new file mode 100755 index 0000000..fb6dca0 --- /dev/null +++ b/app-cli/src/commands/captainduckduck.ts @@ -0,0 +1,67 @@ +#!/usr/bin/env node + +import logout = require("./logout"); + +const { printError } = require('../utils/messageHandler'); +const packagejson = require('../../package.json'); +const updateNotifier = require('update-notifier'); +const program = require('commander'); + +updateNotifier({ pkg: packagejson }).notify({ isGlobal: true }); + +// Command actions +const serversetup = require('./serversetup'); +const { login } = require('./login'); +const list = require('./list'); +const deploy = require('./deploy'); + +// Setup +program.version(packagejson.version).description(packagejson.description); + +// Commands +program + .command('serversetup') + .description('Performs necessary actions and prepares your Captain server.') + .action(() => { + serversetup(); + }); + +program + .command('login') + .description('Login to a CaptainDuckDuck machine. You can be logged in to multiple machines simultaneously.') + .action(() => { + login(); + }); + +program.command('logout').description('Logout from a specific Captain machine.').action(() => { + logout(); +}); + +program.command('list').alias('ls').description('List all Captain machines currently logged in.').action(() => { + list(); +}); + +program + .command('deploy') + .description( + "Deploy your app (current directory) to a specific Captain machine. You'll be prompted to choose your Captain machine." + ) + .option('-t, --tarFile ', 'Specify file to be uploaded (rather than using git archive)') + .option('-d, --default', 'Run with default options') + .option('-s, --stateless', 'Run deploy stateless') + .option('-h, --host ', 'Only for stateless mode: Host of the captain machine') + .option('-a, --appName ', 'Only for stateless mode: Name of the app') + .option('-p, --pass ', 'Only for stateless mode: Password for Captain') + .option('-b, --branch ', 'Only for stateless mode: Branch name (default master)') + .action((options: any) => { + deploy(options); + }); + +// Error on unknown commands +program.on('command:*', () => { + const wrongCommands = program.args.join(' '); + + printError(`\nInvalid command: ${wrongCommands}\nSee --help for a list of available commands.`, true); +}); + +program.parse(process.argv); diff --git a/app-cli/src/commands/deploy.js b/app-cli/src/commands/deploy.js deleted file mode 100644 index 971a855..0000000 --- a/app-cli/src/commands/deploy.js +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env node - -const MachineHelper = require("../helpers/MachineHelper") -const DeployApi = require("../api/DeployApi") -const LoginApi = require("../api/LoginApi") -const { printError, printMessage } = require("../utils/messageHandler") -const { - validateIsGitRepository, - validateDefinitionFile, - optionIsNotGiven, - validateAuthentication -} = require("../utils/validationsHandler") -const { uploadFile } = require("../utils/fileHelper") -const { gitArchiveFile } = require("../utils/fileHelper") -const fs = require("fs-extra") -const path = require("path") -const inquirer = require("inquirer") -const commandExistsSync = require("command-exists").sync -const { initMachineFromLocalStorage } = require("../utils/machineUtils") - -async function deployAsDefaultValues() { - try { - const isValidAuthentication = await validateAuthentication() - - if (isValidAuthentication) { - const { appName, branchToPush, machineToDeploy } = DeployApi - - if (!appName || !branchToPush || !machineToDeploy) { - printError( - "Default deploy failed. There are no default options selected.", - true - ) - } - - printMessage(`Deploying to ${machineToDeploy.name}`) - - deployFromGitProject() - } else { - printError("Incorrect login details", true) - } - } catch (e) { - printError(e.message, true) - } -} - -async function deployAsStateless(host, appName, branch, pass) { - const isStateless = host && appName && branch && pass - - if (isStateless) { - // login first - printMessage(`Trying to login to ${host}\n`) - - const { name } = DeployApi.machineToDeploy - const response = await LoginApi.loginMachine(host, pass) - const data = JSON.parse(response) - const newToken = data.token - - // Update the token to the machine that corresponds (if needed) - MachineHelper.updateMachineAuthToken(name, newToken) - - if (data) { - printMessage( - `Starting stateless deploy to\n${host}\n${branch}\n${appName}` - ) - - deployFromGitProject() - } - } else { - printError( - "You are missing parameters for deploying on stateless. " - ) - } -} - -async function deployFromTarFile(tarFile) { - try { - const isValidAuthentication = await validateAuthentication() - - if (isValidAuthentication) { - // Send from tar file - const filePath = tarFile - const gitHash = "sendviatarfile" - - await uploadFile(filePath, gitHash) - } else { - printError("Incorrect login details", true) - } - } catch (e) { - printError(e.message, true) - } -} - -function deployFromGitProject() { - if (!commandExistsSync("git")) { - printError("'git' command not found...") - - printError( - "Captain needs 'git' to create tar file of your source files...", - true - ) - } - - const zipFileNameToDeploy = "temporary-captain-to-deploy.tar" - const zipFileFullPath = path.join(process.cwd(), zipFileNameToDeploy) - - printMessage(`Saving tar file to:\n${zipFileFullPath}\n`) - - // Removes the temporarly file created - try { - const tempFileExists = fs.pathExistsSync(zipFileFullPath) - - if (tempFileExists) { - fs.removeSync(zipFileFullPath) - } - } catch (e) { - // IgnoreError - } - - gitArchiveFile(zipFileFullPath, DeployApi.branchToPush) -} - -async function deploy(options) { - // Reads local storage and sets the machine if found - initMachineFromLocalStorage() - - if (!options.tarFile || !options.stateless) { - validateIsGitRepository() - - validateDefinitionFile() - } - - printMessage("Preparing deployment to Captain...\n") - - if (options.default) { - deployAsDefaultValues() - } else if (options.stateless) { - deployAsStateless( - options.host, - options.appName, - options.branch, - options.pass - ) - } else if (options.tarFile) { - deployFromTarFile(options.tarFile) - } else { - const questions = [ - { - type: "list", - name: "captainNameToDeploy", - default: DeployApi.machineToDeploy.name || "", - message: "Select the Captain Machine you want to deploy to:", - choices: MachineHelper.getMachinesAsOptions(), - when: () => optionIsNotGiven(options, "host") - }, - { - type: "input", - default: DeployApi.branchToPush || "master", - name: "branchToPush", - message: "Enter the 'git' branch you would like to deploy:", - when: () => optionIsNotGiven(options, "branch") - }, - { - type: "input", - default: DeployApi.appName, - name: "appName", - message: - "Enter the Captain app name this directory will be deployed to:", - when: () => optionIsNotGiven(options, "appName") - }, - { - type: "confirm", - name: "confirmedToDeploy", - message: - "Note that uncommitted files and files in gitignore (if any) will not be pushed to server. Please confirm so that deployment process can start.", - default: true, - when: () => optionIsNotGiven(options, "stateless") - } - ] - const answers = await inquirer.prompt(questions) - - if (!answers.confirmedToDeploy && !options.stateless) { - printMessage("\nOperation cancelled by the user...\n") - - process.exit(0) - } - - const captainNameToDeploy = answers.captainNameToDeploy - const branchToPush = answers.branchToPush || options.branch - const appName = answers.appName || options.appName - - DeployApi.updateMachineToDeploy(captainNameToDeploy || options.host) - - DeployApi.setBranchToPush(branchToPush) - - DeployApi.setAppName(appName) - - printMessage(`Deploying to ${DeployApi.machineToDeploy.name}`) - - // Normal deploy - if (answers.confirmedToDeploy) { - try { - const isValidAuthentication = await validateAuthentication() - - if (isValidAuthentication) { - deployFromGitProject() - } else { - printError("Incorrect login details", true) - } - } catch (e) { - printError(e.message, true) - } - } - } -} - -module.exports = deploy diff --git a/app-cli/src/commands/deploy.ts b/app-cli/src/commands/deploy.ts new file mode 100644 index 0000000..0e5d9f7 --- /dev/null +++ b/app-cli/src/commands/deploy.ts @@ -0,0 +1,200 @@ +#!/usr/bin/env node + +import MachineHelper from '../helpers/MachineHelper'; +const inquirer = require('inquirer'); +const DeployApi = require('../api/DeployApi'); +const LoginApi = require('../api/LoginApi'); +const { printError, printMessage } = require('../utils/messageHandler'); +const { + validateIsGitRepository, + validateDefinitionFile, + optionIsNotGiven, + validateAuthentication +} = require('../utils/validationsHandler'); +const { uploadFile } = require('../utils/fileHelper'); +const { gitArchiveFile } = require('../utils/fileHelper'); +const fs = require('fs-extra'); +const path = require('path'); +const commandExistsSync = require('command-exists').sync; +const { initMachineFromLocalStorage } = require('../utils/machineUtils'); + +async function deployAsDefaultValues() { + try { + const isValidAuthentication = await validateAuthentication(); + + if (isValidAuthentication) { + const { appName, branchToPush, machineToDeploy } = DeployApi; + + if (!appName || !branchToPush || !machineToDeploy) { + printError('Default deploy failed. There are no default options selected.', true); + } + + printMessage(`Deploying to ${machineToDeploy.name}`); + + deployFromGitProject(); + } else { + printError('Incorrect login details', true); + } + } catch (e) { + printError(e.message, true); + } +} + +async function deployAsStateless(host: string, appName: string, branch: string, pass: string) { + const isStateless = host && appName && branch && pass; + + if (isStateless) { + // login first + printMessage(`Trying to login to ${host}\n`); + + const { name } = DeployApi.machineToDeploy; + const response = await LoginApi.loginMachine(host, pass); + const data = JSON.parse(response); + const newToken = data.token; + + // Update the token to the machine that corresponds (if needed) + MachineHelper.updateMachineAuthToken(name, newToken); + + if (data) { + printMessage(`Starting stateless deploy to\n${host}\n${branch}\n${appName}`); + + deployFromGitProject(); + } + } else { + printError('You are missing parameters for deploying on stateless. '); + } +} + +async function deployFromTarFile(tarFile: string) { + try { + const isValidAuthentication = await validateAuthentication(); + + if (isValidAuthentication) { + // Send from tar file + const filePath = tarFile; + const gitHash = 'sendviatarfile'; + + await uploadFile(filePath, gitHash); + } else { + printError('Incorrect login details', true); + } + } catch (e) { + printError(e.message, true); + } +} + +function deployFromGitProject() { + if (!commandExistsSync('git')) { + printError("'git' command not found..."); + + printError("Captain needs 'git' to create tar file of your source files...", true); + } + + const zipFileNameToDeploy = 'temporary-captain-to-deploy.tar'; + const zipFileFullPath = path.join(process.cwd(), zipFileNameToDeploy); + + printMessage(`Saving tar file to:\n${zipFileFullPath}\n`); + + // Removes the temporarly file created + try { + const tempFileExists = fs.pathExistsSync(zipFileFullPath); + + if (tempFileExists) { + fs.removeSync(zipFileFullPath); + } + } catch (e) { + // IgnoreError + } + + gitArchiveFile(zipFileFullPath, DeployApi.branchToPush); +} + +async function deploy(options: any) { + // Reads local storage and sets the machine if found + initMachineFromLocalStorage(); + + if (!options.tarFile || !options.stateless) { + validateIsGitRepository(); + + validateDefinitionFile(); + } + + printMessage('Preparing deployment to Captain...\n'); + + if (options.default) { + deployAsDefaultValues(); + } else if (options.stateless) { + deployAsStateless(options.host, options.appName, options.branch, options.pass); + } else if (options.tarFile) { + deployFromTarFile(options.tarFile); + } else { + const questions = [ + { + type: 'list', + name: 'captainNameToDeploy', + default: DeployApi.machineToDeploy.name || '', + message: 'Select the Captain Machine you want to deploy to:', + choices: MachineHelper.getMachinesAsOptions(), + when: () => optionIsNotGiven(options, 'host') + }, + { + type: 'input', + default: DeployApi.branchToPush || 'master', + name: 'branchToPush', + message: "Enter the 'git' branch you would like to deploy:", + when: () => optionIsNotGiven(options, 'branch') + }, + { + type: 'input', + default: DeployApi.appName, + name: 'appName', + message: 'Enter the Captain app name this directory will be deployed to:', + when: () => optionIsNotGiven(options, 'appName') + }, + { + type: 'confirm', + name: 'confirmedToDeploy', + message: + 'Note that uncommitted files and files in gitignore (if any) will not be pushed to server. Please confirm so that deployment process can start.', + default: true, + when: () => optionIsNotGiven(options, 'stateless') + } + ]; + const answers = await inquirer.prompt(questions); + + if (!answers.confirmedToDeploy && !options.stateless) { + printMessage('\nOperation cancelled by the user...\n'); + + process.exit(0); + } + + const captainNameToDeploy = answers.captainNameToDeploy; + const branchToPush = answers.branchToPush || options.branch; + const appName = answers.appName || options.appName; + + DeployApi.updateMachineToDeploy(captainNameToDeploy || options.host); + + DeployApi.setBranchToPush(branchToPush); + + DeployApi.setAppName(appName); + + printMessage(`Deploying to ${DeployApi.machineToDeploy.name}`); + + // Normal deploy + if (answers.confirmedToDeploy) { + try { + const isValidAuthentication = await validateAuthentication(); + + if (isValidAuthentication) { + deployFromGitProject(); + } else { + printError('Incorrect login details', true); + } + } catch (e) { + printError(e.message, true); + } + } + } +} + +export = deploy; diff --git a/app-cli/src/commands/list.js b/app-cli/src/commands/list.js deleted file mode 100644 index d0172df..0000000 --- a/app-cli/src/commands/list.js +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env node - -const chalk = require("chalk") -const MachineHelper = require("../helpers/MachineHelper") -const { printMessage } = require("../utils/messageHandler") - -function _displayMachine(machine) { - console.log( - ">> " + - chalk.greenBright(machine.name) + - " at " + - chalk.cyan(machine.baseUrl) - ) -} - -function list() { - printMessage("\nLogged in Captain Machines:\n") - - MachineHelper.machines.map(machine => { - _displayMachine(machine) - }) - - printMessage("") -} - -module.exports = list diff --git a/app-cli/src/commands/list.ts b/app-cli/src/commands/list.ts new file mode 100644 index 0000000..efeee5e --- /dev/null +++ b/app-cli/src/commands/list.ts @@ -0,0 +1,22 @@ +#!/usr/bin/env node + +const chalk = require('chalk'); +import MachineHelper from '../helpers/MachineHelper'; +import { IMachine } from '../models/IModels'; +const { printMessage } = require('../utils/messageHandler'); + +function _displayMachine(machine: IMachine) { + console.log('>> ' + chalk.greenBright(machine.name) + ' at ' + chalk.cyan(machine.baseUrl)); +} + +function list() { + printMessage('\nLogged in Captain Machines:\n'); + + MachineHelper.getMachines().map((machine) => { + _displayMachine(machine); + }); + + printMessage(''); +} + +export = list; diff --git a/app-cli/src/commands/login.js b/app-cli/src/commands/login.js deleted file mode 100644 index 1f4ef74..0000000 --- a/app-cli/src/commands/login.js +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/env node - -const MachineHelper = require("../helpers/MachineHelper") -const { - printMessage, - printGreenMessage, - printError -} = require("../utils/messageHandler") -const inquirer = require("inquirer") -const DeployApi = require("../api/DeployApi") -const { cleanUpUrl, findDefaultCaptainName } = require("../utils/loginHelpers") -const { SAMPLE_DOMAIN } = require("../utils/constants") -const LoginApi = require("../api/LoginApi") - -// In case the token is expired -async function requestLogin() { - const { baseUrl, name } = DeployApi.machineToDeploy - - printMessage("Your auth token is not valid anymore. Try to login again.") - - const questions = [ - { - type: "password", - name: "captainPassword", - message: "Please enter your password for " + baseUrl, - validate: function(value) { - if (value && value.trim()) { - return true - } - - return "Please enter your password for " + baseUrl - } - } - ] - const loginPassword = await inquirer.prompt(questions) - const password = loginPassword.captainPassword - const response = await LoginApi.loginMachine(baseUrl, password) - const data = JSON.parse(response) - const newToken = data.token - - if (!newToken) return false - - // Update the token to the machine that corresponds - MachineHelper.updateMachineAuthToken(name, newToken) - - return true -} - -async function login() { - printMessage("Login to a Captain Machine") - - const questions = [ - { - type: "input", - default: SAMPLE_DOMAIN, - name: "captainAddress", - message: - "\nEnter address of the Captain machine. \nIt is captain.[your-captain-root-domain] :", - validate: value => { - if (value === SAMPLE_DOMAIN) { - return "Enter a valid URL" - } - - if (!cleanUpUrl(value)) return "This is an invalid URL: " + value - - MachineHelper.machines.map(machine => { - if (cleanUpUrl(machine.baseUrl) === cleanUpUrl(value)) { - return `${value} already exist as ${ - machine.name - }. If you want to replace the existing entry, you have to first use command, and then re-login.` - } - }) - - if (value && value.trim()) { - return true - } - - return "Please enter a valid address." - } - }, - { - type: "confirm", - name: "captainHasRootSsl", - message: "Is HTTPS activated for this Captain machine?", - default: true - }, - { - type: "password", - name: "captainPassword", - message: "Enter your password:", - validate: value => { - if (value && value.trim()) { - return true - } - - return "Please enter your password." - } - }, - { - type: "input", - name: "captainName", - message: "Enter a name for this Captain machine:", - default: findDefaultCaptainName(), - validate: value => { - MachineHelper.machines.map(machine => { - if (machine.name === value) { - return `${value} already exist. If you want to replace the existing entry, you have to first use command, and then re-login.` - } - }) - - if (value.match(/^[-\d\w]+$/i)) { - return true - } - - return "Please enter a Captain Name." - } - } - ] - const answers = await inquirer.prompt(questions) - const { - captainHasRootSsl, - captainPassword, - captainAddress, - captainName - } = answers - const handleHttp = captainHasRootSsl ? "https://" : "http://" - const baseUrl = `${handleHttp}${cleanUpUrl(captainAddress)}` - - try { - const data = await LoginApi.loginMachine(baseUrl, captainPassword) - const response = JSON.parse(data) - - // TODO - This status should be 200 maybe? - if (response.status !== 100) { - throw new Error(JSON.stringify(response, null, 2)) - } - - const newMachine = { - authToken: response.token, - baseUrl, - name: captainName - } - - MachineHelper.addMachine(newMachine) - - printGreenMessage(`Logged in successfully to ${baseUrl}`) - - printGreenMessage(`Authorization token is now saved as ${captainName} \n`) - } catch (error) { - const errorMessage = error.message ? error.message : error - - printError( - `Something bad happened. Cannot save "${captainName}" \n${errorMessage}` - ) - } -} - -module.exports = { login, requestLogin } diff --git a/app-cli/src/commands/login.ts b/app-cli/src/commands/login.ts new file mode 100644 index 0000000..fb2b75b --- /dev/null +++ b/app-cli/src/commands/login.ts @@ -0,0 +1,145 @@ +#!/usr/bin/env node + +import MachineHelper from '../helpers/MachineHelper'; + +const { printMessage, printGreenMessage, printError } = require('../utils/messageHandler'); +const inquirer = require('inquirer'); +const DeployApi = require('../api/DeployApi'); +const { cleanUpUrl, findDefaultCaptainName } = require('../utils/loginHelpers'); +const { SAMPLE_DOMAIN } = require('../utils/constants'); +const LoginApi = require('../api/LoginApi'); + +// In case the token is expired +async function requestLogin() { + const { baseUrl, name } = DeployApi.machineToDeploy; + + printMessage('Your auth token is not valid anymore. Try to login again.'); + + const questions = [ + { + type: 'password', + name: 'captainPassword', + message: 'Please enter your password for ' + baseUrl, + validate: (value: string) => { + if (value && value.trim()) { + return true; + } + + return 'Please enter your password for ' + baseUrl; + } + } + ]; + const loginPassword = await inquirer.prompt(questions); + const password = loginPassword.captainPassword; + const response = await LoginApi.loginMachine(baseUrl, password); + const data = JSON.parse(response); + const newToken = data.token; + + if (!newToken) return false; + + // Update the token to the machine that corresponds + MachineHelper.updateMachineAuthToken(name, newToken); + + return true; +} + +async function login() { + printMessage('Login to a Captain Machine'); + + const questions = [ + { + type: 'input', + default: SAMPLE_DOMAIN, + name: 'captainAddress', + message: '\nEnter address of the Captain machine. \nIt is captain.[your-captain-root-domain] :', + validate: (value: string) => { + if (value === SAMPLE_DOMAIN) { + return 'Enter a valid URL'; + } + + if (!cleanUpUrl(value)) return 'This is an invalid URL: ' + value; + + MachineHelper.getMachines().map((machine) => { + if (cleanUpUrl(machine.baseUrl) === cleanUpUrl(value)) { + return `${value} already exist as ${machine.name}. If you want to replace the existing entry, you have to first use command, and then re-login.`; + } + }); + + if (value && value.trim()) { + return true; + } + + return 'Please enter a valid address.'; + } + }, + { + type: 'confirm', + name: 'captainHasRootSsl', + message: 'Is HTTPS activated for this Captain machine?', + default: true + }, + { + type: 'password', + name: 'captainPassword', + message: 'Enter your password:', + validate: (value: string) => { + if (value && value.trim()) { + return true; + } + + return 'Please enter your password.'; + } + }, + { + type: 'input', + name: 'captainName', + message: 'Enter a name for this Captain machine:', + default: findDefaultCaptainName(), + validate: (value: string) => { + MachineHelper.getMachines().map((machine) => { + if (machine.name === value) { + return `${value} already exist. If you want to replace the existing entry, you have to first use command, and then re-login.`; + } + }); + + if (value.match(/^[-\d\w]+$/i)) { + return true; + } + + return 'Please enter a Captain Name.'; + } + } + ]; + const answers = await inquirer.prompt(questions); + const { captainHasRootSsl, captainPassword, captainAddress, captainName } = answers; + const handleHttp = captainHasRootSsl ? 'https://' : 'http://'; + const baseUrl = `${handleHttp}${cleanUpUrl(captainAddress)}`; + + try { + const data = await LoginApi.loginMachine(baseUrl, captainPassword); + const response = JSON.parse(data); + + // TODO - This status should be 200 maybe? + if (response.status !== 100) { + throw new Error(JSON.stringify(response, null, 2)); + } + + const newMachine = { + authToken: response.token, + baseUrl, + name: captainName + }; + + MachineHelper.addMachine(newMachine); + + printGreenMessage(`Logged in successfully to ${baseUrl}`); + + printGreenMessage(`Authorization token is now saved as ${captainName} \n`); + } catch (error) { + const errorMessage = error.message ? error.message : error; + + printError(`Something bad happened. Cannot save "${captainName}" \n${errorMessage}`); + } +} + +export = { login, requestLogin }; diff --git a/app-cli/src/commands/logout.js b/app-cli/src/commands/logout.js deleted file mode 100644 index ddcc401..0000000 --- a/app-cli/src/commands/logout.js +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env node - -const MachineHelper = require("../helpers/MachineHelper") -const { printMessage } = require("../utils/messageHandler") -const inquirer = require("inquirer") - -function generateQuestions() { - const listOfMachines = MachineHelper.getMachinesAsOptions() - - return [ - { - type: "list", - name: "captainNameToLogout", - message: "Select the Captain Machine you want to logout from:", - choices: listOfMachines - }, - { - type: "confirm", - name: "confirmedToLogout", - message: "Are you sure you want to logout from this Captain machine?", - default: false, - when: answers => answers.captainNameToLogout - } - ] -} - -async function logout() { - const questions = generateQuestions() - - printMessage("Logout from a Captain Machine and clear auth info") - - const answers = await inquirer.prompt(questions) - const { captainNameToLogout } = answers - - if (!captainNameToLogout) { - printMessage("\nOperation cancelled by the user...\n", true) - } - - MachineHelper.logoutMachine(captainNameToLogout) -} - -module.exports = logout diff --git a/app-cli/src/commands/logout.ts b/app-cli/src/commands/logout.ts new file mode 100644 index 0000000..27547a7 --- /dev/null +++ b/app-cli/src/commands/logout.ts @@ -0,0 +1,42 @@ +#!/usr/bin/env node + +const MachineHelper = require('../helpers/MachineHelper'); +const { printMessage } = require('../utils/messageHandler'); +const inquirer = require('inquirer'); + +function generateQuestions() { + const listOfMachines = MachineHelper.getMachinesAsOptions(); + + return [ + { + type: 'list', + name: 'captainNameToLogout', + message: 'Select the Captain Machine you want to logout from:', + choices: listOfMachines + }, + { + type: 'confirm', + name: 'confirmedToLogout', + message: 'Are you sure you want to logout from this Captain machine?', + default: false, + when: (answers: any) => answers.captainNameToLogout + } + ]; +} + +async function logout() { + const questions = generateQuestions(); + + printMessage('Logout from a Captain Machine and clear auth info'); + + const answers = await inquirer.prompt(questions); + const { captainNameToLogout } = answers; + + if (!captainNameToLogout) { + printMessage('\nOperation cancelled by the user...\n', true); + } + + MachineHelper.logoutMachine(captainNameToLogout); +} + +export = logout; diff --git a/app-cli/src/commands/serversetup.js b/app-cli/src/commands/serversetup.js deleted file mode 100644 index 7b9f753..0000000 --- a/app-cli/src/commands/serversetup.js +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/env node - -const MachineHelper = require("../helpers/MachineHelper") -const SystemApi = require("../api/SystemApi") -const LoginApi = require("../api/LoginApi") -const inquirer = require("inquirer") -const { findDefaultCaptainName } = require("../utils/loginHelpers") -const { isIpAddress } = require("../utils/validationsHandler") -const { SAMPLE_IP, DEFAULT_PASSWORD } = require("../utils/constants") -const { - printMessage, - printError, - printMessageAndExit, - errorHandler -} = require("../utils/messageHandler") -let newPasswordFirstTry = undefined -const questions = [ - { - type: "list", - name: "hasInstalledCaptain", - message: - "Have you already installed Captain on your server by running the following line:" + - "\nmkdir /captain && docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock dockersaturn/captainduckduck ?", - default: "Yes", - choices: ["Yes", "No"], - filter: value => { - const answerFromUser = value.trim() - - if (answerFromUser === "Yes") return answerFromUser - - printMessage( - "\n\nCannot start the setup process if Captain is not installed." - ) - - printMessageAndExit( - "Please read tutorial on CaptainDuckDuck.com to learn how to install CaptainDuckDuck on a server." - ) - } - }, - { - type: "input", - default: SAMPLE_IP, - name: "captainAddress", - message: "Enter IP address of your captain server:", - filter: async value => { - const ipFromUser = value.trim() - - if (ipFromUser === SAMPLE_IP || !isIpAddress(ipFromUser)) { - printError(`\nThis is an invalid IP Address: ${ipFromUser}`, true) - } - - try { - // login using captain42. and set the ipAddressToServer - const data = await LoginApi.loginMachine( - `http://${ipFromUser}:3000`, - DEFAULT_PASSWORD - ) - - SystemApi.setIpAddressOfServer(ipFromUser) - - // All went well - if (data) return ipFromUser - } catch (e) { - errorHandler(e) - } - } - }, - { - type: "password", - name: "captainOriginalPassword", - message: "Enter your current password:", - when: () => !LoginApi.token, - filter: async value => { - try { - const captainPasswordFromUser = value.trim() - const data = await LoginApi.loginMachine( - `http://${SystemApi.ipAddressOfServer}:3000`, - captainPasswordFromUser - ) - - if (data) { - SystemApi.setIpAddressOfServer(captainPasswordFromUser) - - LoginApi.setOldPassword(captainPasswordFromUser) - } - } catch (e) { - errorHandler(e) - } - } - }, - { - type: "input", - name: "captainRootDomain", - message: - "Enter a root domain for this Captain server. For example, enter test.yourdomain.com if you" + - " setup your DNS to point *.test.yourdomain.com to ip address of your server" + - ": ", - filter: async value => { - try { - const captainRootDomainFromUser = value.trim() - const data = await SystemApi.setCustomDomain( - `http://${SystemApi.ipAddressOfServer}:3000`, - captainRootDomainFromUser - ) - - if (data) { - const newCustomDomainFromUser = `captain.${captainRootDomainFromUser}` - - SystemApi.setCustomDomainFromUser(newCustomDomainFromUser) - - return captainRootDomainFromUser - } - } catch (e) { - errorHandler(e) - } - } - }, - { - type: "input", - name: "emailAddress", - message: "Enter your 'valid' email address to enable HTTPS: ", - filter: async value => { - try { - const emailAddressFromUser = value.trim() - const { customDomainFromUser } = SystemApi - - await SystemApi.enableHttps( - `http://${customDomainFromUser}`, - emailAddressFromUser - ) - - const data = await SystemApi.forceHttps( - `https://${customDomainFromUser}` - ) - - if (data) return emailAddressFromUser - } catch (e) { - errorHandler(e) - } - } - }, - { - type: "password", - name: "newPasswordFirstTry", - message: "Enter a new password:", - filter: value => { - newPasswordFirstTry = value - - return value - } - }, - { - type: "password", - name: "newPassword", - message: "Enter a new password:", - filter: async value => { - const { customDomainFromUser } = SystemApi - - try { - const confirmPasswordValueFromUser = value - const machineUrl = `https://${customDomainFromUser}` - - if (newPasswordFirstTry !== confirmPasswordValueFromUser) { - printError("Passwords do not match", true) - } - - const changePassData = await LoginApi.changePass( - machineUrl, - confirmPasswordValueFromUser - ) - - if (changePassData) { - const loginData = await LoginApi.login( - machineUrl, - confirmPasswordValueFromUser - ) - - if (loginData) return - } - } catch (e) { - printError( - "\nIMPORTANT!! Server setup is completed by password is not changed." - ) - - printError("\nYou CANNOT use serversetup anymore. To continue:") - - printError( - `\n- Go to https://${customDomainFromUser} login with default password and change the password in settings.` - ) - - printError( - `\n- In terminal (here), type captainduckduck login and enter this as your root domain: ${customDomainFromUser}`, - true - ) - } - } - }, - { - type: "input", - name: "captainName", - message: "Enter a name for this Captain machine:", - default: findDefaultCaptainName(), - validate: value => { - const newMachineName = value.trim() - - MachineHelper.machines.map( - machine => - machine.name === newMachineName && - `${newMachineName} already exist. If you want to replace the existing entry, you have to first use command, and then re-login.` - ) - - if (value.match(/^[-\d\w]+$/i)) { - return true - } - - return "Please enter a Captain Name." - } - } -] - -async function serversetup() { - printMessage("\nSetup your Captain server\n") - - const answers = await inquirer.prompt(questions) - const captainAddress = `https://${SystemApi.customDomainFromUser}` - const newMachine = { - authToken: LoginApi.token, - baseUrl: captainAddress, - name: answers.captainName - } - - MachineHelper.addMachine(newMachine) - - printMessage(`\n\nCaptain is available at ${captainAddress}`) - - printMessage( - "\nFor more details and docs see http://www.captainduckduck.com\n\n" - ) -} - -module.exports = serversetup diff --git a/app-cli/src/commands/serversetup.ts b/app-cli/src/commands/serversetup.ts new file mode 100644 index 0000000..70bc8a9 --- /dev/null +++ b/app-cli/src/commands/serversetup.ts @@ -0,0 +1,218 @@ +#!/usr/bin/env node + +import { isIpAddress } from '../utils/validationsHandler'; + +const SystemApi = require('../api/SystemApi'); +const LoginApi = require('../api/LoginApi'); +const inquirer = require('inquirer'); +const { findDefaultCaptainName } = require('../utils/loginHelpers'); +const { SAMPLE_IP, DEFAULT_PASSWORD } = require('../utils/constants'); +const { printMessage, printError, printMessageAndExit, errorHandler } = require('../utils/messageHandler'); +import MachineHelper from '../helpers/MachineHelper'; + +let newPasswordFirstTry: string | undefined = undefined; +const questions = [ + { + type: 'list', + name: 'hasInstalledCaptain', + message: + 'Have you already installed Captain on your server by running the following line:' + + '\nmkdir /captain && docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock dockersaturn/captainduckduck ?', + default: 'Yes', + choices: [ 'Yes', 'No' ], + filter: (value: string) => { + const answerFromUser = value.trim(); + + if (answerFromUser === 'Yes') return answerFromUser; + + printMessage('\n\nCannot start the setup process if Captain is not installed.'); + + printMessageAndExit( + 'Please read tutorial on CaptainDuckDuck.com to learn how to install CaptainDuckDuck on a server.' + ); + } + }, + { + type: 'input', + default: SAMPLE_IP, + name: 'captainAddress', + message: 'Enter IP address of your captain server:', + filter: async (value: string) => { + const ipFromUser = value.trim(); + + if (ipFromUser === SAMPLE_IP || !isIpAddress(ipFromUser)) { + printError(`\nThis is an invalid IP Address: ${ipFromUser}`, true); + } + + try { + // login using captain42. and set the ipAddressToServer + const data = await LoginApi.loginMachine(`http://${ipFromUser}:3000`, DEFAULT_PASSWORD); + + SystemApi.setIpAddressOfServer(ipFromUser); + + // All went well + if (data) return ipFromUser; + } catch (e) { + errorHandler(e); + } + } + }, + { + type: 'password', + name: 'captainOriginalPassword', + message: 'Enter your current password:', + when: () => !LoginApi.token, + filter: async (value: string) => { + try { + const captainPasswordFromUser = value.trim(); + const data = await LoginApi.loginMachine( + `http://${SystemApi.ipAddressOfServer}:3000`, + captainPasswordFromUser + ); + + if (data) { + SystemApi.setIpAddressOfServer(captainPasswordFromUser); + + LoginApi.setOldPassword(captainPasswordFromUser); + } + } catch (e) { + errorHandler(e); + } + } + }, + { + type: 'input', + name: 'captainRootDomain', + message: + 'Enter a root domain for this Captain server. For example, enter test.yourdomain.com if you' + + ' setup your DNS to point *.test.yourdomain.com to ip address of your server' + + ': ', + filter: async (value: string) => { + try { + const captainRootDomainFromUser = value.trim(); + const data = await SystemApi.setCustomDomain( + `http://${SystemApi.ipAddressOfServer}:3000`, + captainRootDomainFromUser + ); + + if (data) { + const newCustomDomainFromUser = `captain.${captainRootDomainFromUser}`; + + SystemApi.setCustomDomainFromUser(newCustomDomainFromUser); + + return captainRootDomainFromUser; + } + } catch (e) { + errorHandler(e); + } + } + }, + { + type: 'input', + name: 'emailAddress', + message: "Enter your 'valid' email address to enable HTTPS: ", + filter: async (value: string) => { + try { + const emailAddressFromUser = value.trim(); + const { customDomainFromUser } = SystemApi; + + await SystemApi.enableHttps(`http://${customDomainFromUser}`, emailAddressFromUser); + + const data = await SystemApi.forceHttps(`https://${customDomainFromUser}`); + + if (data) return emailAddressFromUser; + } catch (e) { + errorHandler(e); + } + } + }, + { + type: 'password', + name: 'newPasswordFirstTry', + message: 'Enter a new password:', + filter: (value: string) => { + newPasswordFirstTry = value; + + return value; + } + }, + { + type: 'password', + name: 'newPassword', + message: 'Enter a new password:', + filter: async (value: string) => { + const { customDomainFromUser } = SystemApi; + + try { + const confirmPasswordValueFromUser = value; + const machineUrl = `https://${customDomainFromUser}`; + + if (newPasswordFirstTry !== confirmPasswordValueFromUser) { + printError('Passwords do not match', true); + } + + const changePassData = await LoginApi.changePass(machineUrl, confirmPasswordValueFromUser); + + if (changePassData) { + const loginData = await LoginApi.login(machineUrl, confirmPasswordValueFromUser); + + if (loginData) return; + } + } catch (e) { + printError('\nIMPORTANT!! Server setup is completed by password is not changed.'); + + printError('\nYou CANNOT use serversetup anymore. To continue:'); + + printError( + `\n- Go to https://${customDomainFromUser} login with default password and change the password in settings.` + ); + + printError( + `\n- In terminal (here), type captainduckduck login and enter this as your root domain: ${customDomainFromUser}`, + true + ); + } + } + }, + { + type: 'input', + name: 'captainName', + message: 'Enter a name for this Captain machine:', + default: findDefaultCaptainName(), + validate: (value: string) => { + const newMachineName = value.trim(); + + MachineHelper.getMachines().map( + (machine) => + machine.name === newMachineName && + `${newMachineName} already exist. If you want to replace the existing entry, you have to first use command, and then re-login.` + ); + + if (value.match(/^[-\d\w]+$/i)) { + return true; + } + + return 'Please enter a Captain Name.'; + } + } +]; + +async function serversetup() { + printMessage('\nSetup your Captain server\n'); + + const answers = await inquirer.prompt(questions); + const captainAddress = `https://${SystemApi.customDomainFromUser}`; + const newMachine = { + authToken: LoginApi.token, + baseUrl: captainAddress, + name: answers.captainName + }; + + MachineHelper.addMachine(newMachine); + + printMessage(`\n\nCaptain is available at ${captainAddress}`); + + printMessage('\nFor more details and docs see http://www.captainduckduck.com\n\n'); +} + +export = serversetup; diff --git a/app-cli/src/helpers/MachineHelper.ts b/app-cli/src/helpers/MachineHelper.ts index 6283e90..ac3509b 100644 --- a/app-cli/src/helpers/MachineHelper.ts +++ b/app-cli/src/helpers/MachineHelper.ts @@ -35,6 +35,10 @@ class MachineHelper { return [ ...firstItemInOption, ...listOfMachines ]; } + getMachines() { + return this.machines; + } + setMachines(newMachines: IMachine[]) { this.machines = newMachines; @@ -104,4 +108,6 @@ class MachineHelper { } } -module.exports = new MachineHelper(); +const instance = new MachineHelper(); + +export default instance; diff --git a/app-cli/src/utils/fileHelper.ts b/app-cli/src/utils/fileHelper.ts index 344e4cf..3817549 100644 --- a/app-cli/src/utils/fileHelper.ts +++ b/app-cli/src/utils/fileHelper.ts @@ -161,8 +161,7 @@ function deleteFileFromDisk(filePath: string) { fs.removeSync(filePath); } } - -module.exports = { +export = { gitArchiveFile, getFileStream, uploadFile, diff --git a/app-cli/src/utils/loginHelpers.ts b/app-cli/src/utils/loginHelpers.ts index f40f59b..2be1d38 100644 --- a/app-cli/src/utils/loginHelpers.ts +++ b/app-cli/src/utils/loginHelpers.ts @@ -1,6 +1,5 @@ import { IMachine } from '../models/IModels'; - -const MachineHelper = require('../helpers/MachineHelper'); +import MachineHelper from '../helpers/MachineHelper'; function cleanUpUrl(url: string) { if (!url || !url.length) return null; @@ -17,7 +16,7 @@ function cleanUpUrl(url: string) { } function findDefaultCaptainName() { - let currentSuffix = MachineHelper.machines.length + 1; + let currentSuffix = MachineHelper.getMachines().length + 1; while (!isSuffixValid(currentSuffix)) { currentSuffix++; @@ -33,11 +32,11 @@ function getCaptainFullName(suffix: number) { } const isSuffixValid = (suffixNumber: number) => - MachineHelper.machines.map((machine: IMachine) => { + MachineHelper.getMachines().map((machine: IMachine) => { machine.name !== getCaptainFullName(suffixNumber); }); -module.exports = { +export = { cleanUpUrl, findDefaultCaptainName, isSuffixValid, diff --git a/app-cli/src/utils/machineUtils.ts b/app-cli/src/utils/machineUtils.ts index 5896215..88b2c23 100644 --- a/app-cli/src/utils/machineUtils.ts +++ b/app-cli/src/utils/machineUtils.ts @@ -52,7 +52,7 @@ function saveMachineToLocalStorage() { } } -module.exports = { +export = { initMachineFromLocalStorage, saveMachineToLocalStorage }; diff --git a/app-cli/src/utils/validationsHandler.ts b/app-cli/src/utils/validationsHandler.ts index 00204c0..0b7a955 100644 --- a/app-cli/src/utils/validationsHandler.ts +++ b/app-cli/src/utils/validationsHandler.ts @@ -4,7 +4,7 @@ const { printError } = require('./messageHandler'); const { requestLogin } = require('../commands/login'); const { initMachineFromLocalStorage } = require('../utils/machineUtils'); -function validateIsGitRepository() { +export function validateIsGitRepository() { const gitFolderExists = fs.pathExistsSync('./.git'); if (!gitFolderExists) { @@ -15,7 +15,7 @@ function validateIsGitRepository() { } } -function validateDefinitionFile() { +export function validateDefinitionFile() { const captainDefinitionExists = fs.pathExistsSync('./captain-definition'); if (!captainDefinitionExists) { @@ -53,7 +53,7 @@ function validateDefinitionFile() { } // Only show that question if there is no option given as argument -function optionIsNotGiven(allOptions: { [id: string]: any }, option: string) { +export function optionIsNotGiven(allOptions: { [id: string]: any }, option: string) { // console.log(allOptions) if (allOptions[option]) { return false; @@ -62,7 +62,7 @@ function optionIsNotGiven(allOptions: { [id: string]: any }, option: string) { return true; } -function isIpAddress(ipaddress: string) { +export function isIpAddress(ipaddress: string) { if ( /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test( ipaddress @@ -74,7 +74,7 @@ function isIpAddress(ipaddress: string) { return false; } -async function validateAuthentication() { +export async function validateAuthentication() { // 1. Check if valid auth const isAuthenticated = await DeployApi.isAuthTokenValid(); @@ -92,11 +92,3 @@ async function validateAuthentication() { return Boolean(isAuthenticated); } } - -module.exports = { - validateAuthentication, - validateIsGitRepository, - validateDefinitionFile, - isIpAddress, - optionIsNotGiven -};