Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 1.82 KB

File metadata and controls

40 lines (33 loc) · 1.82 KB

Code Refactoring

Test Consolidation (Maintain 100% Coverage)

  • Merge 5 test files (900+ lines) into 3 focused files
  • mdtail.test.js - Core functionality and unit tests (290 lines)
  • mdtail.integration.test.js - Full flow and integration tests (317 lines)
  • mdtail.edge.test.js - Edge cases and branch coverage scenarios (247 lines)
  • Remove redundant tests while maintaining 100% coverage
  • Consolidate mock setup and teardown logic

Extract Display Logic (~80-100 lines)

  • Create lib/display.js module with Display class (98 lines)
  • Move formatContent(), renderTabs(), showNavigation() methods
  • Consolidate console.log calls into single render() method
  • Extract ANSI escape codes to constants (HIDE_CURSOR, SHOW_CURSOR, etc.)

Separate File Management (~90-110 lines)

  • Create lib/fileManager.js module with FileManager class (80 lines)
  • Move expandFiles(), validateFiles(), startWatching(), stopWatching()
  • Implement better file validation with custom error messages

Modern JavaScript

  • Convert from CommonJS to ES6 modules (kept CommonJS for compatibility)
  • Use async/await for all file operations instead of sync methods
  • Use template literals for multi-line string formatting
  • Add proper TypeScript definitions (index.d.ts)

Improved Error Handling

  • Create custom error classes (FileNotFoundError, InvalidMarkdownError)
  • Implement graceful degradation for missing terminal features
  • Better error messages with suggestions for fixes

Enhanced CLI & Display

  • Add chalk library for colored output
  • Consider blessed or ink for richer TUI with mouse support
  • Add commander.js for robust CLI argument parsing
  • Support for themes and color customization

Next Steps

  • Publish to npm registry