An open API service indexing awesome lists of open source software.

https://github.com/xdlrt/web-extension-starter

About 🖥️ Web Extension starter kit built with React, TypeScript, TailwindCSS, Storybook, Vitest, EsLint, Prettier, and Webpack. Supports Google Chrome + Mozilla Firefox + Brave Browser + Microsoft Edge + Opera 🔥
https://github.com/xdlrt/web-extension-starter

chrome-extension eslint prettier react storybook tailwindcss typescript vitest webpack

Last synced: 3 months ago
JSON representation

About 🖥️ Web Extension starter kit built with React, TypeScript, TailwindCSS, Storybook, Vitest, EsLint, Prettier, and Webpack. Supports Google Chrome + Mozilla Firefox + Brave Browser + Microsoft Edge + Opera 🔥

Awesome Lists containing this project

README

          

[![GitHub stars](https://img.shields.io/github/stars/xdlrt/web-extension-starter.svg?style=social&label=Stars&style=plastic)]()
[![GitHub watchers](https://img.shields.io/github/watchers/xdlrt/web-extension-starter.svg?style=social&label=Watch&style=plastic)]()
[![GitHub forks](https://img.shields.io/github/forks/xdlrt/web-extension-starter.svg?style=social&label=Fork&style=plastic)]()
[![GitHub contributors](https://img.shields.io/github/contributors/xdlrt/web-extension-starter.svg)](https://github.com/xdlrt/web-extension-starter/graphs/contributors)
[![MIT License](https://img.shields.io/apm/l/atomic-design-ui.svg?)](https://github.com/tterb/atomic-design-ui/blob/master/LICENSEs)
[![GitHub issues](https://img.shields.io/github/issues/xdlrt/web-extension-starter.svg)](https://github.com/xdlrt/web-extension-starter/issues)
[![GitHub last commit](https://img.shields.io/github/last-commit/xdlrt/web-extension-starter.svg)](https://github.com/xdlrt/web-extension-starter/commits/master)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/xdlrt/web-extension-starter.svg?style=flat)]()
[![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)

[![HitCount](http://hits.dwyl.com/xdlrt/web-extension-starter.svg)](http://hits.dwyl.com/xdlrt/web-extension-starter)
[![Tweet](https://img.shields.io/twitter/url/https/github.com/xdlrt/web-extension-starter.svg?style=social)](https://twitter.com/intent/tweet?text=https://github.com/xdlrt/web-extension-starter)
[![Twitter Follow](https://img.shields.io/twitter/follow/yeshu_in_future.svg?style=social)](https://twitter.com/yeshu_in_future)

![Web Extension Starter](https://i.imgur.com/wjIiRSv.png)

:desktop_computer: A Web Extension starter kit built with React, TypeScript, Storybook, EsLint, Prettier, Vitest, TailwindCSS, & Webpack. Compatible with Google Chrome, Mozilla Firefox, Brave, and Microsoft Edge.

![Example Extension Popup](https://i.imgur.com/UvOOWlv.png "Example Extension Popup")

**Getting Started**

Run the following commands to install dependencies and start developing

```
pnpm install
pnpm dev
```

**Scripts**

- `pnpm dev` - run `webpack` in `watch` mode
- `pnpm storybook` - runs the Storybook server
- `pnpm build` - builds the production-ready unpacked extension
- `pnpm test` - runs Vitest
- `pnpm lint` - runs EsLint
- `pnpm prettify` - runs Prettier

Loading the extension in Google Chrome

In [Google Chrome](https://www.google.com/chrome/), open up [chrome://extensions](chrome://extensions) in a new tab. Make sure the `Developer Mode` checkbox in the upper-right corner is turned on. Click `Load unpacked` and select the `dist` directory in this repository - your extension should now be loaded.

![Installed Extension in Google Chrome](https://i.imgur.com/Y2dQFte.png "Installed Extension in Google Chrome")

Loading the extension in Brave

In [Brave](https://brave.com/), open up [brave://extensions](brave://extensions) in a new tab. Make sure the `Developer Mode` checkbox in the upper-right corner is turned on. Click `Load unpacked` and select the `dist` directory in this repository - your extension should now be loaded.

![Installed Extension in Brave](https://i.imgur.com/rKsbtcO.png "Installed Extension in Brave")

Loading the extension in Mozilla Firefox

In [Mozilla Firefox](https://www.mozilla.org/en-US/firefox/new/), open up the [about:debugging](about:debugging) page in a new tab. Click the `This Firefox` link in the sidebar. One the `This Firefox` page, click the `Load Temporary Add-on...` button and select the `manfiest.json` from the `dist` directory in this repository - your extension should now be loaded.

![Installed Extension in Mozilla Firefox](https://i.imgur.com/FKfTw4B.png "Installed Extension in Mozilla Firefox")

Loading the extension in Microsoft Edge

In [Microsoft Edge](https://www.microsoft.com/en-us/edge), open up [edge://extensions](edge://extensions) in a new tab. Make sure the `Developer Mode` checkbox in the lower-left corner is turned on. Click `Load unpacked` and select the `dist` directory in this repository - your extension should now be loaded.

![Installed Extension in Microsoft Edge](https://i.imgur.com/ykesx0g.png "Installed Extension in Microsoft Edge")

**Notes**

- This project is a [repository template](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/) - click the `Use this template` button to use this starter codebase for your next project.

- Includes ESLint configured to work with TypeScript and Prettier.

- Includes tests with Vitest - note that the `babel.config.js` and associated dependencies are only necessary for Vitest to work with TypeScript.

- Example icons courtesy of [Heroicons](https://heroicons.com/).

- Includes Storybook configured to work with React + TypeScript. Note that it maintains its own `webpack.config.js` and `tsconfig.json` files. See example story in `src/components/hello/__tests__/hello.stories.tsx`

- Includes a custom mock for the [webextension-polyfill-ts](https://github.com/Lusito/webextension-polyfill-ts) package in `src/__mocks__`. This allows you to mock any browser APIs used by your extension so you can develop your components inside Storybook.

**Built with**

- [React](https://reactjs.org)
- [TypeScript](https://www.typescriptlang.org/)
- [Storybook](https://storybook.js.org/)
- [Vitest](https://vitest.dev/)
- [Eslint](https://eslint.org/)
- [Prettier](https://prettier.io/)
- [Webpack](https://webpack.js.org/)
- [Babel](https://babeljs.io/)
- [TailwindCSS](https://tailwindcss.com/)
- [webextension-polyfill](https://github.com/mozilla/webextension-polyfill)

**Misc. References**

- [Chrome Extension Developer Guide](https://developer.chrome.com/extensions/devguide)
- [Firefox Extension Developer Guide](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension)
- [Eslint + Prettier + Typescript Guide](https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb)