1
0
Fork 0

fix(new-design): Changed design name acceptable characters

This commit is contained in:
Benjamin Fan 2023-05-26 20:55:56 -07:00
parent 9542b192f7
commit c61de2da13
2 changed files with 8 additions and 6 deletions

View file

@ -85,7 +85,7 @@ async function addDesign() {
const { name } = await prompts({
type: 'text',
name: 'name',
message: 'What name would you like the design to have? ([a-z] only)',
message: 'What name would you like the design to have? ([a-z0-9_-] only)',
validate: validateDesignName,
})
@ -223,8 +223,9 @@ function validateDesignName(name) {
)
return `Sorry but ${name} is already taken so you'll need to pick something else`
if (/^([a-z]+)$/.test(name)) return true
else return ' 🙈 Please use only [a-z], no spaces, no capitals, no nothing 🤷'
if (/^([a-z0-9][a-z0-9_\-]*)$/.test(name)) return true
else
return ' 🙈 Please use only lowercase letters, digits, underscores, and hyphens. Names must start with a lowercase letter or digit. 🤷'
}
function validatePluginName(name) {