#!/bin/bash # # Purpose : Remove the deb and rpm targets from POTACAT's electron-builder # package.json, so `npm run dist:linux` builds only the AppImage PACKAGE_JSON="${1:-package.json}" if [ ! -f "$PACKAGE_JSON" ]; then echo "Error: $PACKAGE_JSON not found." exit 1 fi # Targets are either names ("deb") or objects ({"target": "deb", ...}) tmp="$(mktemp "$PACKAGE_JSON.XXXXXX")" || exit 1 if jq ' if .build.linux.target then .build.linux.target |= map(select( (if type == "object" then .target else . end) as $name | $name != "deb" and $name != "rpm")) else . end' "$PACKAGE_JSON" > "$tmp"; then mv -f "$tmp" "$PACKAGE_JSON" echo "Linux targets: $(jq -c '.build.linux.target' "$PACKAGE_JSON")" else rm -f "$tmp" echo "Error: could not patch $PACKAGE_JSON." exit 1 fi