diff --git a/src/auth.ts b/src/auth.ts index 614472b..dc3d139 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -12,7 +12,7 @@ import signup from '@metacall/protocol/signup'; import { expiresIn } from '@metacall/protocol/token'; import args from './cli/args'; import { input, maskedInput } from './cli/inputs'; -import { error, info, warn } from './cli/messages'; +import { error, info, success, warn } from './cli/messages'; import { loginSelection } from './cli/selection'; import { Config, save } from './config'; import { ErrorCode } from './deploy'; @@ -20,7 +20,7 @@ import { forever } from './utils'; const authToken = async (config: Config): Promise => { const askToken = (): Promise => - maskedInput('Please enter your metacall token'); + maskedInput('Enter your MetaCall token:'); const shouldKeepAsking = args['token'] === undefined; let token: string = args['token'] || (await askToken()); @@ -62,11 +62,10 @@ const authToken = async (config: Config): Promise => { }; const authLogin = async (config: Config): Promise => { - const askEmail = (): Promise => - input('Please enter your email id:'); + const askEmail = (): Promise => input('Enter your email address:'); const askPassword = (): Promise => - maskedInput('Please enter your password:'); + maskedInput('Enter your password:'); let email = ''; let password = ''; @@ -107,16 +106,15 @@ const authLogin = async (config: Config): Promise => { }; const authSignup = async (config: Config): Promise => { - const askEmail = (): Promise => - input('Please enter your email id:'); + const askEmail = (): Promise => input('Enter your email address:'); - const askAlias = (): Promise => input('Please enter your Alias:'); + const askAlias = (): Promise => input('Enter your alias:'); const askPassword = (): Promise => - maskedInput('Please enter your password:'); + maskedInput('Enter your password:'); const askPasswordConfirmation = (): Promise => - maskedInput('Confirm password:'); + maskedInput('Confirm your password:'); let email = ''; let password = ''; @@ -136,7 +134,7 @@ const authSignup = async (config: Config): Promise => { await askCredentials(); if (password !== passwordConfirmation) { - warn('Passwords did not match.'); + warn('Passwords do not match.'); password = ''; passwordConfirmation = ''; } else { @@ -199,7 +197,7 @@ const authSelection = async (config: Config): Promise => { await save({ token }); - info('Login Successfull!'); + success('Login successful.'); return token; }; diff --git a/src/cli/selection.ts b/src/cli/selection.ts index 03142fd..d5e2ad2 100644 --- a/src/cli/selection.ts +++ b/src/cli/selection.ts @@ -11,7 +11,7 @@ export const loginSelection = (methods: string[]): Promise => { type: 'list', name: 'method', - message: 'Select the login method', + message: 'Select a login method:', choices: methods } ]).then((res: { method: string }) => res.method); @@ -36,7 +36,7 @@ export const languageSelection = ( { type: 'checkbox', name: 'langs', - message: 'Select languages to run on MetaCall', + message: 'Select languages to run on MetaCall:', choices: languages.map(lang => Languages[lang].displayName) } ]).then((res: { langs: string[] }) => diff --git a/src/cli/validateToken.ts b/src/cli/validateToken.ts index 122ffca..2228d6d 100644 --- a/src/cli/validateToken.ts +++ b/src/cli/validateToken.ts @@ -32,7 +32,7 @@ const validateToken = async (api: APIInterface): Promise => { (await exists(configFile)) && (await unlink(configFile)); - info('Try to login again!'); + info('Please login again.'); return error( `Token validation failed, potential causes include:\n\t1) The JWT may be mistranslated (Invalid Signature).\n\t2) JWT might have expired.` diff --git a/src/delete.ts b/src/delete.ts index 7bde802..7a535b2 100644 --- a/src/delete.ts +++ b/src/delete.ts @@ -28,7 +28,7 @@ export const deleteBySelection = async (api: APIInterface): Promise => { const deployments: Deployment[] = (await api.inspect()).filter( dep => dep.status === 'ready' ); - if (!deployments.length) error('No deployment found'); + if (!deployments.length) error('No deployments found.'); const project: string = await listSelection( [...deployments.map(el => `${el.suffix} ${el.version}`)], diff --git a/src/deploy.ts b/src/deploy.ts index 8f60350..0cb1b87 100644 --- a/src/deploy.ts +++ b/src/deploy.ts @@ -15,7 +15,14 @@ import { promises as fs } from 'fs'; import { join } from 'path'; import args from './cli/args'; import { input } from './cli/inputs'; -import { apiError, error, info, printLanguage, warn } from './cli/messages'; +import { + apiError, + error, + info, + printLanguage, + success, + warn +} from './cli/messages'; import Progress from './cli/progress'; import { languageSelection, listSelection } from './cli/selection'; import { logs } from './logs'; @@ -95,8 +102,8 @@ export const deployPackage = async ( } if (deploy) { - info( - 'Repository deployed, Use command $ metacall-deploy --inspect, to know more about deployment' + success( + 'Package deployed successfully. Use $ metacall-deploy --inspect to view deployment details.' ); } } catch (err) { @@ -163,7 +170,7 @@ export const deployPackage = async ( .map(el => printLanguage(el)) .join( ', ' - )} but you didn't select any file, do you want to continue? (Y/N):` + )} but didn't select any files. Do you want to continue? (Y/N):` ) ).toUpperCase(); @@ -210,11 +217,11 @@ export const deployPackage = async ( } case PackageError.JsonNotFound: { warn( - `No metacall.json was found in ${rootPath}, launching the wizard...` + `No metacall.json was found in ${rootPath}. Launching the wizard...` ); const askToCachePackagesFile = (): Promise => - input('Do you want to save metacall.json file? (Y/N):'); + input('Do you want to save the metacall.json file? (Y/N):'); await createJsonAndDeploy( (await askToCachePackagesFile()).toUpperCase() @@ -235,7 +242,7 @@ export const deployFromRepository = async ( try { const { branches } = await api.branchList(url); - if (!branches.length) return error('Invalid Repository URL'); + if (!branches.length) return error('Invalid repository URL.'); // TODO: API response type should be created in protocol, it is string as of now const selectedBranch = @@ -245,7 +252,7 @@ export const deployFromRepository = async ( if (branches.length === 1) info( - `Only one branch found : ${selectedBranch}, Selecting it automatically.` + `Only one branch found: ${selectedBranch}. Selecting it automatically.` ); const runners = Array.from( @@ -268,8 +275,8 @@ export const deployFromRepository = async ( await logs(runners, deploy.suffix, args['dev']); if (deploy) - info( - 'Repository deployed, Use command $ metacall-deploy --inspect, to know more about deployment' + success( + 'Repository deployed successfully. Use $ metacall-deploy --inspect to view deployment details.' ); } catch (e) { error(String(e), ErrorCode.DeployRepositoryFailed); diff --git a/src/force.ts b/src/force.ts index cc0fc65..1773f73 100644 --- a/src/force.ts +++ b/src/force.ts @@ -5,7 +5,7 @@ import { error, info } from './cli/messages'; import { del } from './delete'; export const force = async (api: APIInterface): Promise => { - info('Trying to deploy forcefully!'); + info('Attempting forceful deployment.'); const suffix = args['addrepo'] ? args['addrepo']?.split('com/')[1].split('/').join('-') @@ -33,7 +33,7 @@ export const force = async (api: APIInterface): Promise => { } } catch (e) { error( - 'Deployment Aborted because this directory is not being used by any applications.' + 'Deployment aborted. This directory is not associated with any applications.' ); } diff --git a/src/logout.ts b/src/logout.ts index 7b2edd7..527eea3 100644 --- a/src/logout.ts +++ b/src/logout.ts @@ -1,5 +1,5 @@ import { unlink } from 'fs/promises'; -import { error, info } from './cli/messages'; +import { error, success } from './cli/messages'; import { configFilePath } from './config'; import { exists } from './utils'; @@ -7,9 +7,9 @@ export const logout = async (): Promise => { const configFile = configFilePath(); !(await exists(configFile)) && - error("You haven't logged in yet! Kindly log in."); + error('You are not logged in. Please log in first.'); await unlink(configFile); - info('You have logout! See you later.'); + success('Logged out successfully.'); }; diff --git a/src/plan.ts b/src/plan.ts index ed85d78..8ef6fdd 100644 --- a/src/plan.ts +++ b/src/plan.ts @@ -52,5 +52,5 @@ export const plan = async (api: APIInterface): Promise => { } // Otherwise, prompt user to select from available plans - return await planSelection('Please select plan from the list', availPlans); + return await planSelection('Select a plan:', availPlans); }; diff --git a/src/utils.ts b/src/utils.ts index f4888b4..aa81161 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -279,7 +279,7 @@ export const getEnv = async ( { type: 'input', name: 'env', - message: 'Type env vars in the format: K1=V1, K2=V2' + message: 'Enter environment variables in the format K1=V1, K2=V2:' } ]);