Skip to content

Commit

Permalink
Universal package (MV2 for FF and MV3 for Chrome)
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek committed Oct 30, 2023
1 parent 4290065 commit 97918d5
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ jobs:
run: pnpm plasmo build --target=chrome-mv3
- name: Build the extension (Firefox)
run: |
jq '.manifest.host_permissions = .manifest.optional_host_permissions | del(.manifest.optional_host_permissions)' package.json > temp.json && mv temp.json package.json # fix incomatibility with Chrome's MV3. See https://bugzilla.mozilla.org/show_bug.cgi?id=1766026
pnpm plasmo build --target=firefox-mv3
./scripts/firefox-mv2.sh
pnpm plasmo build --target=firefox-mv2
- name: Package the extension into zip artifacts
run: |
pnpm package --target=chrome-mv3
pnpm package --target=firefox-mv3
pnpm package --target=firefox-mv2
- name: Browser Platform Publish (staging)
uses: PlasmoHQ/bpp@v3
if: env.CHANNEL == 'staging'
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gitpod",
"displayName": "Gitpod",
"version": "2.1.1",
"version": "2.1.2",
"description": "The developer platform for on-demand cloud development environments. Create software faster and more securely.",
"author": "Gitpod <[email protected]>",
"homepage": "https://www.gitpod.io",
Expand All @@ -27,6 +27,7 @@
"webext-additional-permissions": "^2.4.0",
"webext-content-scripts": "^2.5.5",
"webext-detect-page": "^4.1.1",
"webext-domain-permission-toggle": "^4.0.1",
"webext-dynamic-content-scripts": "v9",
"webext-patterns": "^1.3.0",
"webext-polyfill-kinda": "^1.0.2",
Expand Down Expand Up @@ -69,7 +70,7 @@
],
"browser_specific_settings": {
"gecko": {
"id": "{24229a4f-eecc-47dc-abad-e47674ea8169}"
"id": "{dbcc42f9-c979-4f53-8a95-a102fbff3bbe}"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions scripts/firefox-mv2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

jq '.manifest.optional_permissions = .manifest.optional_host_permissions | del(.manifest.optional_host_permissions)' package.json > temp.json && mv temp.json package.json # fix incompatibility with Firefox's MV3 implementation. See https://bugzilla.mozilla.org/show_bug.cgi?id=1766026
11 changes: 9 additions & 2 deletions src/background.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { browser } from "webextension-polyfill-ts";
import 'webext-dynamic-content-scripts';
import addDomainPermissionToggle from "~utils/domain-accept";
import addDomainPermissionToggleMv2 from "webext-domain-permission-toggle";
import addDomainPermissionToggleMv3 from "~utils/domain-accept";

addDomainPermissionToggle();
(async () => {
if (browser.runtime.getManifest().manifest_version === 2) {
addDomainPermissionToggleMv2();
} else {
addDomainPermissionToggleMv3();
}
})();

browser.runtime.onInstalled.addListener((details) => {
if (details.reason === "install") {
Expand Down

0 comments on commit 97918d5

Please sign in to comment.