Skip to content

Commit 38c152e

Browse files
Update Manifest for compatibility with Firefox
See https://stackoverflow.com/a/78088358
1 parent 138cae2 commit 38c152e

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ jobs:
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3636
run: |
37-
zip -r inject-jyutping.zip dist
37+
cd dist
38+
zip -r inject-jyutping.zip *
3839
gh release upload ${{ github.ref_name }} inject-jyutping.zip --clobber

manifest.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "__MSG_extensionName__",
4-
"version": "0.5.0",
4+
"version": "0.5.1",
55
"description": "__MSG_extensionDescription__",
66
"icons": {
77
"48": "icons/48.png",
@@ -26,5 +26,10 @@
2626
"default_icon": "icons/96.png",
2727
"default_title": "__MSG_extensionName__",
2828
"default_popup": "src/popup/index.html"
29+
},
30+
"browser_specific_settings": {
31+
"gecko": {
32+
"id": "{6fbd51fa-0351-444c-ad29-4347c038650f}"
33+
}
2934
}
3035
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "inject-jyutping",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "A browser extension that adds Cantonese pronunciation (Jyutping) on Chinese characters",
55
"type": "module",
66
"scripts": {
@@ -9,7 +9,7 @@
99
"start": "parcel watch manifest.json --config @parcel/config-webextension --host localhost",
1010
"prebuild": "npm run lint && npm run clear",
1111
"build": "parcel build manifest.json --config @parcel/config-webextension --no-source-maps --no-cache",
12-
"postbuild": "node scripts/replace-surrogates.js",
12+
"postbuild": "node scripts/replace-surrogates.js && node scripts/patch-manifest.js",
1313
"lint": "tsc -p tsconfig.json"
1414
},
1515
"dependencies": {

scripts/patch-manifest.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { readFile, writeFile } from 'fs/promises';
2+
3+
const path = './dist/manifest.json';
4+
const manifest = JSON.parse(await readFile(path, 'utf-8'));
5+
manifest.background.scripts = [manifest.background.service_worker];
6+
manifest.background.persistent = true;
7+
await writeFile(path, JSON.stringify(manifest));

0 commit comments

Comments
 (0)