Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Reorganize thumbnail utilities for better maintainability #88

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

mitsuki31
Copy link
Owner

Overview

This pull request refactors the thumbnail utilities in the codebase to improve module organization, maintainability, and clarity. It centralizes thumbnail-related functionality into a single namespace and module, ensuring better scalability for future feature changes.

Changes Made

Codebase Reorganization

  • Moved all thumbnail utility functions to a new module: utils/thumb-utils.
  • Grouped all thumbnail utility functions under the ThumbnailUtils namespace, with an alias ThumbUtils.

Public API Updates

  • Exported ThumbnailUtils and its alias ThumbUtils from the main module for external use.
  • Exposed key utility functions through the namespace from the main module:
    • getAllThumbnails
    • getThumbnailByResolution and its alias getThumbnail

Unit Test Reorganization

  • Relocated all thumbnail utility test cases to thumb-utils.spec.mjs.
  • Updated test suites to align with the namespace changes.

Impact

  • Improved maintainability: Centralizing related functions under one module and namespace simplifies the codebase structure, making future updates easier.
  • Clearer API: Exposing the ThumbnailUtils namespace and its key functions provides a more intuitive interface for developers.
  • Test alignment: Reorganized test cases ensure consistency and reliability after the namespace refactoring.

Summary

This refactor enhances the maintainability and scalability of the codebase by organizing all thumbnail-related utilities into a dedicated module and namespace.
Tests have been updated to align with these changes, ensuring smooth integration. This PR makes the codebase cleaner and more developer-friendly.

- Moved all thumbnail utilities to `utils/thumb-utils` module
- All thumbnail utility functions are now within a namespace called `ThumbnailUtils` (the alias is `ThumbUtils`).

This change is intended for better module organization and maintainability for feature changes.
- Exported the `ThumbnailUtils` and its alias `ThumbUtils` to the main module.
- Exposed several thumbnail utilities to the main module, this includes:
  - `getAllThumbnails`
  - `getThumbnailByResolution` and its alias `getThumbnail`
- Relocated all thumbnail utilities' tests to a new test module `thumb-utils.spec.mjs`
- Updated the test suites of thumbnail utilities to follow the namespace changes (30fbb44)
@mitsuki31 mitsuki31 added refactor Refactor and enhancement changes chore Maintenance updates to improve project maintainability minor Minor changes labels Jan 10, 2025
@mitsuki31 mitsuki31 self-assigned this Jan 10, 2025
@mitsuki31 mitsuki31 added this to the YTMP3-JS v2.0.0 milestone Jan 10, 2025
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.49%. Comparing base (30d4c11) to head (f994ea3).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
+ Coverage   80.33%   80.49%   +0.16%     
==========================================
  Files          10       11       +1     
  Lines         600      605       +5     
==========================================
+ Hits          482      487       +5     
  Misses        118      118              
Flag Coverage Δ
Ubuntu 80.49% <100.00%> (+0.16%) ⬆️
Windows 80.16% <100.00%> (+0.16%) ⬆️
all 80.49% <100.00%> (+0.16%) ⬆️
macOS 80.49% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mitsuki31 mitsuki31 merged commit 38c166a into master Jan 10, 2025
26 checks passed
@mitsuki31 mitsuki31 deleted the refactor/reorganize-thumbnail-utilities branch January 10, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Maintenance updates to improve project maintainability minor Minor changes refactor Refactor and enhancement changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant