abinfo "Fetching dependencies ..."
npm install vue@3.5.11 --verbose
npm install --verbose

abinfo "Bundling ..."
mv -v "$SRCDIR"/.env.example "$SRCDIR"/.env
npm run build

abinfo "Packaging ..."
npx electron-builder --dir
BUILDDIR=$(ls "$SRCDIR"/dist/ | grep unpacked)
abinfo "Set BUILDDIR to $BUILDDIR ."

abinfo "Installing ..."
mkdir -vp "$PKGDIR"/usr/lib/splayer/
cp -vr "$SRCDIR"/dist/"$BUILDDIR"/* "$PKGDIR"/usr/lib/splayer/
chmod -vR 755 "$PKGDIR"/usr/lib/splayer/
mkdir -vp "$PKGDIR"/usr/bin/
ln -s ../lib/splayer/SPlayer "$PKGDIR"/usr/bin/splayer

abinfo "Installing icon .."
install -Dvm644 "$SRCDIR"/public/imgs/icons/favicon.svg "$PKGDIR"/usr/share/pixmaps/splayer.svg
