Convert Figma logo to code with AI

chibat logochrome-extension-typescript-starter

Chrome Extension TypeScript Starter

2,458
412
2,458
8

Top Related Projects

🖥🔋Web Extension starter to build "Write Once Run on Any Browser" extension

Quick Overview

The chrome-extension-typescript-starter is a boilerplate project for developing Chrome extensions using TypeScript. It provides a basic structure and configuration to help developers quickly set up and start building Chrome extensions with TypeScript support, including hot-reloading for faster development.

Pros

  • Streamlines the setup process for Chrome extension development with TypeScript
  • Includes hot-reloading for faster development and testing
  • Provides a clean, organized project structure
  • Includes basic linting and formatting configurations

Cons

  • May require some familiarity with TypeScript and Chrome extension development
  • Limited documentation within the repository
  • Might need additional configuration for more complex extension projects
  • Does not include advanced features or components out of the box

Getting Started

  1. Clone the repository:

    git clone https://github.com/chibat/chrome-extension-typescript-starter.git
    
  2. Install dependencies:

    cd chrome-extension-typescript-starter
    npm install
    
  3. Build the extension:

    npm run build
    
  4. Load the extension in Chrome:

    • Open Chrome and navigate to chrome://extensions
    • Enable "Developer mode"
    • Click "Load unpacked" and select the dist folder in the project directory
  5. Start development with hot-reloading:

    npm run watch
    

Competitor Comparisons

🖥🔋Web Extension starter to build "Write Once Run on Any Browser" extension

Pros of web-extension-starter

  • Cross-browser compatibility (Chrome, Firefox, Opera, Edge)
  • More comprehensive boilerplate with additional features like content scripts and background scripts
  • Includes a manifest.json generator for different browser versions

Cons of web-extension-starter

  • More complex setup and configuration
  • Larger project structure, which may be overwhelming for simple extensions
  • Requires more dependencies and has a steeper learning curve

Code Comparison

chrome-extension-typescript-starter:

import './popup.css';

const nameElement = document.querySelector('#name') as HTMLInputElement;
const greetElement = document.querySelector('#greet') as HTMLParagraphElement;

nameElement.addEventListener('input', () => {
  greetElement.textContent = `Hello, ${nameElement.value}!`;
});

web-extension-starter:

import { browser } from 'webextension-polyfill-ts';

browser.runtime.onInstalled.addListener((): void => {
  console.log('Extension installed');
});

browser.browserAction.onClicked.addListener((): void => {
  console.log('Browser action clicked');
});

The chrome-extension-typescript-starter example shows a simple popup interaction, while web-extension-starter demonstrates cross-browser compatibility using the webextension-polyfill-ts library for browser APIs.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Chrome Extension TypeScript Starter

build

Chrome Extension, TypeScript and Visual Studio Code

Prerequisites

Option

Includes the following

  • TypeScript
  • Webpack
  • React
  • Jest
  • Example Code
    • Chrome Storage
    • Options Version 2
    • content script
    • count up badge number
    • background

Project Structure

  • src/typescript: TypeScript source files
  • src/assets: static files
  • dist: Chrome Extension directory
  • dist/js: Generated JavaScript files

Setup

npm install

Import as Visual Studio Code project

...

Build

npm run build

Build in watch mode

terminal

npm run watch

Visual Studio Code

Run watch mode.

type Ctrl + Shift + B

Load extension to chrome

Load dist directory

Test

npx jest or npm run test