File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,16 @@ export function validateAlphaNumeric(string) {
104
104
return "Please use alpha numeric characters only."
105
105
}
106
106
107
+ export function validateAlphaNumericNonEmpty ( string ) {
108
+ if ( / ^ [ a - z A - Z 0 - 9 _ - ] * $ / g. test ( string ) ) {
109
+ if ( string !== "" ) {
110
+ return true
111
+ }
112
+ }
113
+ return "Please use a non-empty value with alpha numeric characters only."
114
+ }
115
+
116
+
107
117
export function validateUrl ( string ) {
108
118
if ( new URL ( string ) instanceof Error ) {
109
119
return // no error message required, yeoman will forward an error to the user
Original file line number Diff line number Diff line change 1
1
import {
2
2
validateAlphaNumeric ,
3
- validateUrl
3
+ validateUrl ,
4
+ validateAlphaNumericNonEmpty
4
5
} from "../helpers.js"
5
6
6
7
export default async function prompts ( ) {
@@ -57,7 +58,7 @@ export default async function prompts() {
57
58
type : "input" ,
58
59
name : "destName" ,
59
60
message : "How do you want to name your new destination?" ,
60
- validate : validateAlphaNumeric
61
+ validate : validateAlphaNumericNonEmpty
61
62
} ) ) . destName
62
63
}
63
64
}
You can’t perform that action at this time.
0 commit comments