Skip to content

Commit

Permalink
Make manisfest chrome-compatible when packing.
Browse files Browse the repository at this point in the history
manifest.json currently errors when loaded in Chrome for debugging,
but it is still usable.
We fix this when packing for official release
by excluding Firefox-specific lines.
  • Loading branch information
danielhollas committed Jun 21, 2019
1 parent d15a247 commit 434c1c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 1 addition & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
"128": "khan-logo-new-128.png"
},
"browser_specific_settings": {
"gecko": {
"id": "[email protected]"
}
},
"gecko": {"id": "[email protected]"}},
"manifest_version": 2
}
18 changes: 17 additions & 1 deletion pack_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@
# or Firefox
# https://addons.mozilla.org/en-US/developers/addon/khan-academy-dots/edit

# Don't forget to bump version in manifest.json before each official publish!
if [[ -z $1 ]];then
echo "Please, provide browser name (firefox|chrome) as the parameter to this script"
exit 1
fi

if [[ $1 != "chrome" && $1 != "firefox" ]];then
echo "Unrecognized browser!"
echo "Please use \"firefox\" of \"chrome\""
exit 1
fi

browser=$1
# Don't forget to bump version in manifest.json before each official publish!
version=$(grep '"version"' manifest.json | awk -F'"' '{print $4}')
REPO_NAME=KhanAcademyDots
PACKAGE_NAME=${REPO_NAME}-${version}
Expand All @@ -33,6 +44,11 @@ if [[ $? -ne 0 ]];then
fi

rm -rf .git README.md pack_plugin.sh
if [[ $browser = 'chrome' ]];then
# We need to exclude Firefox-specific manifest entries
grep -v -e gecko -e browser_specific_settings manifest.json > tmp
mv tmp manifest.json
fi
zip -r $PACKAGE_NAME.zip *
mv $PACKAGE_NAME.zip ../
cd ..
Expand Down

0 comments on commit 434c1c5

Please sign in to comment.