# Takes one parameter, the destination directory mkdir -p $1/deps/x_ite/assets/images mkdir -p $1/deps/x_ite/assets/components versionLine=$(grep version package.json5) regex="'(.*)'" if [[ $versionLine =~ $regex ]] then version=${BASH_REMATCH[1]} fi echo "Building plugin version $version" sed "s/<>/$version/" etc/manifest.json > $1/manifest.json cp etc/options.html $1 cp etc/deps/x_ite/x_ite.css $1/deps/x_ite cp etc/deps/x_ite/assets/images/logo.128.png $1/deps/x_ite/assets/images cp etc/deps/x_ite/x_ite.mjs $1/deps/x_ite cp etc/deps/x_ite/assets/components/* $1/deps/x_ite/assets/components geoFiles=($(grep deps/GeoGebra etc/manifest.json)) for spec in "${geoFiles[@]}" do quotspec=${spec%,} trimRspec="${quotspec%\"}" trimspec="${trimRspec#\"}" dest=${trimspec%/*} mkdir -p $1/$dest cp -r etc/$trimspec $1/$dest done npx rollup public/js/giveAwrl.js --dir $1 npx rollup public/js/adapptlet.js --file $1/adapptlet.js npx rollup public/js/adapptext.js --file $1/adapptext.js cp public/js/options.js public/js/adapptypes.js public/js/conway.js $1 cp public/js/prism.js $1 cp node_modules/webextension-polyfill/dist/browser-polyfill.js $1 cp node_modules/@webcomponents/custom-elements/custom-elements.min.js $1 # Images etc mkdir -p $1/assets cp public/assets/arch*.png $1/assets cp public/assets/*Example.png $1/assets # Wrap it all up cd $1 zip -r ../$1 *