@@ -53,6 +53,8 @@ function getInteractiveData(
53
53
}
54
54
55
55
export function setup ( interactive : boolean , outputFile ?: string , initialData ?: JssConfiguration , configName = 'sitecore' ) {
56
+ const getValidation = ( regexp : RegExp ) => initialData ?. skipValidation ? undefined : regexp ;
57
+
56
58
let config : ScJssConfig = {
57
59
sitecore : {
58
60
instancePath : '' ,
@@ -100,7 +102,7 @@ export function setup(interactive: boolean, outputFile?: string, initialData?: J
100
102
'instancePath' ,
101
103
'Path to the Sitecore folder' ,
102
104
'(e.g. c:\\inetpub\\wwwroot\\my.siteco.re)' ,
103
- / [ A - z ] / ,
105
+ getValidation ( / [ A - z ] / ) ,
104
106
'Invalid input.' ,
105
107
true
106
108
) ;
@@ -143,7 +145,7 @@ export function setup(interactive: boolean, outputFile?: string, initialData?: J
143
145
'host' ,
144
146
'Sitecore hostname' ,
145
147
'(e.g. http://myapp.local.siteco.re; see /sitecore/config; ensure added to hosts)' ,
146
- / ^ h t t p s ? : \/ \/ ( .* ) / ,
148
+ getValidation ( / ^ h t t p s ? : \/ \/ ( .* ) / ) ,
147
149
'Invalid input. Must start with http(s)'
148
150
) ;
149
151
}
@@ -155,7 +157,7 @@ export function setup(interactive: boolean, outputFile?: string, initialData?: J
155
157
'host' ,
156
158
'Sitecore import service URL' ,
157
159
'(usually same as hostname)' ,
158
- / ^ h t t p s ? : \/ \/ ( .* ) / ,
160
+ getValidation ( / ^ h t t p s ? : \/ \/ ( .* ) / ) ,
159
161
'Invalid input. Must start with http(s)'
160
162
) ;
161
163
}
@@ -167,7 +169,7 @@ export function setup(interactive: boolean, outputFile?: string, initialData?: J
167
169
'apiKey' ,
168
170
'Sitecore API Key' ,
169
171
'(ID of API key item)' ,
170
- / ^ { ? [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 1 - 5 ] [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } } ? $ / i,
172
+ getValidation ( / ^ { ? [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 1 - 5 ] [ 0 - 9 a - f ] { 3 } - [ 8 9 a b ] [ 0 - 9 a - f ] { 3 } - [ 0 - 9 a - f ] { 12 } } ? $ / i) ,
171
173
'Invalid API Key. Should be a GUID / Sitecore Item ID.'
172
174
) ;
173
175
@@ -178,7 +180,7 @@ export function setup(interactive: boolean, outputFile?: string, initialData?: J
178
180
'deploySecret' ,
179
181
'Please enter your deployment secret' ,
180
182
'(32+ random chars; or press enter to generate one)' ,
181
- / ^ ( .{ 32 , } | ) $ / ,
183
+ getValidation ( / ^ ( .{ 32 , } | ) $ / ) ,
182
184
'Invalid secret. Should be blank or at least 32 random characters.' ,
183
185
true
184
186
) ;
0 commit comments