GithubHelp home page GithubHelp logo

stateful / web-extension-starter-kit Goto Github PK

View Code? Open in Web Editor NEW
46.0 3.0 5.0 1.63 MB

A starter template to build cross browser web extensions.

License: MIT License

HTML 1.78% TypeScript 95.45% CSS 1.32% JavaScript 1.45%

web-extension-starter-kit's Introduction

My Web Extension

This is a starter kit for building cross platform browser extensions. You can use it as a template for your project. It comes with a Vite + TailwindCSS + WebdriverIO setup for building and testing extension popup modals, content and background scripts. Read more about building cross platform browser extensions in our corresponding blog post.

A browser web extension that works on Chrome, Firefox and Safari. Download the extension on the marketplaces:

Development

Setup

Install dependencies via:

npm install

then start a browser with the web extension installed:

# run Chrome
npm run start:chrome

or

# run Firefox
npm run start:firefox

This will build the extension and start a browser with it being loaded in it. After making changes, Vite automatically will re-compile the files and you can reload the extension to apply them in the browser.

Build

Bundle the extension by running:

npm run build

This script will bundle the extension as web-extension-chrome-vX.X.X.crx and web-extension-firefox-vX.X.X.zip. The generated files are in dist/. You can also grab a version from the latest test run on the main branch.

Load in Firefox

To load the extension in Firefox go to about:debugging#/runtime/this-firefox or Firefox > Preferences > Extensions & Themes > Debug Add-ons > Load Temporary Add-on.... Here locate the dist/ directory and open manifestv2.json

Load in Chrome

To load the extensions in Google Chrome go to chrome://extensions/ and click Load unpacked. Locate the dist directory and select manifest.json.

Test

This project tests the extension files using component tests and the extension integration via e2e test with WebdriverIO.

Run unit/component tests:

npm run test:component

Run e2e tests:

npm run test:e2e

Files:

  • content-script - UI files
  • background.ts - Background script/Service worker
  • index.html - popup UI

If you have any questions feel free to open an issue.

web-extension-starter-kit's People

Contributors

dependabot[bot] avatar christian-bromann avatar

Stargazers

 avatar Matt Poloni avatar 0xbc avatar  avatar Bunny avatar Stephen Kao avatar Joel Van Eenwyk avatar 饭特稀 avatar Arnav K avatar Darius avatar Manos Batsis avatar Irvan Surya Nugraha avatar Néstor avatar Felix Hungenberg avatar  avatar Eugene Zlatov avatar Francis Muturi avatar Christopher Vega avatar  avatar Aris avatar Rob Cherny avatar RandallRock avatar Jerel Miller avatar Gabriel Zaccak avatar Andrew Weir avatar Mauro Verón avatar René avatar Dan Cline avatar  avatar  avatar 流采 avatar Oleg Veselkov avatar Ian Moné avatar Michael Cole avatar Kevin Elliott avatar Sergey Keller avatar Andrei Gherasim avatar Diego vDev avatar Emile Bourquin avatar  avatar Cristian Gómez avatar Dongmin,Yu avatar  avatar David Ecke avatar  avatar Sudharsan Selvaraj avatar

Watchers

Adam Christian avatar Sebastian Tiedtke avatar  avatar

web-extension-starter-kit's Issues

`npm run start:firefox` not loading firefox

Hi there,

I love to seeing the work on cross browser web extension starter kits.

I've been trying to get npm run start:firefox to work, I've commented out all the parts that run chrome, but I must have missed something because chrome keeps showing up.

Terminal output:

Screenshot 2023-04-22 at 15 16 45

Screenshot 2023-04-22 at 15 17 37

Screenshot 2023-04-22 at 15 18 12

Changes made to start.js (switched from tsx)

Screenshot 2023-04-22 at 15 25 00

Any help would be greatly appreciated. Thanks!

Add support for Safari

Set up a way to automatically build and publish this extension to the App Store to be used within Safari.

Fix tests

Currently the pipeline is broken due to breaking changes in Chromedriver. This will be resolved with webdriverio/webdriverio#10767. I will circle back and update the dependencies once that lands.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.