From 5ceb8ebac8f6aa7698e1f80ebf9b602f68eeb003 Mon Sep 17 00:00:00 2001 From: freyamade Date: Mon, 25 Sep 2023 19:20:26 +0100 Subject: [PATCH 1/4] added separate manifest files for each browser version --- CHANGELOG.md | 5 +++-- bump.py | 14 +++++++++++++- chromify.js | 11 ----------- manifests/chrome.json | 33 +++++++++++++++++++++++++++++++++ manifests/firefox.json | 39 +++++++++++++++++++++++++++++++++++++++ package.json | 4 ++-- 6 files changed, 90 insertions(+), 16 deletions(-) delete mode 100644 chromify.js create mode 100644 manifests/chrome.json create mode 100644 manifests/firefox.json diff --git a/CHANGELOG.md b/CHANGELOG.md index c2065ec..79efdf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # 1.1.0 - Updated extension to pull colours from https://github.com/ozh/github-colors - colours are loaded every week, which roughly coincides with how often the above repo is updated -- Updated to manifest v3 to bring back the chrome version - - also removed the background script from the distributed version since it was only for 0.1.9 integrity issues +- Updated Chrome version to manifest v3 to allow it to be used + - Firefox version continues to use manifest v2 +- Removed the background script from the distributed version since it was only for 0.1.9 integrity issues - Setting up project to be also used within my personal website # 1.0.13 diff --git a/bump.py b/bump.py index abb208e..7caae12 100644 --- a/bump.py +++ b/bump.py @@ -33,13 +33,25 @@ with open('package.json', 'w') as f: json.dump(data, f, sort_keys=True, indent=2) -# Now the manifest file +# Now the manifest files with open('dist/manifest.json') as f: data = json.load(f) data['version'] = new_ver with open('dist/manifest.json', 'w') as f: json.dump(data, f, sort_keys=True, indent=2) +# Open the dist specific manifests +with open('dist/manifests/firefox.json') as f: + data = json.load(f) +data['version'] = new_ver +with open('dist/manifest.json', 'w') as f: + json.dump(data, f, sort_keys=True, indent=2) +with open('dist/manifests/chrome.json') as f: + data = json.load(f) +data['version'] = new_ver +with open('dist/manifest.json', 'w') as f: + json.dump(data, f, sort_keys=True, indent=2) + # Also append the new version to the start of the CHANGELOG with open('CHANGELOG.md') as f: lines = f.readlines() diff --git a/chromify.js b/chromify.js deleted file mode 100644 index dc0ac8a..0000000 --- a/chromify.js +++ /dev/null @@ -1,11 +0,0 @@ -const fs = require('fs') -const fileName = './dist/manifest.json' -const file = require(fileName) - -delete file.browser_specific_settings - -fs.writeFile(fileName, JSON.stringify(file), function writeJSON(err) { - if (err) return console.log(err) - console.log(JSON.stringify(file)) - console.log('writing to ' + fileName) -}) diff --git a/manifests/chrome.json b/manifests/chrome.json new file mode 100644 index 0000000..9c8e459 --- /dev/null +++ b/manifests/chrome.json @@ -0,0 +1,33 @@ +{ + "action": { + "default_icon": "images/github-user-languages.128.png", + "default_popup": "popup.html" + }, + "author": "freyamade", + "content_scripts": [ + { + "js": [ + "js/vendor.js", + "js/content_script.js" + ], + "matches": [ + "https://github.com/*" + ] + } + ], + "description": "See the language usage breakdown of a User or Org right on their GitHub profile page.", + "host_permissions": [ + "https://api.github.com/", + "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json" + ], + "icons": { + "128": "images/github-user-languages.128.png" + }, + "manifest_version": 3, + "name": "GitHub User Languages", + "permissions": [ + "storage" + ], + "short_name": "github-user-languages", + "version": "1.1.0" + } \ No newline at end of file diff --git a/manifests/firefox.json b/manifests/firefox.json new file mode 100644 index 0000000..e3be1e8 --- /dev/null +++ b/manifests/firefox.json @@ -0,0 +1,39 @@ +{ + "author": "freyamade", + "browser_action": { + "default_icon": "images/github-user-languages.128.png", + "default_popup": "popup.html" + }, + "browser_specific_settings": { + "gecko": { + "id": "extension@github-user-languages.github.com" + } + }, + "content_scripts": [ + { + "js": [ + "js/vendor.js", + "js/content_script.js" + ], + "matches": [ + "https://github.com/*" + ] + } + ], + "description": "See the language usage breakdown of a User or Org right on their GitHub profile page.", + "icons": { + "128": "images/github-user-languages.128.png" + }, + "manifest_version": 2, + "name": "GitHub User Languages", + "permissions": [ + "https://api.github.com/", + "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json", + "storage" + ], + "short_name": "github-user-languages", + "version": "1.1.0", + "web_accessible_resources": [ + "colors.json" + ] + } \ No newline at end of file diff --git a/package.json b/package.json index 34eeacd..756176b 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "url": "https://github.com/freyamade/github-user-languages.git" }, "scripts": { - "archive-c-dist": "git stash && node chromify.js && cd dist && zip -r ../c-dist.zip * && git reset --hard && git stash pop", - "archive-ff-dist": "cd dist && zip -r ../ff-dist.zip *", + "archive-c-dist": "cp manifests/chrome.json dist/manifest.json && cd dist && zip -r ../c-dist.zip *", + "archive-ff-dist": "cp manifests/firefox.json dist/manifest.json && cd dist && zip -r ../ff-dist.zip *", "archive-src": "zip -r src.zip package.json package-lock.json src/ webpack/ tsconfig.json tslint.json README.md", "build": "webpack --config webpack/webpack.prod.js", "lint": "tslint src/*.ts", From 3103e7c26cc82e635888f974e1fa0b526dab5d20 Mon Sep 17 00:00:00 2001 From: freyamade Date: Mon, 25 Sep 2023 19:22:44 +0100 Subject: [PATCH 2/4] removed old colors.json from firefox manifest --- manifests/firefox.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/manifests/firefox.json b/manifests/firefox.json index e3be1e8..5183723 100644 --- a/manifests/firefox.json +++ b/manifests/firefox.json @@ -32,8 +32,5 @@ "storage" ], "short_name": "github-user-languages", - "version": "1.1.0", - "web_accessible_resources": [ - "colors.json" - ] + "version": "1.1.0" } \ No newline at end of file From f3f24c3697c22d2632e63ffd2cbaf42452da1b7d Mon Sep 17 00:00:00 2001 From: freyamade Date: Mon, 25 Sep 2023 19:22:52 +0100 Subject: [PATCH 3/4] made ff manifest the default --- dist/manifest.json | 72 ++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/dist/manifest.json b/dist/manifest.json index 4b2092a..5183723 100644 --- a/dist/manifest.json +++ b/dist/manifest.json @@ -1,38 +1,36 @@ { - "action": { - "default_icon": "images/github-user-languages.128.png", - "default_popup": "popup.html" - }, - "author": "freyamade", - "browser_specific_settings": { - "gecko": { - "id": "extension@github-user-languages.github.com" - } - }, - "content_scripts": [ - { - "js": [ - "js/vendor.js", - "js/content_script.js" - ], - "matches": [ - "https://github.com/*" - ] - } - ], - "description": "See the language usage breakdown of a User or Org right on their GitHub profile page.", - "host_permissions": [ - "https://api.github.com/", - "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json" - ], - "icons": { - "128": "images/github-user-languages.128.png" - }, - "manifest_version": 3, - "name": "GitHub User Languages", - "permissions": [ - "storage" - ], - "short_name": "github-user-languages", - "version": "1.1.0" -} \ No newline at end of file + "author": "freyamade", + "browser_action": { + "default_icon": "images/github-user-languages.128.png", + "default_popup": "popup.html" + }, + "browser_specific_settings": { + "gecko": { + "id": "extension@github-user-languages.github.com" + } + }, + "content_scripts": [ + { + "js": [ + "js/vendor.js", + "js/content_script.js" + ], + "matches": [ + "https://github.com/*" + ] + } + ], + "description": "See the language usage breakdown of a User or Org right on their GitHub profile page.", + "icons": { + "128": "images/github-user-languages.128.png" + }, + "manifest_version": 2, + "name": "GitHub User Languages", + "permissions": [ + "https://api.github.com/", + "https://raw.githubusercontent.com/ozh/github-colors/master/colors.json", + "storage" + ], + "short_name": "github-user-languages", + "version": "1.1.0" + } \ No newline at end of file From 93b83dfd190f9f5f59201b59b9931917d3b5ac17 Mon Sep 17 00:00:00 2001 From: freyamade Date: Mon, 25 Sep 2023 19:23:40 +0100 Subject: [PATCH 4/4] chrome zip command replaces manifest after --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 756176b..6ea2481 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "url": "https://github.com/freyamade/github-user-languages.git" }, "scripts": { - "archive-c-dist": "cp manifests/chrome.json dist/manifest.json && cd dist && zip -r ../c-dist.zip *", + "archive-c-dist": "cp manifests/chrome.json dist/manifest.json && cd dist && zip -r ../c-dist.zip * && cp ../manifests/firefox.json manifest.json", "archive-ff-dist": "cp manifests/firefox.json dist/manifest.json && cd dist && zip -r ../ff-dist.zip *", "archive-src": "zip -r src.zip package.json package-lock.json src/ webpack/ tsconfig.json tslint.json README.md", "build": "webpack --config webpack/webpack.prod.js",