@@ -472,9 +472,9 @@ def _check_tailwindcss(self) -> bool:
472472 Returns:
473473 bool: True if Tailwind CSS is installed, False otherwise
474474 """
475- cmd = [self .npx_path , f'{ self ._tailwind_cli } --help' ]
475+ check_cmd = [self .npx_path , f'{ self ._tailwind_cli } --help' ]
476476
477- result = subprocess .run (cmd , capture_output = True , text = True , env = self .node_env )
477+ result = subprocess .run (check_cmd , capture_output = True , text = True , env = self .node_env )
478478 return result .returncode == 0
479479
480480 def init (self ) -> Self :
@@ -518,13 +518,13 @@ def init(self) -> Self:
518518 init_cmd = [self .npm_path , 'init' , '-y' ]
519519 result = subprocess .run (init_cmd , capture_output = True , text = True , env = self .node_env )
520520 if result .returncode != 0 :
521- logger .error (f'❌ Error initializing Tailwind CSS: { result .stderr } ' )
522- return self
521+ raise RuntimeError (result .stderr )
523522
524523 logger .info ('✅ Tailwind CSS initialized successfully!' )
525524
526525 except Exception as e :
527526 logger .error (f'❌ Error initializing Tailwind CSS: { e } ' )
527+ raise e
528528
529529 return self
530530
@@ -546,13 +546,13 @@ def install(self) -> Self:
546546 ]
547547 result = subprocess .run (install_cmd , capture_output = True , text = True , env = self .node_env )
548548 if result .returncode != 0 :
549- logger .error (f'❌ Error installing Tailwind CSS: { result .stderr } ' )
550- return self
549+ raise RuntimeError (result .stderr )
551550
552551 logger .info ('✅ Tailwind CSS installed successfully!' )
553552
554553 except Exception as e :
555554 logger .error (f'❌ Error installing Tailwind CSS: { e } ' )
555+ raise e
556556
557557 return self
558558
@@ -579,14 +579,14 @@ def build(self) -> Self:
579579 result = subprocess .run (build_cmd , capture_output = True , text = True , env = self .node_env )
580580
581581 if result .returncode != 0 :
582- logger .error (f'❌ Error building Tailwind CSS: { result .stderr } ' )
583- return self
582+ raise RuntimeError (result .stderr )
584583
585584 logger .info ('✅ Build completed successfully!' )
586585 logger .info (f'🎨 Tailwind CSS built successfully to { self .output_css_path } ' )
587586
588587 except Exception as e :
589588 logger .error (f'❌ Error building Tailwind CSS: { e } ' )
589+ raise e
590590
591591 return self
592592
@@ -617,6 +617,7 @@ def watch(self) -> Self:
617617
618618 except Exception as e :
619619 logger .error (f'❌ Error watching for changes: { e } ' )
620+ raise e
620621
621622 return self
622623
@@ -628,35 +629,40 @@ def clean(self) -> Self:
628629 Self: The TailwindCommand instance
629630 """
630631 logger .info ('🧹 Cleaning up generated files...' )
631- files_to_remove = [
632- self .config_js_path ,
633- 'package.json' ,
634- 'package-lock.json' ,
635- self .input_css_path ,
636- ]
637-
638- directories_to_remove = ['node_modules' ]
639-
640- # Remove files
641- for file_path in files_to_remove :
642- if os .path .exists (file_path ):
643- try :
644- os .remove (file_path )
645- if self .is_cli :
646- logger .info (f'🗑️ Removed { file_path } ' )
647- except Exception as e :
648- logger .warning (f'⚠️ Warning: Could not remove { file_path } : { e } ' )
649-
650- # Remove directories
651- for dir_path in directories_to_remove :
652- if os .path .exists (dir_path ):
653- try :
654- shutil .rmtree (dir_path )
655- if self .is_cli :
656- logger .info (f'🗑️ Removed { dir_path } ' )
657- except Exception as e :
658- logger .warning (f'⚠️ Warning: Could not remove { dir_path } : { e } ' )
659-
660- logger .info ('✅ Cleanup completed.' )
632+ try :
633+ files_to_remove = [
634+ self .config_js_path ,
635+ 'package.json' ,
636+ 'package-lock.json' ,
637+ self .input_css_path ,
638+ ]
639+
640+ directories_to_remove = ['node_modules' ]
641+
642+ # Remove files
643+ for file_path in files_to_remove :
644+ if os .path .exists (file_path ):
645+ try :
646+ os .remove (file_path )
647+ if self .is_cli :
648+ logger .info (f'🗑️ Removed { file_path } ' )
649+ except Exception as e :
650+ logger .warning (f'⚠️ Warning: Could not remove { file_path } : { e } ' )
651+
652+ # Remove directories
653+ for dir_path in directories_to_remove :
654+ if os .path .exists (dir_path ):
655+ try :
656+ shutil .rmtree (dir_path )
657+ if self .is_cli :
658+ logger .info (f'🗑️ Removed { dir_path } ' )
659+ except Exception as e :
660+ logger .warning (f'⚠️ Warning: Could not remove { dir_path } : { e } ' )
661+
662+ logger .info ('✅ Cleanup completed.' )
663+
664+ except Exception as e :
665+ logger .error (f'❌ Error cleaning up: { e } ' )
666+ raise e
661667
662668 return self
0 commit comments