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

@ -49,8 +49,9 @@ export const checkNodeVersion = () => {
// Helper method to validate the design name
const validateDesignName = (name) => {
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. 🤷'
}
// Gets user input to figure out what to do
@ -106,7 +107,7 @@ export const getChoices = async () => {
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,
})
).name