Skip to content

Commit 52f0085

Browse files
authored
chore: add dev-test script for local plugin testing (#50)
Adds scripts/dev-test.sh and pnpm dev-test command that: - Builds the plugin - Backs up the existing Decky plugin installation - Deploys the dev build to ~/homebrew/plugins/ - Restarts Decky Loader to pick up changes - Launches nested gamescope with Steam gamepadui - Restores the original plugin on exit
1 parent b39220f commit 52f0085

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"lint:py:fix": "python3 -m ruff check --fix main.py",
1717
"format:py": "python3 -m ruff format main.py",
1818
"dev-build": "node scripts/create-dev-build.js",
19+
"dev-test": "bash scripts/dev-test.sh",
1920
"prepare": "husky"
2021
},
2122
"repository": {

scripts/dev-test.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
PLUGIN_DIR="$HOME/homebrew/plugins/LetMeReShade"
5+
BACKUP_DIR="$HOME/homebrew/plugins/.LetMeReShade.backup"
6+
7+
# Cache sudo credentials once
8+
sudo -v
9+
10+
# Ensure we restore the backup even if something goes wrong after deployment
11+
restore_backup() {
12+
if [ -d "$BACKUP_DIR" ]; then
13+
echo "Restoring original plugin (sudo may be required)..."
14+
sudo -v
15+
sudo rm -rf "$PLUGIN_DIR"
16+
sudo mv "$BACKUP_DIR" "$PLUGIN_DIR"
17+
sudo systemctl restart plugin_loader.service
18+
echo "Restored original plugin and restarted Decky Loader."
19+
fi
20+
}
21+
22+
# 1. Build the plugin
23+
pnpm run build
24+
25+
# 2. Back up existing plugin
26+
if [ -d "$PLUGIN_DIR" ]; then
27+
sudo rm -rf "$BACKUP_DIR"
28+
sudo mv "$PLUGIN_DIR" "$BACKUP_DIR"
29+
echo "Backed up existing plugin to $BACKUP_DIR"
30+
fi
31+
32+
# Restore backup on exit (covers both normal exit and interrupts)
33+
trap restore_backup EXIT
34+
35+
# 3. Deploy to plugins directory
36+
sudo mkdir -p "$PLUGIN_DIR/dist" "$PLUGIN_DIR/defaults"
37+
sudo cp -r dist/* "$PLUGIN_DIR/dist/"
38+
sudo cp -r defaults/* "$PLUGIN_DIR/defaults/"
39+
sudo cp main.py package.json plugin.json "$PLUGIN_DIR/"
40+
sudo sed -i 's/"version": "\([^"]*\)"/"version": "\1-dev"/' "$PLUGIN_DIR/package.json"
41+
echo "Dev build deployed to $PLUGIN_DIR"
42+
43+
# 4. Restart Decky so it loads the new plugin
44+
sudo systemctl restart plugin_loader.service
45+
echo "Decky Loader restarted."
46+
47+
# 5. Launch gamescope with Steam gamepadui
48+
echo "Launching gamescope..."
49+
gamescope -- steam -gamepadui
50+
51+
# 6. Restore happens automatically via the EXIT trap
52+
echo "Gamescope exited."

0 commit comments

Comments
 (0)