JavaScript

Modularizing Themes in github-streak-stats-api

The Goal

The github-streak-stats-api project is designed to provide statistics about a user's GitHub activity. A key feature is the ability to customize the appearance through themes. This post details the effort to better organize the codebase by extracting the themes module into its own repository.

The Approach

We focused on isolating the THEMES module to improve maintainability and separation of concerns.

Migration

The existing THEMES module was moved into a new dedicated repository.

// Example of a theme object
const defaultTheme = {
  background: '#fff',
  streakColor: '#444',
  fireColor: '#ff6600',
  dates: '#999'
};

module.exports = { default: defaultTheme };

Benefits

  • Improved Code Organization: Isolating the THEMES module makes the main repository easier to navigate and understand.
  • Reusability: The theme module can now be used in other projects that require similar theming capabilities.
  • Simplified Maintenance: Changes to themes can be made without affecting the core functionality of the github-streak-stats-api.

Key Insight

Modularizing code improves maintainability and allows for easier reuse of components in other projects. By separating the themes into a dedicated module, we've made the github-streak-stats-api project more robust and easier to extend.


Generated with Gitvlg.com

Modularizing Themes in github-streak-stats-api
Flavio A. D'Avirro

Flavio A. D'Avirro

Author

Share: