Skip to content

Commit

Permalink
Merge pull request #458 from translate-tools/412-explore-the-manifest-v3
Browse files Browse the repository at this point in the history
Use manifest v3
  • Loading branch information
vitonsky authored Jun 15, 2024
2 parents 187d258 + bc57b10 commit 9be61a3
Show file tree
Hide file tree
Showing 50 changed files with 987 additions and 161 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
SHELL=/bin/bash
DOCKER_COMPOSE=docker compose
DOCKER_COMPOSE=docker compose
ADB_DEVICE_TO_DEBUG=
FAST_BUILD=off
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ debug.log
# Local files
.env
.local
.ADB_DEVICE
7 changes: 7 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ prepare:

dev: prepare
npm run build:dev
devFirefox: prepare
EXT_TARGET=firefox npx webpack-cli -wc ./webpack.config.js
devChromium: prepare
EXT_TARGET=chromium npx webpack-cli -wc ./webpack.config.js

devAndroidFirefox:
cd build/dev/firefox && npx web-ext run -t firefox-android --adb-device "${ADB_DEVICE_TO_DEBUG}" --firefox-apk org.mozilla.fenix

clean:
rm -rf ./build
Expand Down
26 changes: 25 additions & 1 deletion manifests/chromium.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
{
"update_url": "https://translate-tools.github.io/linguist/chromium_updates.xml"
"manifest_version": 3,
"update_url": "https://translate-tools.github.io/linguist/chromium_updates.xml",
"permissions": ["offscreen"],
"host_permissions": ["<all_urls>"],
"content_security_policy": {
"extension_pages": "default-src 'self' 'wasm-unsafe-eval'; connect-src *; style-src 'self' 'unsafe-inline' *"
},
"sandbox": {
"pages": ["offscreen-documents/translator/translator.html"]
},
"web_accessible_resources": [
{
"resources": ["contentscript.css"],
"matches": ["*://*/*"]
}
],
"background": {
"service_worker": "background-script.js",
"type": "module"
},
"action": {
"default_popup": "pages/popup/popup.html",
"default_title": "__MSG_ext_name__",
"default_icon": "static/logo/logo-icon-simple-dark.png"
}
}
14 changes: 12 additions & 2 deletions manifests/firefox-standalone.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
{
"manifest_version": 2,
"permissions": ["<all_urls>"],
"content_security_policy": "script-src 'self' 'unsafe-eval';",
"web_accessible_resources": ["contentscript.css"],
"background": {
"scripts": ["background-script.js"]
},
"browser_action": {
"theme_icons": [
{
"light": "static/logo/logo-icon-simple-light.png",
"dark": "static/logo/logo-icon-simple-dark.png",
"size": 32
"size": 128
}
]
],
"default_popup": "pages/popup/popup.html",
"default_title": "__MSG_ext_name__",
"default_icon": "static/logo/logo-icon-simple-dark.png"
}
}
14 changes: 12 additions & 2 deletions manifests/firefox.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
{
"manifest_version": 2,
"permissions": ["<all_urls>"],
"content_security_policy": "script-src 'self' 'unsafe-eval';",
"web_accessible_resources": ["contentscript.css"],
"background": {
"scripts": ["background-script.js"]
},
"browser_action": {
"theme_icons": [
{
"light": "static/logo/logo-icon-simple-light.png",
"dark": "static/logo/logo-icon-simple-dark.png",
"size": 32
"size": 128
}
]
],
"default_popup": "pages/popup/popup.html",
"default_title": "__MSG_ext_name__",
"default_icon": "static/logo/logo-icon-simple-dark.png"
}
}
18 changes: 3 additions & 15 deletions manifests/manifest.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
{
"manifest_version": 2,
"version": "2",
"default_locale": "en",
"name": "__MSG_ext_name__",
"description": "__MSG_ext_description__",
"icons": {
"512": "static/logo/logo-icon.png"
},
"permissions": ["<all_urls>", "storage", "tabs", "contextMenus"],
"web_accessible_resources": ["common.css", "contentscript.css"],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"background": {
"scripts": ["common.js", "background.js"]
},
"permissions": ["storage", "tabs", "contextMenus", "scripting"],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["common.js", "contentscript.js"]
"matches": ["*://*/*"],
"js": ["contentscript.js"]
}
],
"browser_action": {
"default_popup": "pages/popup/popup.html",
"default_title": "__MSG_ext_name__",
"default_icon": "static/logo/logo-icon-simple-dark.png"
},
"options_ui": {
"page": "pages/options/options.html",
"open_in_tab": true
Expand Down
117 changes: 93 additions & 24 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"test-fast": "TEST_FAST=true jest --maxWorkers=4",
"build:dev": "EXT_TARGET=firefox webpack-cli -wc ./webpack.config.js",
"build:tokens": "themekit build -c themekit.config.json",
"run:mobile-firefox": "ADB_DEVICE_TO_DEBUG=$(cat .ADB_DEVICE) && cd build/dev/firefox && web-ext run -t firefox-android --adb-device \"$ADB_DEVICE_TO_DEBUG\" --firefox-apk org.mozilla.fenix",
"release:patch": "npm version patch",
"prettify": "prettier --write \"{*,**/*}.{ts,tsx,js,jsx}\" && eslint --fix \"{*,**/*}.{ts,tsx,js,jsx}\" && stylelint --fix \"{*,**/*}.css\"",
"prepare": "husky install"
Expand All @@ -23,7 +22,7 @@
"@popperjs/core": "^2.11.5",
"@react-aria/interactions": "^3.9.1",
"@react-aria/utils": "^3.13.1",
"@translate-tools/core": "^1.0.0",
"@translate-tools/core": "^2.0.0",
"colord": "^2.9.1",
"domtranslator": "^0.0.1",
"effector": "^22.4.1",
Expand All @@ -35,6 +34,7 @@
"monaco-editor-core": "^0.39.0",
"papaparse": "^5.3.2",
"patronum": "^1.12.3",
"penpal": "^6.2.2",
"react": "^17.0.1",
"react-dom": "^17.0.2",
"react-elegant-ui": "^0.3.3",
Expand All @@ -51,7 +51,7 @@
"@svgr/webpack": "^8.1.0",
"@types/jest": "^29.2.2",
"@types/lodash": "^4.14.182",
"@types/node": "^15.12.1",
"@types/node": "^20.14.2",
"@types/papaparse": "^5.3.2",
"@types/react": "^17.0.47",
"@types/react-dom": "^17.0.17",
Expand Down Expand Up @@ -89,7 +89,7 @@
"stylelint-no-unsupported-browser-features": "^5.0.3",
"ts-jest": "^29.0.3",
"ts-loader": "^8.4.0",
"typescript": "^4.7.4",
"typescript": "^5.4.5",
"web-ext": "^8.0.0",
"webpack": "^5.73.0",
"webpack-bundle-analyzer": "^4.9.0",
Expand Down
Loading

0 comments on commit 9be61a3

Please sign in to comment.