Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/cli/env/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
contentBox,
formatConfirm,
obfuscateArgv,
println,
SaleorEnvironmentError,
validateLength,
waitForTask,
Expand Down Expand Up @@ -250,9 +251,7 @@ const getDomain = async (
return chalk.red(errorMsg);
}

validateLength(value, 40);

return true;
return validateLength(value, 100);
},
});

Expand Down Expand Up @@ -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;
Expand Down
13 changes: 4 additions & 9 deletions src/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down