aboutsummaryrefslogtreecommitdiff
path: root/script/package.sh
blob: f3da9143c5f75d7f8a9344ac3d068347176242e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

MANIFEST="manifest.json"

version=$(jq -r '.version' $MANIFEST)

icons=$(jq -r '.icons[]' $MANIFEST)
toolbar_icons="resources/disabled_32x32.png resources/enabled_32x32.png"
content_scripts=$(jq -r '.content_scripts[].js[]' $MANIFEST)
background_scripts=$(jq -r '.background.scripts[]' $MANIFEST)
web_accessible_resources=$(jq -r '.web_accessible_resources[]' $MANIFEST)
options_ui=$(jq -r '.options_ui.page' $MANIFEST)
options_scripts=""
for html in $options_ui; do
  scripts=$(grep -Po "(?<=src=['\"])[^'\"]*" "$html")
  for js in $scripts; do
    options_scripts="$options_scripts $(dirname $html)/$js"
  done
done

zip ${version}.zip $MANIFEST $icons $toolbar_icons $content_scripts $background_scripts $web_accessible_resources $options_ui $options_scripts