@@ -15,7 +15,12 @@ if (fs.existsSync(deployConfig)) {
15
15
const configFromFile : DeployConfig = JSON . parse (
16
16
fs . readFileSync ( deployConfig , 'utf8' )
17
17
)
18
- console . log ( formatText ( 'A configuration already exists.' , { bold : true , backgroundColor : 'bg-yellow' } ) )
18
+ console . log (
19
+ formatText ( 'A configuration already exists.' , {
20
+ bold : true ,
21
+ backgroundColor : 'bg-yellow'
22
+ } )
23
+ )
19
24
let existingConfigChoice : string | null = null
20
25
let readyToProceed = false
21
26
while ( ! readyToProceed ) {
@@ -289,16 +294,30 @@ if (['UPDATE', 'NEW'].includes(configStyle)) {
289
294
* Does the user want to configure a Host Name & ACM Cert for the Frontend Cloudfront
290
295
*/
291
296
let configHostname = false
292
- if ( config . ui ?. acmCertificateArn === undefined || config . ui . hostName === undefined ) {
293
- console . log ( formatText ( 'Do you want to configure a custom hostname for the frontend?' ,
294
- { textColor : 'blue' } ) )
295
- console . log ( formatText ( 'Requires a hostname & a pre-existing AWS Certificate Manager public cert ARN.' +
296
- 'For more information, visit https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html' ,
297
- { italic : true } ) )
297
+ if (
298
+ config . ui ?. acmCertificateArn === undefined ||
299
+ config . ui . hostName === undefined
300
+ ) {
301
+ console . log (
302
+ formatText (
303
+ 'Do you want to configure a custom hostname for the frontend?' ,
304
+ { textColor : 'blue' }
305
+ )
306
+ )
307
+ console . log (
308
+ formatText (
309
+ 'Requires a hostname & a pre-existing AWS Certificate Manager public cert ARN.' +
310
+ 'For more information, visit https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request-public.html' ,
311
+ { italic : true }
312
+ )
313
+ )
298
314
let loopA = true
299
315
while ( loopA ) {
300
316
const response = prompter (
301
- formatText ( 'Do you want to proceed? (y/N):' , { bold : true , textColor : 'blue' } ) ,
317
+ formatText ( 'Do you want to proceed? (y/N):' , {
318
+ bold : true ,
319
+ textColor : 'blue'
320
+ } ) ,
302
321
'N'
303
322
)
304
323
if ( response . toLowerCase ( ) === 'y' ) {
@@ -321,19 +340,28 @@ if (['UPDATE', 'NEW'].includes(configStyle)) {
321
340
if ( configHostname ) {
322
341
let loopB = true
323
342
while ( loopB ) {
324
- const existingHostname = ( ( config . ui ?. hostName ) != null ) ? config . ui . hostName : ''
343
+ const existingHostname =
344
+ config . ui ?. hostName != null ? config . ui . hostName : ''
325
345
const response = prompter (
326
- formatText ( `Enter the hostname you want to use for the frontend:(${ existingHostname } )` , { textColor : 'blue' } )
346
+ formatText (
347
+ `Enter the hostname you want to use for the frontend:(${ existingHostname } )` ,
348
+ { textColor : 'blue' }
349
+ )
327
350
)
328
- const hostnameRegex = / ^ ( ( [ a - z A - Z 0 - 9 ] | [ a - z A - Z 0 - 9 ] [ a - z A - Z 0 - 9 - ] * [ a - z A - Z 0 - 9 ] ) .) * ( [ A - Z a - z 0 - 9 ] | [ A - Z a - z 0 - 9 ] [ A - Z a - z 0 - 9 - ] * [ A - Z a - z 0 - 9 ] ) $ /
351
+ const hostnameRegex =
352
+ / ^ ( ( [ a - z A - Z 0 - 9 ] | [ a - z A - Z 0 - 9 ] [ a - z A - Z 0 - 9 - ] * [ a - z A - Z 0 - 9 ] ) .) * ( [ A - Z a - z 0 - 9 ] | [ A - Z a - z 0 - 9 ] [ A - Z a - z 0 - 9 - ] * [ A - Z a - z 0 - 9 ] ) $ /
329
353
if ( response . length > 0 && hostnameRegex . test ( response ) ) {
330
354
if ( config . ui === undefined ) {
331
355
config . ui = { }
332
356
}
333
357
config . ui . hostName = response
334
358
loopB = false
335
359
break
336
- } else if ( response . length < 1 && config . ui ?. hostName !== undefined && config . ui . hostName !== null ) {
360
+ } else if (
361
+ response . length < 1 &&
362
+ config . ui ?. hostName !== undefined &&
363
+ config . ui . hostName !== null
364
+ ) {
337
365
loopB = false
338
366
break
339
367
} else {
@@ -348,9 +376,15 @@ if (['UPDATE', 'NEW'].includes(configStyle)) {
348
376
}
349
377
let loopC = true
350
378
while ( loopC ) {
351
- const existingAcmCert = ( ( config . ui ?. acmCertificateArn ) != null ) ? config . ui . acmCertificateArn : ''
379
+ const existingAcmCert =
380
+ config . ui ?. acmCertificateArn != null
381
+ ? config . ui . acmCertificateArn
382
+ : ''
352
383
const response = prompter (
353
- formatText ( `Enter the ACM Certificate ARN you want to use for the frontend:(${ existingAcmCert } )` , { textColor : 'blue' } )
384
+ formatText (
385
+ `Enter the ACM Certificate ARN you want to use for the frontend:(${ existingAcmCert } )` ,
386
+ { textColor : 'blue' }
387
+ )
354
388
)
355
389
const acmCertRegex = / ^ a r n : a w s : a c m : \S + : \d + : \w + \/ \S + $ /
356
390
if ( response . length > 0 && acmCertRegex . test ( response ) ) {
@@ -360,8 +394,12 @@ if (['UPDATE', 'NEW'].includes(configStyle)) {
360
394
config . ui . acmCertificateArn = response
361
395
loopC = false
362
396
break
363
- } else if ( response . length < 1 && config . ui ?. acmCertificateArn !== undefined && config . ui . acmCertificateArn !== null ) {
364
- loopC = false ;
397
+ } else if (
398
+ response . length < 1 &&
399
+ config . ui ?. acmCertificateArn !== undefined &&
400
+ config . ui . acmCertificateArn !== null
401
+ ) {
402
+ loopC = false
365
403
break
366
404
} else {
367
405
console . log (
0 commit comments