Skip to content

Commit

Permalink
Add a build script so I don't screw up re-packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiew committed Aug 10, 2023
1 parent 5c7f04c commit 8651cab
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
19 changes: 19 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# this expects you're using a recent macOS
# mac sed has a different "-i" than GNU/Linux iirc
# and we're using `open` for drag & drop convenience
# pull requests welcome as always :) ty

dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
dirname=$(basename "$dir")
echo $dir

sed -i '' 's/^const devMode = true;$/const devMode = false;/' "$dir/content.js"

cd "$dir/.."
zip -q -r "$dirname.zip" "$dirname/"

outfile="$(pwd)/lgbtq-travel-warning.zip"
echo "Package built: $outfile"

open -R "$outfile"
7 changes: 4 additions & 3 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const bannedWords = [
"Tashkent", "Ташкент",
"Samarkand", "Самарканд",
"Samarqand", "Самарканд",
"Russia", "Россия",
"Russia", "Россия",
"Russian Federation", "Российская Федерация",
"Moscow", "Москва",
"Saint Petersburg", "Санкт-Петербург",
Expand Down Expand Up @@ -74,8 +74,9 @@ const bannerId = "travel-alert-modal";
const closeButtonId = "travel-alert-modal-close";
let bannerInjected = false;

// only log things in development
const devMode = true;
// only print logging in development
// do not modify this line without also adjusting `build.sh`
const devMode = false;
const log = (...args) => {
if (!devMode) return;
console.log("LGBTQTravelAlert:", ...args);
Expand Down

0 comments on commit 8651cab

Please sign in to comment.