How yamadashy/slack-channels-grouping works
Main Components
• Browser Extensions – Represent each target browser (Chrome, Firefox, Opera, etc.) as a deployment environment.
• Manifest & Configuration – The “app/manifest.json” defines the extension’s permissions, resources, and the mapping of scripts.
• Content Scripts – Located under “app/scripts/content” (with many submodules like “channel-grouper.ts”, “channel-manipulators/*”, “channel-observer.ts”, “utils”, etc.). These scripts are injected into the Slack page and are responsible for interacting with and modifying the DOM of the Slack web interface.
• Background Script – Found as “app/scripts/background.ts”, it likely handles events, persistent background tasks, or messaging with content scripts.
• Development & Build Tools – Items like “vite.config.ts”, “tsconfig.json”, “eslint.config.mjs”, “webextension-toolbox.config.js”, and build scripts (within “tools/font-builder”) indicate how the code is bundled, linted, and built. While these may not be “runtime” components, they are vital for the development lifecycle.
• CI/CD Pipeline – The “.github” directories and workflows (build.yml, test.yml) show automated testing and deployment integrations.
Relationships and Interactions
• The Browser Environment loads the extension as defined in the manifest file. The manifest specifies which scripts to inject.
• The Background script runs in its separate environment and communicates with content scripts using the browser’s messaging API.
• Content scripts interact directly with the web page (Slack’s DOM) and use helper modules (channel grouping, DOM manipulation, logging, utility functions) to process the page.
• Localization modules (inside app/_locales) feed language-specific messages and details into the UI elements of the extension.
• Build tools and CI workflows (triggered via yarn commands) process, lint, and compile TypeScript code into browser-compatible JavaScript and bundle assets.
• Grouping logic is modularized (e.g., separate modules for “channel-grouper”, “channel-manipulators”) to allow for easy debugging and potentially extension of features.
Architectural Patterns and Design Principles
• Separation of Concerns – Interfaces between content and background scripts.
• Modularization – Logical separation of functions into distinct files (e.g. groupers, manipulators, observers, utilities).
• Localization – Clear separation of language-specific assets from the core code.
• Development Automation – Integration of build scripts, testing frameworks, and CI configurations.
• Cross-Browser Support – Build configurations and separate yarn commands for each target browser indicate attention to platform-specific differences.