diff --git a/src/cli/env/create.ts b/src/cli/env/create.ts index 753a401..55d9896 100644 --- a/src/cli/env/create.ts +++ b/src/cli/env/create.ts @@ -11,6 +11,7 @@ import { contentBox, formatConfirm, obfuscateArgv, + println, SaleorEnvironmentError, validateLength, waitForTask, @@ -250,9 +251,7 @@ const getDomain = async ( return chalk.red(errorMsg); } - validateLength(value, 40); - - return true; + return validateLength(value, 100); }, }); @@ -282,7 +281,7 @@ const validateDomain = async ( for (const [errorMsg] of Object.values(errors)) { switch (errorMsg) { case 'environment with this domain label already exists.': { - console.log(chalk.red(msg)); + println(chalk.red(msg)); domain = await getDomain(argv, name, msg, json.domain_label); json.domain_label = domain; break; diff --git a/src/lib/util.ts b/src/lib/util.ts index 3bd6f7e..41d01e7 100644 --- a/src/lib/util.ts +++ b/src/lib/util.ts @@ -515,10 +515,7 @@ export const validateLength = ( } if (value.length > maxLength) { - console.log( - chalk.red(`${name} please use ${maxLength} characters maximum`), - ); - return false; + return chalk.red(`${name} please use ${maxLength} characters maximum`); } return true; @@ -534,17 +531,15 @@ export const validateEmail = ( const re = /\S+@\S+\.\S+/; if (!re.test(value)) { - console.log(chalk.red('please provide valid email')); - return false; + return chalk.red('please provide valid email'); } return true; }; -export const validatePresence = (value: string): boolean => { +export const validatePresence = (value: string) => { if (value.length < 1) { - console.log(chalk.red('please provide value')); - return false; + return chalk.red('please provide value'); } return true;