3535 TextColumn ,
3636 TimeElapsedColumn ,
3737)
38- from rich .table import Table
3938
4039
4140class IDPPublisher :
@@ -269,6 +268,22 @@ def check_prerequisites(self):
269268 )
270269 sys .exit (1 )
271270
271+ def ensure_aws_sam_directory (self ):
272+ """Ensure .aws-sam directory exists"""
273+ aws_sam_dir = ".aws-sam"
274+
275+ if not os .path .exists (aws_sam_dir ):
276+ self .console .print (
277+ "[yellow].aws-sam directory not found. Creating it...[/yellow]"
278+ )
279+ os .makedirs (aws_sam_dir , exist_ok = True )
280+ self .console .print (
281+ "[green]✅ Successfully created .aws-sam directory[/green]"
282+ )
283+ else :
284+ if self .verbose :
285+ self .console .print ("[dim].aws-sam directory already exists[/dim]" )
286+
272287 def version_compare (self , version1 , version2 ):
273288 """Compare two version strings. Returns -1 if v1 < v2, 0 if equal, 1 if v1 > v2"""
274289
@@ -480,6 +495,17 @@ def get_stored_checksum(self, directory):
480495
481496 def needs_rebuild (self , * paths ):
482497 """Check if any of the paths have changed since last build"""
498+ # Special case for ./lib directory - use .lib_checksum in root and get_directory_checksum
499+ if len (paths ) == 1 and paths [0 ] == "./lib" :
500+ current_checksum = self .get_directory_checksum ("./lib" )
501+ checksum_file = ".lib_checksum"
502+ if os .path .exists (checksum_file ):
503+ with open (checksum_file , "r" ) as f :
504+ stored_checksum = f .read ().strip ()
505+ return current_checksum != stored_checksum
506+ return True
507+
508+ # For all other cases, use get_checksum
483509 current_checksum = self .get_checksum (* paths )
484510
485511 # For single directory, check its stored checksum
@@ -1186,30 +1212,7 @@ def print_outputs(self):
11861212 encoded_template_url = quote (template_url , safe = ":/?#[]@!$&'()*+,;=" )
11871213 launch_url = f"https://{ self .region } .console.aws.amazon.com/cloudformation/home?region={ self .region } #/stacks/create/review?templateURL={ encoded_template_url } &stackName=IDP"
11881214
1189- # First, display URLs in plain text to avoid Rich formatting issues
1190- self .console .print ("\n [bold green]Deployment Outputs[/bold green]" )
1191- self .console .print ("[cyan]Template URL (use to update existing stack):[/cyan]" )
1192- self .console .print (f"{ template_url } " )
1193- self .console .print (
1194- "\n [cyan]1-Click Launch URL (use to launch new stack):[/cyan]"
1195- )
1196- self .console .print (f"{ launch_url } " )
1197-
1198- # Also display in a table with clickable links
1199- table = Table (title = "[bold green]Quick Links[/bold green]" , show_lines = True )
1200- table .add_column ("Link" , style = "cyan" , no_wrap = False , width = 60 )
1201- table .add_column ("Description" , style = "yellow" , width = 40 )
1202-
1203- # Create clickable links using Rich's link syntax
1204- template_link = f"[link={ template_url } ]Template URL[/link]"
1205- launch_link = f"[link={ launch_url } ]1-Click Launch[/link]"
1206-
1207- table .add_row (template_link , "Go to cloudformation and update existing stack" )
1208- table .add_row (launch_link , "Use to launch new stack" )
1209-
1210- self .console .print (table )
1211-
1212- # Additional information for troubleshooting
1215+ # Display deployment information first
12131216 self .console .print ("\n [bold cyan]Deployment Information:[/bold cyan]" )
12141217 self .console .print (f" • Region: [yellow]{ self .region } [/yellow]" )
12151218 self .console .print (f" • Bucket: [yellow]{ self .bucket } [/yellow]" )
@@ -1220,6 +1223,15 @@ def print_outputs(self):
12201223 f" • Public Access: [yellow]{ 'Yes' if self .public else 'No' } [/yellow]"
12211224 )
12221225
1226+ # Then display URLs
1227+ self .console .print ("\n [bold green]Deployment Outputs[/bold green]" )
1228+ self .console .print ("[cyan]Template URL (use to update existing stack):[/cyan]" )
1229+ self .console .print (f"{ template_url } " )
1230+ self .console .print (
1231+ "\n [cyan]1-Click Launch URL (use to launch new stack):[/cyan]"
1232+ )
1233+ self .console .print (f"{ launch_url } " )
1234+
12231235 def run (self , args ):
12241236 """Main execution method"""
12251237 try :
@@ -1232,6 +1244,9 @@ def run(self, args):
12321244 # Check prerequisites
12331245 self .check_prerequisites ()
12341246
1247+ # Ensure .aws-sam directory exists
1248+ self .ensure_aws_sam_directory ()
1249+
12351250 # Set up S3 bucket
12361251 self .setup_artifacts_bucket ()
12371252
0 commit comments