From edc66fb427be472d83e3f26f3c28496be96e714d Mon Sep 17 00:00:00 2001 From: Kestin Goforth Date: Mon, 9 Jan 2023 17:16:07 +0000 Subject: [PATCH] Use separate manifest files for mozilla and chrome --- .gitignore | 2 ++ .vscode/tasks.json | 8 +++---- manifest.json => manifest_chrome.json | 11 +++------- manifest_mozilla.json | 31 +++++++++++++++++++++++++++ scripts/package-addon | 15 +++++++++++++ web-ext-config.js | 12 ----------- 6 files changed, 55 insertions(+), 24 deletions(-) rename manifest.json => manifest_chrome.json (69%) create mode 100644 manifest_mozilla.json create mode 100755 scripts/package-addon delete mode 100644 web-ext-config.js diff --git a/.gitignore b/.gitignore index 265c110..c2c628a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ web-ext-artifacts/ +build/ +dist/ .DS_Store \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c0fae80..602f7bc 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,15 +2,15 @@ "version": "2.0.0", "tasks": [ { - "label": "build extension", + "label": "zip mozilla addon", "type": "shell", - "command": "web-ext build", + "command": "scripts/package-addon mozilla", "problemMatcher": [] }, { - "label": "sign extension", + "label": "zip chrome addon", "type": "shell", - "command": "web-ext sign", + "command": "scripts/package-addon chrome", "problemMatcher": [] } ] diff --git a/manifest.json b/manifest_chrome.json similarity index 69% rename from manifest.json rename to manifest_chrome.json index ea7daaf..b532570 100644 --- a/manifest.json +++ b/manifest_chrome.json @@ -1,21 +1,16 @@ { "manifest_version": 3, "name": "Random McMaster Page", - "version": "1.0.1", + "version": "1.0.3", "description": "Adds a 'Random Page' link to the bottom navbar on mcmaster.com", + "author": "kgoforth1503@gmail.com", "icons": { "16": "icons/icon16.png", "32": "icons/icon32.png", "48": "icons/icon48.png", "64": "icons/icon64.png", "96": "icons/icon96.png", - "128": "icons/icon128.png", - "512": "icons/icon512.png" - }, - "browser_specific_settings": { - "gecko": { - "id": "{a33c470b-d151-4fc7-ae43-db4ab4d38b3f}" - } + "128": "icons/icon128.png" }, "content_scripts": [ { diff --git a/manifest_mozilla.json b/manifest_mozilla.json new file mode 100644 index 0000000..c737723 --- /dev/null +++ b/manifest_mozilla.json @@ -0,0 +1,31 @@ +{ + "manifest_version": 2, + "name": "Random McMaster Page", + "version": "1.0.3", + "description": "Adds a 'Random Page' link to the bottom navbar on mcmaster.com", + "author": "kgoforth1503@gmail.com", + "icons": { + "16": "icons/icon16.png", + "32": "icons/icon32.png", + "48": "icons/icon48.png", + "64": "icons/icon64.png", + "96": "icons/icon96.png", + "128": "icons/icon128.png" + }, + "content_scripts": [ + { + "matches": [ + "*://*.mcmaster.com/*" + ], + "js": [ + "random_page.js" + ] + } + ], + "browser_specific_settings": { + "gecko": { + "id": "{a33c470b-d151-4fc7-ae43-db4ab4d38b3f}", + "strict_min_version": "52.0" + } + } +} \ No newline at end of file diff --git a/scripts/package-addon b/scripts/package-addon new file mode 100755 index 0000000..c67057c --- /dev/null +++ b/scripts/package-addon @@ -0,0 +1,15 @@ +# Create directories +mkdir -p dist +mkdir -p build && cd build + +# Copy files to temp directory +cp -r ../icons/ ./ +cp -r ../README.md ./ +cp -r ../LICENSE ./ +cp -r ../random_page.js ./ +cp -r ../manifest_$1.json ./manifest.json + +# Zip files and cleanup +rm -f ../dist/random_mcmaster_page-$1.zip +zip -r ../dist/random_mcmaster_page-$1.zip * +cd .. && rm -r build \ No newline at end of file diff --git a/web-ext-config.js b/web-ext-config.js deleted file mode 100644 index 47164f8..0000000 --- a/web-ext-config.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - // Global options: - verbose: true, - // Command options: - build: { - overwriteDest: true, - }, - ignoreFiles: [ - 'web-ext-config.js', - 'img/', - ], -}; \ No newline at end of file