build: add scripts/build-zip.sh to package plugin as a Decky-installable ZIP
The ZIP bundles plugin.json, main.py, package.json, dist/index.js (+ map) at the archive root (no enclosing folder) — the format Decky's 'Install Plugin from ZIP File' / 'Install Plugin from URL' expects. Usage: bun run build:zip # build + package → releases/plugin-v<version>.zip bun run zip # package already-built dist only
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build a Decky Loader plugin ZIP ready for "Install Plugin from ZIP File".
|
||||
#
|
||||
# The ZIP must contain the plugin files at the ROOT (no enclosing folder):
|
||||
# plugin.json, main.py, package.json, dist/index.js [, dist/index.js.map]
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/build-zip.sh # builds + packages, output in releases/
|
||||
# ./scripts/build-zip.sh --no-build # package only (skip rollup build)
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
NAME=$(node -p "require('./package.json').name")
|
||||
# Strip any @scope/ prefix for the zip filename
|
||||
ZIP_NAME=$(echo "$NAME" | sed 's#.*/##')
|
||||
|
||||
OUT_DIR="releases"
|
||||
ZIP_PATH="$OUT_DIR/${ZIP_NAME}-v${VERSION}.zip"
|
||||
|
||||
if [[ "${1:-}" != "--no-build" ]]; then
|
||||
echo "› Building plugin with rollup…"
|
||||
bun run build
|
||||
fi
|
||||
|
||||
echo "› Packaging $ZIP_PATH …"
|
||||
rm -rf "$OUT_DIR"
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
# Create the zip with files at the root. We cd into the plugin dir so paths
|
||||
# are relative (no enclosing folder in the archive).
|
||||
zip -r -X "$PWD/$ZIP_PATH" \
|
||||
plugin.json \
|
||||
main.py \
|
||||
package.json \
|
||||
dist/index.js \
|
||||
dist/index.js.map \
|
||||
>/dev/null
|
||||
|
||||
echo "✓ Built $ZIP_PATH ($(du -h "$ZIP_PATH" | cut -f1))"
|
||||
echo
|
||||
echo "Install options:"
|
||||
echo " • Decky → Plugin Browser → ⋮ → Install Plugin from ZIP File → pick $ZIP_PATH"
|
||||
echo " • Or host $ZIP_PATH anywhere and use 'Install Plugin from URL'"
|
||||
Reference in New Issue
Block a user