initial 0.1.0 commit
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# Builds the test variant of Tab Park into /tmp/tabpark-test-build:
|
||||
# identical extension code, plus
|
||||
# - the "tabs" permission, for the test hook only: it reports tab URLs so
|
||||
# the driver can identify tabs. The extension code never reads tab URLs.
|
||||
# - host permission for the fixture server
|
||||
# - content/test-hook-content.js, which forwards page messages
|
||||
# - background/test-hook-background.js, which exposes the real helpers
|
||||
set -euo pipefail
|
||||
|
||||
SRC=/workspace/tabpark
|
||||
OUT=/tmp/tabpark-test-build
|
||||
rm -rf "$OUT"
|
||||
mkdir -p "$OUT/content" "$OUT/background"
|
||||
|
||||
cp "$SRC"/manifest.json "$SRC"/common.js "$SRC"/background.js \
|
||||
"$SRC"/popup.html "$SRC"/popup.js "$SRC"/popup.css \
|
||||
"$SRC"/options.html "$SRC"/options.js "$SRC"/options.css "$OUT"/
|
||||
cp -r "$SRC"/icons "$OUT"/
|
||||
cp "$SRC"/test/harness/test-hook-content.js "$OUT/content/test-hook-content.js"
|
||||
cp "$SRC"/test/harness/test-hook-background.js "$OUT/background/test-hook-background.js"
|
||||
|
||||
python3 - "$OUT/manifest.json" <<'PY'
|
||||
import json, os, sys
|
||||
p = sys.argv[1]
|
||||
m = json.load(open(p))
|
||||
if os.environ.get('TU_NO_TABS') != '1' and 'tabs' not in m['permissions']:
|
||||
m['permissions'].append('tabs')
|
||||
m['host_permissions'] = ['http://127.0.0.1/*']
|
||||
m['content_scripts'] = [{
|
||||
'matches': ['http://127.0.0.1/*'],
|
||||
'js': ['content/test-hook-content.js'],
|
||||
'run_at': 'document_start'
|
||||
}]
|
||||
m['background']['scripts'].append('background/test-hook-background.js')
|
||||
json.dump(m, open(p, 'w'), indent=2)
|
||||
PY
|
||||
|
||||
echo "built $OUT"
|
||||
Reference in New Issue
Block a user