refactor(epub): decompose epubService into modular components#13
Merged
refactor(epub): decompose epubService into modular components#13
Conversation
added 4 commits
December 22, 2025 09:53
- **Sanitizers**: Extracted XML/XHTML logic to `services/epub/sanitizers/` - **Generators**: Moved HTML generation to `services/epub/generators/` - **Data**: Moved collection and stats logic to `services/epub/data/` - **Packaging**: Moved JSZip logic to `services/epub/packagers/` - **Orchestrator**: `epubService.ts` is now a thin facade (~120 LOC) - **Tests**: Verified with existing suite (16 tests passed)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary\nDecomposes the monolithic
services/epubService.tsinto focused modules, while keeping the existingservices/epub/*export pipeline intact.\n\n## Root Cause (why this shape)\nThe repo already has an EPUB export pipeline underservices/epub/*with its ownservices/epub/types.ts. The initial decomposition work accidentally overwrote that types contract, breaking the pipeline + its tests.\n\n## Changes\n-services/epubService.ts: thin orchestrator, re-exports same public API (types + helpers +generateEpub)\n-services/epubService/**: extracted sanitizers/generators/data/packagers/templates + dedicatedtypes.ts\n-services/epub/types.ts: restored (pipeline types remain the source of truth forservices/epub/*)\n-docs/WORKLOG.md: logged the refactor\n\n## Testing\n-npx tsc --noEmit\n-npm test -- --run tests/services/epubService.test.ts tests/epub/*.test.ts\n\n## Notes\nThis PR intentionally isolates the epubService decomposition underservices/epubService/to avoid collisions with the pipeline implementation.