Skip to content

Conversation

@dermatz
Copy link
Collaborator

@dermatz dermatz commented Jan 16, 2026

Refactor TokensCommand to reduce complexity

Extracted the 126-line executeCommand() method into 6 focused private methods following Single Responsibility Principle:

  • selectTheme() - Theme selection logic
  • validateHyvaTheme() - Theme path & Hyvä validation
  • validateTailwindDirectory() - Tailwind/node_modules checks
  • generateTokens() - npx hyva-tokens execution
  • handleOutputFile() - Output handling & user feedback
  • copyToVarGenerated() - Vendor theme file operations

Main method reduced from 126 to 28 lines, improving readability and maintainability. No functional changes.

@dermatz dermatz force-pushed the fix/token-command-complexity branch from 9758782 to 18821f1 Compare January 16, 2026 23:14
@dermatz dermatz merged commit 9167e95 into main Jan 16, 2026
8 checks passed
@dermatz dermatz deleted the fix/token-command-complexity branch January 16, 2026 23:38
@github-actions github-actions bot mentioned this pull request Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants