|
1 | 1 | # Contributing |
2 | 2 |
|
3 | | -Welcome, and thanks for showing an interest in contributing 💜 |
| 3 | +Thank you for showing an interest in contributing 💜 |
4 | 4 |
|
5 | | -This module is an `npm` [workspace]. You will need: |
| 5 | +The goal of this browser extension is to help developers of [Podium applications](https://podium-lib.io/) test and debug their apps. |
6 | 6 |
|
7 | | -- Node latest LTS |
8 | | -- `npm` |
| 7 | +The extension targets [WebExtension](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions) Manifest V3 for [cross-browser support](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Build_a_cross_browser_extension). |
9 | 8 |
|
10 | | -See also [the browser extension's CONTRIBUTING.md](packages/client/CONTRIBUTING.md) since the workflow there is different. |
| 9 | +If you're new to extension development, a great place to start is Mozilla's [WebExtension workshop](https://extensionworkshop.com/). Some other documentation for extension authors that may be helpful: |
11 | 10 |
|
12 | | -## 🧞 Commands |
| 11 | +- [MDN - Build a cross-browser extension](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Build_a_cross_browser_extension) |
| 12 | +- [Chrome - Your first extension](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world) |
| 13 | +- [MDN - Your first extension](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension) |
| 14 | +- [Chrome - Extend DevTools](https://developer.chrome.com/docs/extensions/how-to/devtools/extend-devtools) |
13 | 15 |
|
14 | | -All commands are run from the root of the project, from a terminal: |
| 16 | +## Building |
15 | 17 |
|
16 | | -| Command | Action | |
17 | | -| -------------------------------- | ------------------------------------------------------------------------------- | |
18 | | -| `npm install --legacy-peer-deps` | Installs dependencies across the workspace | |
19 | | -| `npm test` | Runs unit tests across the workspace | |
20 | | -| `npm run lint` | Does a check with [ESLint](./.eslintrc) across the workspace | |
21 | | -| `npm run types` | Generates type definitions from JSDoc and does a typecheck across the workspace | |
| 18 | +To build the extension: |
22 | 19 |
|
23 | | -To only run the command for an individual package, either: |
| 20 | +``` |
| 21 | +npm install --legacy-peer-deps |
| 22 | +npm run build |
| 23 | +``` |
| 24 | + |
| 25 | +The packaged extension is built to `dist/`. |
| 26 | + |
| 27 | +## Testing |
| 28 | + |
| 29 | +We use [`web-ext`](https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/) to get a quick and simple development environment in Chrome and Firefox. |
| 30 | + |
| 31 | +1. Run `npm install` |
| 32 | +2. Run `npm start` |
| 33 | + |
| 34 | +Chrome will open automatically. |
| 35 | + |
| 36 | +- In the browser window, go to a test application (for instance start [server/example](../server/example/)) and open the devtools to reveal the Podium panel. |
| 37 | +- Right click inside the panel and Inspect to open the "devtools for the devtool". |
| 38 | + |
| 39 | +To test in Firefox, run `npm run start:firefox`. |
| 40 | + |
| 41 | +### Manual testing |
| 42 | + |
| 43 | +The process is similar across browsers. Also note that some changes may require a reinstall or a refresh inside the browser settings. |
| 44 | + |
| 45 | +- [Chrome: Reload the extension](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world#reload) |
| 46 | +- [Firefox: Testing](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#testing) |
| 47 | + |
| 48 | +#### Firefox |
| 49 | + |
| 50 | +- Open [about:debugging](about:debugging#/runtime/this-firefox) and click This Firefox |
| 51 | +- Click Load Temporary Add-on |
| 52 | +- Select `build/manifest.json` |
| 53 | + |
| 54 | +You'll have to [repeat the steps](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing) the next time you start Firefox, and hit the refresh button when you rebuild the extension. |
| 55 | + |
| 56 | +NB: you may have to give the Podium extension permission to run. Look for a dot on the extension and consider allowing it to always run on the domain you're working on. |
| 57 | + |
| 58 | +#### Chrome |
| 59 | + |
| 60 | +The approach should be similar in Chromium-based browsers. |
| 61 | + |
| 62 | +- Open [chrome://extensions/](chrome://extensions/) |
| 63 | + - Toggle Developer mode on in the top-right if it's not on already. |
| 64 | +- Click Load unpacked |
| 65 | +- Select the `build/` directory |
| 66 | + |
| 67 | +The extension should now be installed and ready for testing. You may have to [hit the refresh button when you rebuild](https://developer.chrome.com/docs/extensions/get-started/tutorial/hello-world#reload) the extension. |
24 | 68 |
|
25 | | -- Run the command from the package folder |
26 | | -- Append ` --workspace=<package name>` to the command |
27 | 69 |
|
28 | 70 | ## 🚚 Continuous deployment |
29 | 71 |
|
|
0 commit comments