From 9b33bbdb3a3e8c0b9fef171e2b81e244ab24b43f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 26 Feb 2021 17:09:20 +0000 Subject: [PATCH] Formatting. --- packages/cli/src/hosting/index.js | 25 ++++++++++++++++++------- packages/cli/src/hosting/makeEnv.js | 15 ++++++++++++--- packages/cli/src/questions.js | 4 ++-- packages/cli/src/structures/Command.js | 6 +----- packages/cli/src/utils.js | 2 +- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/packages/cli/src/hosting/index.js b/packages/cli/src/hosting/index.js index 4175556720..a3a4b4cffa 100644 --- a/packages/cli/src/hosting/index.js +++ b/packages/cli/src/hosting/index.js @@ -11,7 +11,7 @@ const BUDIBASE_SERVICES = ["app-service", "worker-service"] const ERROR_FILE = "docker-error.log" const FILE_URLS = [ "https://raw.githubusercontent.com/Budibase/budibase/master/hosting/docker-compose.yaml", - "https://raw.githubusercontent.com/Budibase/budibase/master/hosting/envoy.yaml" + "https://raw.githubusercontent.com/Budibase/budibase/master/hosting/envoy.yaml", ] async function downloadFiles() { @@ -24,7 +24,8 @@ async function downloadFiles() { } async function checkDockerConfigured() { - const error = "docker/docker-compose has not been installed, please follow instructions at: https://docs.budibase.com/self-hosting/hosting-methods/docker-compose#installing-docker" + const error = + "docker/docker-compose has not been installed, please follow instructions at: https://docs.budibase.com/self-hosting/hosting-methods/docker-compose#installing-docker" const docker = await lookpath("docker") const compose = await lookpath("docker-compose") if (!docker || !compose) { @@ -51,7 +52,9 @@ async function handleError(func) { async function init() { await checkDockerConfigured() - const shouldContinue = await confirmation("This will create multiple files in current directory, should continue?") + const shouldContinue = await confirmation( + "This will create multiple files in current directory, should continue?" + ) if (!shouldContinue) { console.log("Stopping.") return @@ -66,9 +69,13 @@ async function start() { console.log(info("Starting services, this may take a moment.")) const port = envFile.get("MAIN_PORT") await handleError(async () => { - await compose.upAll({cwd: "./", log: false}) + await compose.upAll({ cwd: "./", log: false }) }) - console.log(success(`Services started, please go to http://localhost:${port} for next steps.`)) + console.log( + success( + `Services started, please go to http://localhost:${port} for next steps.` + ) + ) } async function status() { @@ -94,7 +101,11 @@ async function stop() { async function update() { await checkDockerConfigured() checkInitComplete() - if (await confirmation("Do you wish to update you docker-compose.yaml and envoy.yaml?")) { + if ( + await confirmation( + "Do you wish to update you docker-compose.yaml and envoy.yaml?" + ) + ) { await downloadFiles() } await handleError(async () => { @@ -106,7 +117,7 @@ async function update() { await compose.stop() } console.log(info("Beginning update, this may take a few minutes.")) - await compose.pullMany(BUDIBASE_SERVICES, {log: true}) + await compose.pullMany(BUDIBASE_SERVICES, { log: true }) if (isUp) { console.log(success("Update complete, restarting services...")) await start() diff --git a/packages/cli/src/hosting/makeEnv.js b/packages/cli/src/hosting/makeEnv.js index b3c32c3d3c..b7d3b9e849 100644 --- a/packages/cli/src/hosting/makeEnv.js +++ b/packages/cli/src/hosting/makeEnv.js @@ -32,11 +32,20 @@ BUDIBASE_ENVIRONMENT=PRODUCTION` module.exports.filePath = FILE_PATH module.exports.make = async () => { - const hostingKey = await string("Please input the password you'd like to use as your hosting key: ") - const hostingPort = await number("Please enter the port on which you want your installation to run: ", 10000) + const hostingKey = await string( + "Please input the password you'd like to use as your hosting key: " + ) + const hostingPort = await number( + "Please enter the port on which you want your installation to run: ", + 10000 + ) const fileContents = getContents(hostingPort, hostingKey) fs.writeFileSync(FILE_PATH, fileContents) - console.log(success("Configuration has been written successfully - please check .env file for more details.")) + console.log( + success( + "Configuration has been written successfully - please check .env file for more details." + ) + ) } module.exports.get = property => { diff --git a/packages/cli/src/questions.js b/packages/cli/src/questions.js index 33a652df74..ea0c412a60 100644 --- a/packages/cli/src/questions.js +++ b/packages/cli/src/questions.js @@ -25,9 +25,9 @@ exports.string = async (question, defaultString = null) => { exports.number = async (question, defaultNumber) => { const config = { type: "input", - name: "number", + name: "number", message: question, - validate: (value) => { + validate: value => { let valid = !isNaN(parseFloat(value)) return valid || "Please enter a number" }, diff --git a/packages/cli/src/structures/Command.js b/packages/cli/src/structures/Command.js index e911e0e328..5ca0ce67ee 100644 --- a/packages/cli/src/structures/Command.js +++ b/packages/cli/src/structures/Command.js @@ -1,8 +1,4 @@ -const { - getSubHelpDescription, - getHelpDescription, - error, -} = require("../utils") +const { getSubHelpDescription, getHelpDescription, error } = require("../utils") class Command { constructor(command, func = null) { diff --git a/packages/cli/src/utils.js b/packages/cli/src/utils.js index 9ed0fa821f..1605c277c0 100644 --- a/packages/cli/src/utils.js +++ b/packages/cli/src/utils.js @@ -10,7 +10,7 @@ exports.downloadFile = async (url, filePath) => { const response = await axios({ url, method: "GET", - responseType: "stream" + responseType: "stream", }) response.data.pipe(writer)