|
| 1 | +# Web Extension Svelte Boilerplate |
| 2 | + |
| 3 | +<div align="center"> |
| 4 | + <img width="300" src="https://user-images.githubusercontent.com/6290720/99804359-3d584200-2b7e-11eb-9cff-a2d7e207415e.png" /> |
| 5 | + <br /> |
| 6 | + <br /> |
| 7 | +</div> |
| 8 | + |
| 9 | +This boilerplate using [Svelte](https://svelte.dev/) provides a skeleton to start developing cross-browser web extensions. |
| 10 | + |
| 11 | +## Development |
| 12 | + |
| 13 | +```bash |
| 14 | +npm i |
| 15 | +``` |
| 16 | + |
| 17 | +**Chrome** |
| 18 | + |
| 19 | +```bash |
| 20 | +npm run app:chrome-dev |
| 21 | +``` |
| 22 | + |
| 23 | +**Edge** |
| 24 | + |
| 25 | +```bash |
| 26 | +npm run app:edge-dev |
| 27 | +``` |
| 28 | + |
| 29 | +**Firefox** |
| 30 | + |
| 31 | +```bash |
| 32 | +npm run app:firefox-dev |
| 33 | +``` |
| 34 | + |
| 35 | +## Production |
| 36 | + |
| 37 | +```bash |
| 38 | +npm i |
| 39 | +``` |
| 40 | + |
| 41 | +```bash |
| 42 | +npm run app:chrome |
| 43 | +``` |
| 44 | + |
| 45 | +**Edge** |
| 46 | + |
| 47 | +```bash |
| 48 | +npm run app:edge |
| 49 | +``` |
| 50 | + |
| 51 | +**Firefox** |
| 52 | + |
| 53 | +```bash |
| 54 | +npm run app:firefox |
| 55 | +``` |
| 56 | + |
| 57 | +## Load package to browsers |
| 58 | + |
| 59 | +**Chrome** |
| 60 | + |
| 61 | +1. Go to the browser's URL address bar |
| 62 | +2. Enter `chrome://extensions/` |
| 63 | +3. Switch to "**Developer mode**" |
| 64 | +4. Load extension by clicking "**Load unpacked**" |
| 65 | +5. Browse to `dist/` in source code |
| 66 | +6. Done! |
| 67 | + |
| 68 | +Check here for more detail: [https://developer.chrome.com/extensions/getstarted](https://developer.chrome.com/extensions/getstarted) |
| 69 | + |
| 70 | +**Edge** |
| 71 | + |
| 72 | +1. Go to the browser's URL address bar |
| 73 | +2. Enter `edge://extensions/` |
| 74 | +3. Turn on `Developer mode` |
| 75 | +4. Load extension by clicking "**Load unpacked**" |
| 76 | +5. Browse to `dist/` in source code |
| 77 | +6. Done! |
| 78 | + |
| 79 | +**Firefox** |
| 80 | + |
| 81 | +1. Go to the browser's URL address bar |
| 82 | +2. Enter `about:debugging#/runtime/this-firefox` |
| 83 | +3. Click **Load Temporary Add-on...** |
| 84 | +4. Browse to your `manifest.json` & click **Open** |
| 85 | +5. Done! |
| 86 | + |
| 87 | +Check here for more details: [https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/) |
| 88 | + |
| 89 | +## Privacy Policy file |
| 90 | + |
| 91 | +Web stores require you to describe what the extension is or if you collect data of users. You also need to describe why you do that. |
| 92 | + |
| 93 | +Make sure you include this file when you publish an extension, the web store may ask you to upload it. |
| 94 | + |
| 95 | +**Note:** If you don't know how to write a privacy policy file, you can look at the [existing one](https://github.com/davidnguyen179/web-extension-boilerplate/blob/main/PRIVACY_POLICY.txt) attached on this repository. |
| 96 | + |
| 97 | +## Badges |
| 98 | + |
| 99 | +You can add badges to your project to indicate the version or to show how many users use your extension here: |
| 100 | + |
| 101 | +- [https://shields.io/](https://shields.io/) |
| 102 | + |
| 103 | +## CI/CD with github action |
| 104 | + |
| 105 | +You can modify the `.github/workflows` to show the CI/CD flow. |
| 106 | + |
| 107 | +- [https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs](https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs) |
| 108 | + |
| 109 | +## How to publish web extension |
| 110 | + |
| 111 | +| Browsers | Web store | |
| 112 | +| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 113 | +| Chrome | [https://developer.chrome.com/webstore/publish](https://developer.chrome.com/webstore/publish) | |
| 114 | +| Microsoft Edge | [https://docs.microsoft.com/en-us/microsoft-edge/extensions-chromium/publish/publish-extension](https://docs.microsoft.com/en-us/microsoft-edge/extensions-chromium/publish/publish-extension) | |
| 115 | +| Firefox | [https://extensionworkshop.com/documentation/publish/submitting-an-add-on](https://extensionworkshop.com/documentation/publish/submitting-an-add-on) | |
| 116 | + |
| 117 | +## References |
| 118 | + |
| 119 | +- Develop your first Chrome extension & Chromium Edge: [https://developer.chrome.com/extensions](https://developer.chrome.com/extensions) |
| 120 | +- Develop your first Firefox add-on: [https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension) |
| 121 | +- If you have any Chrome extension issues, you can post it here: [https://groups.google.com/a/chromium.org/forum/#!forum/chromium-extensions](https://groups.google.com/a/chromium.org/forum/#!forum/chromium-extensions) |
| 122 | +- [Jack and Amy Dev youtube channel](https://www.youtube.com/channel/UCVj3dGw75v8aHFYD6CL1tFg), which explains some common mistakes made when developing Chrome extensions. |
| 123 | + |
| 124 | +## Showcase |
| 125 | + |
| 126 | +This boilerplate was used to develop [Spotify Web Extension](https://spotify-extension.netlify.app/) |
0 commit comments