-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: firefox manifest v3 support (#232)
Co-authored-by: Andrew Bastin <[email protected]>
- Loading branch information
1 parent
1048c56
commit d4e8e48
Showing
9 changed files
with
114 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
{ | ||
"extends": "@parcel/config-default", | ||
"transformers": { | ||
"*.ttf": ["@parcel/transformer-raw"] | ||
} | ||
} | ||
"*.ttf": [ | ||
"@parcel/transformer-raw" | ||
] | ||
}, | ||
"reporters": [ | ||
"./mergeManifest.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"background": { | ||
"service_worker": "index.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,19 @@ | ||
{ | ||
"manifest_version": 3, | ||
"name": "Hoppscotch Browser Extension", | ||
"version": "0.26", | ||
"version": "0.27", | ||
"description": "Provides more capabilities for Hoppscotch", | ||
"icons": { | ||
"16": "icons/icon-16x16.png", | ||
"48": "icons/icon-48x48.png", | ||
"128": "icons/icon-128x128.png" | ||
}, | ||
"background": { | ||
"service_worker": "index.js" | ||
}, | ||
"action": { | ||
"default_title": "Hoppscotch Extension", | ||
"default_popup": "popup.html" | ||
}, | ||
"permissions": ["storage", "tabs", "cookies", "scripting"], | ||
"host_permissions": ["<all_urls>"], | ||
"applications": { | ||
"gecko": { | ||
"id": "[email protected]" | ||
} | ||
}, | ||
"browser_specific_settings": { | ||
"gecko": { | ||
"id": "[email protected]" | ||
} | ||
}, | ||
"web_accessible_resources": [ | ||
{ | ||
"resources": ["*.js.map"], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"background": { | ||
"scripts": ["index.js"] | ||
}, | ||
"browser_specific_settings": { | ||
"gecko": { | ||
"id": "[email protected]" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const { Reporter } = require("@parcel/plugin") | ||
const fs = require("fs").promises | ||
|
||
module.exports = new Reporter({ | ||
async report({ event }) { | ||
const target = process.env.HOPP_EXTENSION_TARGET | ||
|
||
if (!target) { | ||
return | ||
} | ||
|
||
if (event.type == "buildSuccess") { | ||
const manifestCommon = ( | ||
await fs.readFile("./manifest.common.json") | ||
).toString() | ||
|
||
let targetManifestFilePath | ||
|
||
if (target == "CHROME") { | ||
targetManifestFilePath = "./manifest.chrome.json" | ||
} else if (target == "FIREFOX") { | ||
targetManifestFilePath = "./manifest.firefox.json" | ||
} else { | ||
return | ||
} | ||
|
||
const targetSpecificManifest = ( | ||
await fs.readFile(targetManifestFilePath) | ||
).toString() | ||
|
||
const manifestFinal = JSON.stringify( | ||
{ | ||
...JSON.parse(manifestCommon), | ||
...JSON.parse(targetSpecificManifest), | ||
}, | ||
null, | ||
2 | ||
) | ||
|
||
// make sure the ./dist folder exists | ||
await fs.mkdir("./dist").catch(() => {}) | ||
|
||
await fs.writeFile("./dist/manifest.json", manifestFinal, { | ||
flag: "w", | ||
}) | ||
|
||
process.stdout.write("💚 Manifest File Written Successfully") | ||
} | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters