archematics/tools/makePlugin.bash
Glen Whitney 4e2375b709 feat: Implement 3D Joyce Applets via JSXGraph
This is a stub/very preliminary implementation of calling JSXGraph for
  3D Joyce applets. The only element/construction method implemented so far
  is a free point.

  NOTE: This implementation is so far extremely buggy. Loading a page with a
  3D applet such as
  http://aleph0.clarku.edu/~djoyce/java/elements/bookXI/defXI9.html
  appears to enter a loop in which the div containing the JSXGraph Board
  progressively grows larger and larger, while using a tremendous amount
  of cpu.
2024-06-09 22:07:13 -07:00

61 lines
1.8 KiB
Bash

# Takes two parameters, the destination directory and what to include
# in the plugin:
# full - everything
# wrl - just the wrl viewer
modules="$2"
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
# Mark full versions with an extra version number field:
if [ "$modules" = full ]
then
version="${version}.2"
fi
echo "Building plugin version $version"
VERSION="$version" WHAT="$modules" bash etc/manifest.bash > $1/manifest.json
WHAT="$modules" bash etc/options.bash > $1/options.html
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
npx rollup public/js/giveAwrl.js --dir $1
cp public/js/options.js public/js/conway.js public/js/prism.js $1
cp public/js/adapptypes.js $1
cp node_modules/webextension-polyfill/dist/browser-polyfill.js $1
cp node_modules/@webcomponents/custom-elements/custom-elements.min.js $1
mkdir -p $1/assets
cp public/assets/arch*.png $1/assets
cp public/assets/vrmlExample.png $1/assets
if [ "$modules" = full ]
then
geoFiles=($(grep deps/GeoGebra $1/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
cp public/js/deps/jsxgraph{.css,core.mjs} $1/deps
npx rollup public/js/adapptlet.js --file $1/adapptlet.js
npx rollup public/js/adapptext.js --file $1/adapptext.js
cp public/assets/joyceExample.png $1/assets
fi
# Wrap it all up
cd $1
zip -r ../$1 *