fix(new-design): Remove hyphen as a valid design name character
This commit is contained in:
parent
55d659f8ce
commit
9c91cef752
2 changed files with 6 additions and 6 deletions
|
@ -49,9 +49,9 @@ export const checkNodeVersion = () => {
|
|||
|
||||
// Helper method to validate the design name
|
||||
const validateDesignName = (name) => {
|
||||
if (/^([a-z][a-z0-9_\-]*)$/.test(name)) return true
|
||||
if (/^([a-z][a-z0-9_]*)$/.test(name)) return true
|
||||
else
|
||||
return ' 🙈 Please use only lowercase letters, digits, underscores, or hyphens. Names must start with a lowercase letter. 🤷'
|
||||
return ' 🙈 Please use only lowercase letters, digits, or underscores. Names must start with a lowercase letter. 🤷'
|
||||
}
|
||||
|
||||
// Gets user input to figure out what to do
|
||||
|
@ -107,7 +107,7 @@ export const getChoices = async () => {
|
|||
await prompts({
|
||||
type: 'text',
|
||||
name: 'name',
|
||||
message: 'What name would you like the design to have? 🏷️ ([a-z0-9_\\-] only)',
|
||||
message: 'What name would you like the design to have? 🏷️ ([a-z0-9_] only)',
|
||||
validate: validateDesignName,
|
||||
})
|
||||
).name
|
||||
|
|
|
@ -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-z0-9_\\-] only)',
|
||||
message: 'What name would you like the design to have? ([a-z0-9_] only)',
|
||||
validate: validateDesignName,
|
||||
})
|
||||
|
||||
|
@ -223,9 +223,9 @@ function validateDesignName(name) {
|
|||
)
|
||||
return `Sorry but ${name} is already taken so you'll need to pick something else`
|
||||
|
||||
if (/^([a-z][a-z0-9_\-]*)$/.test(name)) return true
|
||||
if (/^([a-z][a-z0-9_]*)$/.test(name)) return true
|
||||
else
|
||||
return ' 🙈 Please use only lowercase letters, digits, underscores, or hyphens. Names must start with a lowercase letter. 🤷'
|
||||
return ' 🙈 Please use only lowercase letters, digits, or underscores. Names must start with a lowercase letter. 🤷'
|
||||
}
|
||||
|
||||
function validatePluginName(name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue