From 383945ca14845343b25a08bd018503a462fc833d Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Sun, 28 Jun 2026 22:42:13 +0800 Subject: [PATCH] build: add scripts/build-zip.sh to package plugin as a Decky-installable ZIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.zip bun run zip # package already-built dist only --- .gitignore | 3 ++ plugins/decky-vault/package.json | 4 ++- plugins/decky-vault/scripts/build-zip.sh | 45 ++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 plugins/decky-vault/scripts/build-zip.sh diff --git a/.gitignore b/.gitignore index be509ad..20b00c5 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ yarn-error.log* # stray post.md plugins/decky-vault/dist/ + +# Decky plugin release zips +plugins/decky-vault/releases/ diff --git a/plugins/decky-vault/package.json b/plugins/decky-vault/package.json index f7432f2..3a3256e 100644 --- a/plugins/decky-vault/package.json +++ b/plugins/decky-vault/package.json @@ -5,7 +5,9 @@ "type": "module", "scripts": { "build": "rollup -c", - "watch": "rollup -c -w" + "watch": "rollup -c -w", + "build:zip": "rollup -c && ./scripts/build-zip.sh --no-build", + "zip": "./scripts/build-zip.sh" }, "dependencies": { "@decky/api": "^1.1.3", diff --git a/plugins/decky-vault/scripts/build-zip.sh b/plugins/decky-vault/scripts/build-zip.sh new file mode 100755 index 0000000..f4b00b7 --- /dev/null +++ b/plugins/decky-vault/scripts/build-zip.sh @@ -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'" \ No newline at end of file