Compare commits

..

6 Commits

Author SHA1 Message Date
Thomas Rupprecht 74251335e8 0.8.5 2023-01-05 19:15:09 +01:00
Thomas Rupprecht 5e4dd40d0c add addon id 2023-01-05 19:14:02 +01:00
Thomas Rupprecht ae0c2ded1b inject browser-polyfill only in chromium builds 2023-01-05 18:40:19 +01:00
Thomas Rupprecht b749f17f35 add development docs 2023-01-05 17:37:35 +01:00
Thomas Rupprecht 9740fc47a7 improve README 2023-01-05 17:14:32 +01:00
Thomas Rupprecht 86b3b7ef5e add web-ext-config.js and add watch scripts 2023-01-05 16:40:11 +01:00
7 changed files with 58 additions and 19 deletions

View File

@ -10,22 +10,42 @@
## Install
```ssh
$ git clone https://gitea.usrspace.at/XimeX/usrspace-browser-addon.git
$ npm install -g web-ext
$ npm install
$ npm i -g web-ext
$ npm i
```
- Open `about:debugging` or `about:debugging-new` in Firefox
- Click `Load Temporary Add-on...`
- Navigate to Add-on Repository
- Open `manifest.json`
- Use it
## Run / Develop / Debug
```ssh
$ npm run watch:{firefox|firefox-android|chromium}
```
If more options are needed add them after a `--`.
Some useful options:
- `--devtools`
- `--firefox-apk=...`
- `--android-device=...`
Example: `npm run watch:firefox-android -- --firefox-apk=org.mozilla.fenix --firefox-device=XXXXXXXX`.
## Build
```ssh
// For Firefox
$ npm run build:firefox
// For Chromium
$ npm run build:chromium
```
## Release
```ssh
$ npm version {major|minor|patch|...}
$ web-ext build
```
## Developent Docs
- [Getting started](https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/)
- [web-ext command reference](https://extensionworkshop.com/documentation/develop/web-ext-command-reference/)
- [WebExtensions MDN Docu](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions)
## Credits
Used icons from Bootstrap
https://github.com/twbs/icons/blob/main/LICENSE.md

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "usrspace-browser-addon",
"version": "0.8.4",
"version": "0.8.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "usrspace-browser-addon",
"version": "0.8.4",
"version": "0.8.5",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "usrspace-browser-addon",
"description": "WebExtension for the Hacker-/Maker-Space /usr/space",
"version": "0.8.4",
"version": "0.8.5",
"dependencies": {
"webextension-polyfill": "^0.10.0"
},
@ -10,16 +10,26 @@
},
"scripts": {
"copy-browser-polyfill": "cp node_modules/webextension-polyfill/dist/browser-polyfill.js src/browser-polyfill.js",
"inject-browser-polyfill": "sed -i -r 's/(<!-- \\[INJECT-BROWSER-POLYFILL] -->).*/\\1<script type=\"module\" src=\"browser-polyfill.js\"><\\/script>/' src/*.html",
"uninject-browser-polyfill": "sed -i -r 's/(<!-- \\[INJECT-BROWSER-POLYFILL] -->).+/\\1/' src/*.html",
"copy-version": "sed -i 's/^\t\"version\": \".*\",$/\t\"version\": \"'$(rg '^\t\"version\": \"(.+)\",$' -r '$1' < package.json)'\",/' src/manifest.json",
"lint": "web-ext lint -w -s src/",
"prebuild": "cp LICENSE.txt src/",
"build": "web-ext build -o -s src/ -n \"_usr_space-{version}.zip\"",
"postbuild": "rm src/LICENSE.txt",
"lint": "web-ext lint -w",
"test": "echo \"Error: no test specified\" && exit 0",
"watch:firefox": "web-ext run -t firefox-desktop",
"watch:firefox-android": "web-ext run -t firefox-android",
"watch:chromium": "web-ext run -t chromium",
"prebuild": "cp LICENSE.txt src/",
"prebuild:firefox": "npm run prebuild",
"prebuild:chromium": "npm run prebuild && npm run inject-browser-polyfill",
"build:firefox": "web-ext build -i browser-polyfill.js",
"build:chromium": "web-ext build",
"postbuild": "rm src/LICENSE.txt",
"postbuild:firefox": "npm run postbuild",
"postbuild:chromium": "npm run postbuild && npm run uninject-browser-polyfill",
"postinstall": "npm run copy-browser-polyfill",
"preversion": "npm run lint && npm test",
"version": "npm run copy-version && git add -u",
"postversion": "npm run build"
"postversion": "npm run build:firefox"
},
"repository": {
"type": "git",

View File

@ -3,7 +3,8 @@
<head>
<meta charset="utf-8" />
<title>/usr/space</title>
<script type="module" src="browser-polyfill.js"></script>
<!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="background.js"></script>
</head>
</html>

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "0.8.4",
"version": "0.8.5",
"icons": {
"48": "icons/favicon.svg",
"96": "icons/favicon.svg"
@ -34,6 +34,7 @@
},
"browser_specific_settings": {
"gecko": {
"id": "usrspace@usrspace.at",
"strict_min_version": "79.0"
}
}

View File

@ -88,7 +88,7 @@
</details>
</section>
<script type="module" src="browser-polyfill.js"></script>
<!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="popup.js"></script>
</body>
</html>

7
web-ext-config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
sourceDir: 'src/',
build: {
overwriteDest: true,
filename: '_usr_space-{version}.zip',
},
};