- Table of Contents
- Intro
- Features
- Installation
- Install dependency for turborepo:
- How do I disable modules I'm not using?
- Environment variables
- Boilerplate structure
- Debugging
- Reference
The Cabinet is a Chrome extension for professional tab management that visualizes browser tabs in hierarchical tree structures. Each window's tab relationships are organized into a "Cabinet" - a complete snapshot of your tab hierarchy that can be saved to local storage and restored at any time, preserving the exact parent-child relationships between tabs.
- Chrome extension store: https://chromewebstore.google.com/detail/the-cabinet/nbjahnhlcipfoeggjejmbgabmdoiaohj
- React
- TypeScript
- Tailwindcss
- Vite with Rollup
- Turborepo
- Prettier
- ESLint
- Chrome Extensions Manifest Version 3
- Custom i18n package
- Custom HMR (Hot Module Rebuild) plugin
- End-to-end testing with WebdriverIO
- Clone this repository.(
git clone https://github.com/nberserk/cabinet) - Ensure your node version is >= than in
.nvmrcfile, recommend to use nvm - Install pnpm globally:
npm install -g pnpm - Run
pnpm install - Check if you have that configuration in your IDE/Editor:
- VS Code:
- Installed ESLint extension
- Installed Prettier extension
- Enabled
Typescript Workbench versionin settings:- CTRL + SHIFT + P -> Search:
Typescript: Select Typescript version...->Use Workbench version - Read more
- CTRL + SHIFT + P -> Search:
- Optional, for imports to work correctly in WSL, you might need to install the Remote - WSL extension and connect to WSL remotely from VS Code. See overview section in the extension page for more information.
- WebStorm:
- VS Code:
- Run
pnpm update-version <version>for change theversionto the desired version of your extension.
Important
On Windows, make sure you have WSL enabled and Linux distribution (e.g. Ubuntu) installed on WSL.
Then, depending on the target browser:
- Run:
- Dev:
pnpm dev(on Windows, you should run as administrator; see issue#456) - Prod:
pnpm build
- Dev:
- Open in browser -
chrome://extensions - Check - Developer mode
- Click - Load unpacked in the upper left corner
- Select the
distdirectory from the boilerplate project
- Run
pnpm i <package> -w
- Run
pnpm i <package> -F <module name>
package - Name of the package you want to install e.g. nodemon
module-name - You can find it inside each package.json under the key name, e.g. @extension/content-script, you
can use only content-script without @extension/ prefix
Read: Env Documentation
The extension lives in the chrome-extension directory and includes the following files:
manifest.ts- script that outputs themanifest.jsonsrc/background- background script (background.service_workerin manifest.json)public- icons referenced in the manifest; content CSS for user's page injection
Code that is transpiled to be part of the extension lives in the pages directory.
content- Scripts injected into specified pages (You can see it in console)content-ui- React Components injected into specified pages (You can see it at the very bottom of pages)content-runtime- injected content scripts This can be injected from e.g.popuplike standardcontentdevtools- extend the browser DevTools (devtools_pagein manifest.json)devtools-panel- DevTools panel for devtoolsnew-tab- override the default New Tab page (chrome_url_overrides.newtabin manifest.json)options- options page (options_pagein manifest.json)popup- popup shown when clicking the extension in the toolbar (action.default_popupin manifest.json)side-panel- sidepanel (Chrome 114+) (side_panel.default_pathin manifest.json)
Some shared packages:
dev-utils- utilities for Chrome extension development (manifest-parser, logger)env- exports object which contain all environment variables from.envand dynamically declaredhmr- custom HMR plugin for Vite, injection script for reload/refresh, HMR dev-serveri18n- custom internationalization package; provides i18n function with type safety and other validationshared- shared code for the entire project (types, constants, custom hooks, components etc.)storage- helpers for easier integration with storage, e.g. local/session storagestailwind-config- shared Tailwind config for entire projecttsconfig- shared tsconfig for the entire projectui- function to merge your Tailwind config with the global one; you can save components herevite-config- shared Vite config for the entire project
Other useful packages:
zipper- runpnpm zipto pack thedistfolder intoextension-YYYYMMDD-HHmmss.zipinside the newly createddist-zipmodule-manager- runpnpm module-managerto enable/disable modulese2e- runpnpm e2efor end-to-end tests of your zipped extension on different browsers
If you're debugging one, you can use Brie lets you capture screenshots, errors, and network activity, making it easier for us to help.