Skip to content

Commit

Permalink
Update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
foooomio committed Jun 20, 2024
1 parent f075ede commit 7301852
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 28 deletions.
10 changes: 5 additions & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ mkdir -p dist
find . -name .DS_Store -delete

# for Chrome
yarn manifest:chrome
zip -r "dist/${NAME}-${VERSION}-chrome.zip" src
./scripts/manifest.sh chrome
zip -r "dist/${NAME}-${VERSION}-chrome.zip" src -x src/manifest.*.json

# for Firefox
yarn manifest:firefox
./scripts/manifest.sh firefox
(
cd src
zip -r "../dist/${NAME}-${VERSION}-firefox.zip" ./*
zip -r "../dist/${NAME}-${VERSION}-firefox.zip" ./* -x manifest.*.json
)

yarn manifest:chrome
./scripts/manifest.sh chrome
24 changes: 1 addition & 23 deletions scripts/manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,4 @@ set -euo pipefail

cd "$(dirname "$0")/.."

case "$1" in
'chrome')
{
jq '.background|={"service_worker": "background.js"}' |
jq '.incognito|="split"' |
jq 'del(.browser_specific_settings)'
} < src/manifest.json > src/manifest.json.tmp
mv src/manifest.json.tmp src/manifest.json
yarn prettier --write src/manifest.json
;;
'firefox')
{
jq '.background|={"scripts": ["background.js"]}' |
jq 'del(.incognito)' |
jq '.browser_specific_settings|={"gecko":{"id":"{f1f7b448-d666-46c6-9dfa-3ee4c5c83578}"}}'
} < src/manifest.json > src/manifest.json.tmp
mv src/manifest.json.tmp src/manifest.json
yarn prettier --write src/manifest.json
;;
*)
echo 'Unknown argument'
;;
esac
cp "src/manifest.$1.json" src/manifest.json
26 changes: 26 additions & 0 deletions src/manifest.chrome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"manifest_version": 3,
"name": "__MSG_extName__",
"version": "3.0.3",
"description": "__MSG_extDescription__",
"default_locale": "en",
"permissions": ["contextMenus"],
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*", "file:///*/*"],
"js": ["content.js"],
"run_at": "document_start",
"all_frames": true
}
],
"icons": {
"16": "icons/icon16.png",
"32": "icons/icon32.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"incognito": "split"
}
30 changes: 30 additions & 0 deletions src/manifest.firefox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"manifest_version": 3,
"name": "__MSG_extName__",
"version": "3.0.3",
"description": "__MSG_extDescription__",
"default_locale": "en",
"permissions": ["contextMenus"],
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*", "file:///*/*"],
"js": ["content.js"],
"run_at": "document_start",
"all_frames": true
}
],
"icons": {
"16": "icons/icon16.png",
"32": "icons/icon32.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"browser_specific_settings": {
"gecko": {
"id": "{f1f7b448-d666-46c6-9dfa-3ee4c5c83578}"
}
}
}

0 comments on commit 7301852

Please sign in to comment.