Skip to content

Commit

Permalink
Update CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
OliEfr authored Feb 10, 2024
1 parent 31bcc42 commit 29be73d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
- commit any feature containing pull requests against the develop-branch
- commit any hot-fixes against main-branch

## Getting started with browser extensions

If you never worked with browser extensions before, you should read this very [nice tutorial](https://developer.chrome.com/docs/extensions/mv2/getstarted/). We are working with manifest v3 already. Alternatively you can use the instructions from [mozilla](https://developer.mozilla.org/de/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension). Make sure you understand the difference between content- and background-scripts, their scopes and how they can exchange information with messaging.

## Working with this repo

Everything related to the browser extension can be found in `/src`: `manifest.json`, background-script (`background.js`) and so on. Content scripts are in `/src/contentScripts`. In `/src/freshContent` you can find newly created content that is used in TUfast, e.g. the popup or settings-page.
Everything related to the browser extension can be found in `/src`: `manifest.json`, background-script (`background.js`) and so on. Content scripts are in `/src/contentScripts`. In `/src/freshContent` you can find newly created content that is used in TUfast, e.g. the popup or settings-page. `/docs` does _not_ contain documentation for the code, but further instructions for users of TUfast.

Steps to contribute:
Steps to contribute (that's standard [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)):

1. Create a local clone of this repo `git clone <url-of-your-repo>`
2. Checkout develop branch `git checkout develop`
Expand All @@ -19,7 +22,7 @@ Steps to contribute:
6. Run `npm run dev` while developing. This is will compile sass and ts files and watch for changes in your working tree.
7. Load the ./build directory as an unpacked extension in your browser
8. Run tests locally before committing code `npm run test`
9. Create a pull request
9. Create a pull request against `develop`
10. Await our review

**Note:** as a member of TUfast you can work in this repo directly, e.g. you can create branches and push to them, making the contribution process easier.
Expand All @@ -29,10 +32,6 @@ Steps to contribute:
- CSS-Preprocessor: We are using [SASS](https://sass-lang.com/).
- ESlint: We are following standard styling with minor additions. Run `npm run lint` or `npm run test` to check your code style before committing code.

## Getting started with browser extensions

If you never worked with browser extensions before, you should read this very [nice tutorial](https://developer.chrome.com/docs/extensions/mv2/getstarted/). Currently we are still using manifest v2, but we plan to switch to v3 in proximate future. Alternatively you can use the instructions from [mozilla](https://developer.mozilla.org/de/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension). Make sure you understand the difference between content- and background-scripts, their scopes and how they can exchange information with messaging.

### Known peculiarities with browser extensions
**Error:** `Unchecked runtime.lastError: The message port closed before a response was received.` Promisifying chrome.runtime.sendMessage({...}) doesnt work, because when you define a callback (Promise.resolve) sendMessage will wait until sendResponse is called in the message handler. It just stalls execution and then dies if it's never called. **Solutions:** 1) Unpromisify sendMessage. 2) Always return a value (return true is fine).

Expand Down

0 comments on commit 29be73d

Please sign in to comment.