ChromeTS Launchpad is a modern, TypeScript-based boilerplate for creating Chrome Extensions. It provides a solid foundation for building extensions with type safety, modern JavaScript features, and sleek styling using Tailwind CSS.
The primary purpose of ChromeTS Launchpad is to streamline the process of developing Chrome extensions using TypeScript. It aims to:
- Provide a well-structured starting point for Chrome extension development
- Leverage TypeScript for improved code quality and developer experience
- Incorporate best practices and modern tooling for extension development
- Offer easy and flexible styling with Tailwind CSS
This boilerplate extension includes basic functionality to demonstrate core Chrome extension features:
- A background script that logs when the extension is installed
- A content script that can interact with web pages
- A popup with a simple button interaction
- An options page for extension configuration
- Integration with Chrome's Storage API for saving settings
- Tailwind CSS for quick and responsive styling
Developers can easily build upon this foundation to create more complex and feature-rich extensions.
TypeScript is a modern, statically typed programming language that provides type safety and improved developer experience. It is used in this boilerplate extension to enhance code quality and maintainability.
ChromeTS Launchpad uses Manifest V3, the latest version of Chrome's extension platform. Here's why:
- Enhanced Security: Manifest V3 improves extension security through more granular permissions and limited access to powerful APIs.
- Better Performance: It promotes the use of service workers for background processes, leading to reduced memory usage and improved overall browser performance.
- Future-Proofing: As the new standard for Chrome extensions, Manifest V3 ensures long-term compatibility and support.
- Improved User Privacy: It provides users with more control over when and how extensions can access site data.
- Modern Web Technologies: Manifest V3 aligns more closely with current web development practices and standards.
By using Manifest V3, ChromeTS Launchpad ensures that extensions built with it are up-to-date, secure, and performant.
- TypeScript support
- Webpack for bundling
- Tailwind CSS for styling
- Background script
- Content script
- Popup page
- Options page
- Chrome Storage API integration
- Node.js (v14 or later)
- npm (v6 or later)
-
Clone the repository:
git clone https://github.com/yourusername/ChromeTS-Launchpad.git
-
Navigate to the project directory:
cd chromets-launchpad
-
Install dependencies:
npm install
Run the development build with hot reloading:
npm run watch
To create a production build:
npm run build
This will generate optimized files in the dist
folder.
The project is configured with ESLint to enforce consistent code quality and catch potential errors early. The following key linting rules are in place:
- Enforce strict equality (
eqeqeq
): Requires the use of===
and!==
instead of==
and!=
to avoid type coercion issues. - Use semicolons (
semi
): Enforces the use of semicolons at the end of statements. - Warn on unused variables (
@typescript-eslint/no-unused-vars
): Flags variables that are declared but not used anywhere in the code. - Prefer
const
(prefer-const
): Suggests usingconst
for variables that are never reassigned after being initialized.
To lint your code, run:
npm run lint
To automatically fix certain linting issues, run:
npm run lint:fix
Ensure that your code passes the linting checks before committing to maintain code consistency and quality across the project.
- Open Chrome and navigate to
chrome://extensions
- Enable "Developer mode"
- Click "Load unpacked" and select the
dist
folder in your project directory
- Modify the TypeScript files in the
src
folder to add your extension's functionality - Update the HTML files in the
popup
andoptions
folders - Utilize Tailwind CSS classes to style your HTML elements
- Adjust the
tailwind.config.js
file to customize your Tailwind setup - Modify the
manifest.json
file to change extension metadata, permissions, and other settings
- MV3 Boilerplate w/ React/Vue/Solid/Svelte/Preact Templates
Contributions are welcome and greatly appreciated! If you're looking to contribute, here are some good first issues to get you started:
- Add Jest for unit testing TypeScript code
- Set up Jest testing framework to enable unit testing for TypeScript code in the project.
- View Issue
To contribute:
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
For more detailed information on contributing, please see our CONTRIBUTING.md file.
This project is licensed under the MIT License - see the LICENSE file for details.