How lemon0417/comicsscroller works
Project type and purpose
• ComicsScroller is a Chrome extension (an open-source tool) that:
• Injects a React/Redux-powered UI into comic websites to load entire chapters
• Auto-appends the next chapter when you scroll
• Manages subscriptions and notifies on updates
• Key tech: React, Redux, redux-observable (RxJS), Webpack, Jest
File structure
• Top-level build & config:
• webpack.config.dev.js / prod.js / bg.js – three build targets (dev server, production extension, background script)
• server.js + bin/dev – local Express‐based dev server for hot-reload of content pages
• .babelrc, postcss.config.js – transpilation & CSS
• src/
• css/ – raw styles
• js/
– component/ – presentational React components (ComicCard, ComicImage, Loading, etc.)
– container/ – Redux-connected “smart” components, each with its own reducers and epics
– epics/ – root RxJS middleware orchestration
– reducers/ – global & popup reducers
– store/ – configureStore & configurePopStore setups for reader vs. popup contexts
– background.js – long-lived background script handling subscriptions, notifications
– index.jsx, popup.jsx – entry points for the reader page & popup UI
• views/ – server‐side EJS templates for dev rendering of reader/popup/background
• package.json scripts: build & test pipelines
• Coverage/ tests/ mocks for Jest
Architecture at a glance
• Three extension contexts (bundles):
A. Content/Reader page (React app injected into comic sites)
B. Popup UI (subscription manager)
C. Background script (persistent event handlers + storage)
• Flux pattern everywhere:
• React view layer
• Redux store per context
• Epics (redux-observable) as middleware for async flows (fetching images, polling updates)
Components
a. Main components
1. Browser (Chrome host environment)
2. Extension Contexts:
• Content Script / Reader App
• Popup App
• Background Script
3. Redux Stores (one per context)
4. Remote Websites (comicbus.com, sfacg.com, dm5.com)
5. Chrome Storage / Notifications API
6. Dev Server & Webpack (development-time only)
b. Relationships & interactions
• Reader App ↔ Remote Website (HTTP fetch, parse HTML, extract image URLs via epics)
• Reader App → Redux Store → UI Components (ComicImage, ChapterList, etc.)
• Reader App → Background Script (chrome.runtime.sendMessage) to record “last chapter viewed”
• Background Script ↔ Chrome Storage (persist subscriptions, last‐read state)
• Background Script → Notification API (push “comic updated” alerts)
• Popup App ↔ Background Script (message passing) to manage subscriptions and display status
• Dev Server + Webpack → Bundles loaded into the above contexts during development
c. Architectural patterns & principles
• Separation of concerns: Presentational vs. Container components
• Middleware for side-effects: redux-observable / RxJS
• Multi‐context stores: isolate state per extension page
• Message passing as the only cross‐context communication channel
d. Key technologies & frameworks
• React 16+ for UI
• Redux for state management
• redux-observable & RxJS for asynchronous operations
• Webpack for bundling (three configs)
• Babel + Flow for static typing
• Jest for unit tests / coverage
Diagramming recommendations
• Green for Background Script
• Gray for external services (Comic Sites, Chrome Storage/API)
• Orange for Dev tools (Webpack, Dev Server)