feat: chrome extension migrate to manifest v3

This commit is contained in:
Anoop M D 2022-10-17 18:18:27 +05:30
parent d91ee36192
commit 075e9162c2
3 changed files with 56 additions and 55 deletions

View File

@ -1,4 +1,3 @@
(function () {
let currentTab = { let currentTab = {
id: null, id: null,
url: null, url: null,
@ -30,7 +29,7 @@
} }
// Open the extension tab when the extension icon is clicked // Open the extension tab when the extension icon is clicked
chrome.browserAction.onClicked.addListener(function (tab) { chrome.action.onClicked.addListener(function (tab) {
if (!currentTab || !currentTab.id) { if (!currentTab || !currentTab.id) {
createNewTab(); createNewTab();
} else { } else {
@ -51,4 +50,3 @@
currentTab = {}; currentTab = {};
} }
}); });
})();

View File

@ -1,5 +1,5 @@
{ {
"manifest_version": 2, "manifest_version": 3,
"version": "0.1.0", "version": "0.1.0",
"name": "Bruno API Client", "name": "Bruno API Client",
"short_name": "Bruno", "short_name": "Bruno",
@ -10,17 +10,17 @@
"128": "assets/images/logo-128x128.png" "128": "assets/images/logo-128x128.png"
}, },
"background": { "background": {
"scripts": [ "service_worker": "js/background.js"
"js/background.js"
]
}, },
"browser_action": { "action": {
"default_icon": "assets/images/logo-128x128.png" "default_icon": "assets/images/logo-128x128.png"
}, },
"permissions": [ "permissions": [
"http://*/",
"https://*/",
"tabs", "tabs",
"storage" "storage"
],
"host_permissions": [
"http://*/",
"https://*/"
] ]
} }

View File

@ -17,7 +17,10 @@ cp -r packages/bruno-chrome-extension/* chrome-extension
# Filenames starting with "_" are reserved for use by the system # Filenames starting with "_" are reserved for use by the system
mv chrome-extension/_next chrome-extension/next mv chrome-extension/_next chrome-extension/next
sed -i 's@/_next/@/next/@g' chrome-extension/**.html sed -i'' -e 's@/_next/@/next/@g' chrome-extension/**.html
# Remove sourcemaps # Remove sourcemaps
find chrome-extension -name '*.map' -type f -delete find chrome-extension -name '*.map' -type f -delete
# Compress the chrome-extension directory into a zip file
zip -r bruno.zip chrome-extension