From 14dfd8e8c230b428b0a96a66ce3172c3c290a32a Mon Sep 17 00:00:00 2001 From: Kim T Date: Fri, 10 Oct 2025 21:41:05 -0700 Subject: [PATCH 1/3] Migrate bash scripts to package scripts. Update VSCode tasks to use package scripts. Use ssh key instead of password. --- .env.example | 9 +++ .vscode/config.sh | 12 ---- .vscode/defsettings.json | 12 ---- .vscode/setup.sh | 68 --------------------- .vscode/tasks.json | 129 +++------------------------------------ README.md | 6 +- package.json | 9 ++- pnpm-lock.yaml | 51 ++++++++++++++-- src/index.tsx | 3 +- 9 files changed, 78 insertions(+), 221 deletions(-) create mode 100644 .env.example delete mode 100755 .vscode/config.sh delete mode 100644 .vscode/defsettings.json delete mode 100755 .vscode/setup.sh diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..0897a4f --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +DECK_IP=steamdeck.local +DECK_PORT=22 +DECK_USER=deck +# The SSH key option for ssh/rsync. +# e.g., -i /home/user/.ssh/id_rsa +# Can be left empty if using an ssh-agent or default key location. +DECK_KEY= +DECK_DIR=/home/deck +PLUGIN_NAME="Example Plugin" diff --git a/.vscode/config.sh b/.vscode/config.sh deleted file mode 100755 index b45c794..0000000 --- a/.vscode/config.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; -# printf "${SCRIPT_DIR}\n" -# printf "$(dirname $0)\n" -if ! [[ -e "${SCRIPT_DIR}/settings.json" ]]; then - printf '.vscode/settings.json does not exist. Creating it with default settings. Exiting afterwards. Run your task again.\n\n' - cp "${SCRIPT_DIR}/defsettings.json" "${SCRIPT_DIR}/settings.json" - exit 1 -else - printf '.vscode/settings.json does exist. Congrats.\n' - printf 'Make sure to change settings.json to match your deck.\n' -fi \ No newline at end of file diff --git a/.vscode/defsettings.json b/.vscode/defsettings.json deleted file mode 100644 index 9734ed5..0000000 --- a/.vscode/defsettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "deckip" : "steamdeck.local", - "deckport" : "22", - "deckuser" : "deck", - "deckpass" : "ssap", - "deckkey" : "-i ${env:HOME}/.ssh/id_rsa", - "deckdir" : "/home/deck", - "pluginname": "Example Plugin", - "python.analysis.extraPaths": [ - "./py_modules" - ] -} diff --git a/.vscode/setup.sh b/.vscode/setup.sh deleted file mode 100755 index 84ae7d2..0000000 --- a/.vscode/setup.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -PNPM_INSTALLED="$(which pnpm)" -DOCKER_INSTALLED="$(which docker)" -CLI_INSTALLED="$(pwd)/cli/decky" - -# echo "$PNPM_INSTALLED" -# echo "$DOCKER_INSTALLED" -# echo "$CLI_INSTALLED" - -echo "If you are using alpine linux, do not expect any support." -if [[ "$PNPM_INSTALLED" =~ "which" ]]; then - echo "pnpm is not currently installed, you can install it via your distro's package managment system or via a script that will attempt to do a manual install based on your system. If you wish to proceed with installing via the script then answer "no" (capitals do not matter) and proceed with the rest of the script. Otherwise, just hit enter to proceed and use the script." - read run_pnpm_script - if [[ "$run_pnpm_script" =~ "n" ]]; then - echo "You have chose to install pnpm via npm or your distros package manager. Please make sure to do so before attempting to build your plugin." - else - CURL_INSTALLED="$(which curl)" - WGET_INSTALLED="$(which wget)" - if [[ "$CURL_INSTALLED" =~ "which" ]]; then - printf "curl not found, attempting with wget.\n" - if [[ "$WGET_INSTALLED" =~ "which" ]]; then - printf "wget not found, please install wget or curl.\n" - printf "Could not install pnpm as curl and wget were not found.\n" - else - wget -qO- https://get.pnpm.io/install.sh | sh - - fi - else - curl -fsSL https://get.pnpm.io/install.sh | sh - - fi - fi -fi - -if [[ "$DOCKER_INSTALLED" =~ "which" ]]; then - echo "Docker is not currently installed, in order build plugins with a backend you will need to have Docker installed. Please install Docker via the preferred method for your distribution." -fi - -if ! test -f "$CLI_INSTALLED"; then - echo "The Decky CLI tool (binary file is just called "decky") is used to build your plugin as a zip file which you can then install on your Steam Deck to perform testing. We highly recommend you install it. Hitting enter now will run the script to install Decky CLI and extract it to a folder called cli in the current plugin directory. You can also type 'no' and hit enter to skip this but keep in mind you will not have a usable plugin without building it." - read run_cli_script - if [[ "$run_cli_script" =~ "n" ]]; then - echo "You have chosen to not install the Decky CLI tool to build your plugins. Please install this tool to build and test your plugin before submitting it to the Plugin Database." - else - - SYSTEM_ARCH="$(uname -a)" - - mkdir "$(pwd)"/cli - if [[ "$SYSTEM_ARCH" =~ "x86_64" ]]; then - - if [[ "$SYSTEM_ARCH" =~ "Linux" ]]; then - curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-linux-x86_64" - fi - - if [[ "$SYSTEM_ARCH" =~ "Darwin" ]]; then - curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-macOS-x86_64" - fi - - else - echo "System Arch not found! The only supported systems are Linux x86_64 and Apple x86_64/ARM64, not $SYSTEM_ARCH" - fi - - if [[ "$SYSTEM_ARCH" =~ "arm64" ]]; then - curl -L -o "$(pwd)"/cli/decky "https://github.com/SteamDeckHomebrew/cli/releases/latest/download/decky-macOS-aarch64" - fi - - chmod +x "$(pwd)"/cli/decky - echo "Decky CLI tool is now installed and you can build plugins into easy zip files using the "Build Zip" Task in vscodium." - fi -fi diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 9b966cd..6f19e2b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,141 +1,32 @@ { "version": "2.0.0", "tasks": [ - //PRELIMINARY SETUP TASKS - //Dependency setup task - { - "label": "depsetup", - "type": "shell", - "group": "none", - "detail": "Install depedencies for basic setup", - "command": "${workspaceFolder}/.vscode/setup.sh", - // // placeholder for windows scripts, not currently planned - // "windows": { - // "command": "call -c ${workspaceFolder}\\.vscode\\setup.bat", - // }, - "problemMatcher": [] - }, - //pnpm setup task to grab all needed modules - { - "label": "pnpmsetup", - "type": "shell", - "group": "none", - "detail": "Setup pnpm", - "command": "which pnpm && pnpm i", - "problemMatcher": [] - }, - //Preliminary "All-in-one" setup task { "label": "setup", - "detail": "Set up depedencies, pnpm and update Decky Frontend Library.", - "dependsOrder": "sequence", - "dependsOn": [ - "depsetup", - "pnpmsetup", - "updatefrontendlib" - ], - "problemMatcher": [] - }, - //Preliminary Deploy Config Setup - { - "label": "settingscheck", + "detail": "Setup dependencies", "type": "shell", - "group": "none", - "detail": "Check that settings.json has been created", - "command": "${workspaceFolder}/.vscode/config.sh", - // // placeholder for windows scripts, not currently planned - // "windows": { - // "command": "call ${workspaceFolder}\\.vscode\\config.bat", - // }, + "command": "pnpm run setup", "problemMatcher": [] }, - //BUILD TASKS { - "label": "cli-build", - "group": "build", - "detail": "Build plugin with CLI", - "command": "${workspaceFolder}/.vscode/build.sh", - // // placeholder for windows logic, not currently planned - // "windows": { - // "command": "call ${workspaceFolder}\\.vscode\\build.bat", - // }, - "problemMatcher": [] - }, - //"All-in-one" build task - { - "label": "build", - "group": "build", - "detail": "Build decky-plugin-template", - "dependsOrder": "sequence", - "dependsOn": [ - "setup", - "settingscheck", - "cli-build", - ], - "problemMatcher": [] - }, - //DEPLOY TASKS - //Copies the zip file of the built plugin to the plugins folder - { - "label": "copyzip", - "detail": "Deploy plugin zip to deck", + "label": "build:plugin", + "detail": "Build plugin", "type": "shell", - "group": "none", - "dependsOn": [ - "chmodplugins" - ], - "command": "rsync -azp --chmod=D0755,F0755 --rsh='ssh -p ${config:deckport} ${config:deckkey}' out/ ${config:deckuser}@${config:deckip}:${config:deckdir}/homebrew/plugins", + "command": "pnpm run build:plugin", "problemMatcher": [] }, - // - { - "label": "extractzip", - "detail": "", - "type": "shell", - "group": "none", - "command": "echo '${config:deckdir}/homebrew/plugins/${config:pluginname}.zip' && ssh ${config:deckuser}@${config:deckip} -p ${config:deckport} ${config:deckkey} 'echo ${config:deckpass} | sudo -S mkdir -m 755 -p \"$(echo \"${config:deckdir}/homebrew/plugins/${config:pluginname}\" | sed \"s| |-|g\")\" && echo ${config:deckpass} | sudo -S chown ${config:deckuser}:${config:deckuser} \"$(echo \"${config:deckdir}/homebrew/plugins/${config:pluginname}\" | sed \"s| |-|g\")\" && echo ${config:deckpass} | sudo -S bsdtar -xzpf \"${config:deckdir}/homebrew/plugins/${config:pluginname}.zip\" -C \"$(echo \"${config:deckdir}/homebrew/plugins/${config:pluginname}\" | sed \"s| |-|g\")\" --strip-components=1 --fflags '", - "problemMatcher": [] - }, - //"All-in-one" deploy task { "label": "deploy", - "dependsOrder": "sequence", - "group": "none", - "dependsOn": [ - "copyzip", - "extractzip" - ], + "detail": "Deploy plugin to deck", + "type": "shell", + "command": "pnpm run deploy", "problemMatcher": [] }, - //"All-in-on" build & deploy task { "label": "builddeploy", - "detail": "Builds plugin and deploys to deck", - "dependsOrder": "sequence", - "group": "none", - "dependsOn": [ - "build", - "deploy" - ], - "problemMatcher": [] - }, - //GENERAL TASKS - //Update Decky Frontend Library, aka DFL - { - "label": "updatefrontendlib", + "detail": "Build and deploy plugin to deck", "type": "shell", - "group": "build", - "detail": "Update @decky/ui aka DFL", - "command": "pnpm update @decky/ui --latest", - "problemMatcher": [] - }, - //Used chmod plugins folder to allow copy-over of files - { - "label": "chmodplugins", - "detail": "chmods plugins folder to prevent perms issues", - "type": "shell", - "group": "none", - "command": "ssh ${config:deckuser}@${config:deckip} -p ${config:deckport} ${config:deckkey} 'echo '${config:deckpass}' | sudo -S chmod -R ug+rw ${config:deckdir}/homebrew/plugins/'", + "command": "pnpm run build:deploy", "problemMatcher": [] }, ] diff --git a/README.md b/README.md index de27fae..57718cb 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,11 @@ If you would like to build plugins that have their own custom backends, Docker i 3. Consult the [decky-frontend-lib](https://github.com/SteamDeckHomebrew/decky-frontend-lib) repository for ways to accomplish your tasks. - Documentation and examples are still rough, - Decky loader primarily targets Steam Deck hardware so keep this in mind when developing your plugin. -4. If using VSCodium/VSCode, run the `setup` and `build` and `deploy` tasks. If not using VSCodium etc. you can derive your own makefile or just manually utilize the scripts for these commands as you see fit. +4. To build and deploy the plugin package first copy `.env.example` to `.env` and update any relevant settings. Then either: + - Run pnpm commands `pnpm run setup` and `pnpm run build:plugin` and `pnpm run deploy` + - Run VSCode tasks Ctrl+Shift+P or Cmd+Shift+P and run: `Tasks: Run Task` and choose the task to run. -If you use VSCode or it's derivatives (we suggest [VSCodium](https://vscodium.com/)!) just run the `setup` and `build` tasks. It's really that simple. +If you use VSCode or it's derivatives (we suggest [VSCodium](https://vscodium.com/)!) just run the `setup` and `build:plugin` and `deploy` tasks. It's really that simple. #### Other important information diff --git a/package.json b/package.json index 9501ba3..88483c4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,13 @@ "description": "A template to quickly create decky plugins from scratch, based on TypeScript and webpack", "type": "module", "scripts": { + "setup": "echo 'If you are using alpine linux, do not expect any support.' && pnpm i && pnpm update @decky/ui --latest && ([ -f ./cli/decky ] || pnpm run setup:cli) && (which docker >/dev/null || echo 'Docker not found, you will need it for backend development.')", + "setup:cli": "mkdir -p cli && case \"$(uname -s)-$(uname -m)\" in 'Linux-x86_64') url=decky-linux-x86_64 ;; 'Darwin-x86_64') url=decky-macOS-x86_64 ;; 'Darwin-arm64') url=decky-macOS-aarch64 ;; *) echo \"Unsupported system: $(uname -s)-$(uname -m)\"; exit 1 ;; esac && curl -L \"https://github.com/SteamDeckHomebrew/cli/releases/latest/download/$url\" -o ./cli/decky && chmod +x ./cli/decky", "build": "rollup -c", + "build:plugin": "pnpm run build && ./cli/decky plugin build .", + "build:deploy": "pnpm run build:plugin && pnpm run deploy", + "deploy": "dotenv -- pnpm run deploy:run", + "deploy:run": "set -e; PLUGIN_SAFE_NAME=$(echo \"$PLUGIN_NAME\" | tr ' ' '-'); SSH_OPTS=\"-C -p $DECK_PORT -o StrictHostKeyChecking=no -o ConnectTimeout=10\"; [ -n \"$DECK_KEY\" ] && SSH_OPTS=\"$SSH_OPTS $DECK_KEY\"; echo \"📦 Deploying 'out/$PLUGIN_NAME.zip' to $DECK_USER@$DECK_IP:$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME\"; cat \"out/$PLUGIN_NAME.zip\" | ssh $SSH_OPTS $DECK_USER@$DECK_IP \"set -e; mkdir -p '$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME'; bsdtar -xpf - -C '$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME' --strip-components=1\"", "watch": "rollup -c -w", "test": "echo \"Error: no test specified\" && exit 1" }, @@ -27,10 +33,11 @@ "homepage": "https://github.com/SteamDeckHomebrew/decky-plugin-template#readme", "devDependencies": { "@decky/rollup": "^1.0.1", - "@decky/ui": "^4.7.2", + "@decky/ui": "^4.10.6", "@types/react": "18.3.3", "@types/react-dom": "18.3.0", "@types/webpack": "^5.28.5", + "dotenv-cli": "^7.4.2", "rollup": "^4.22.5", "typescript": "^5.6.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8f954a4..22687ec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,8 +22,8 @@ importers: specifier: ^1.0.1 version: 1.0.1 '@decky/ui': - specifier: ^4.7.2 - version: 4.7.2 + specifier: ^4.10.6 + version: 4.10.6 '@types/react': specifier: 18.3.3 version: 18.3.3 @@ -33,6 +33,9 @@ importers: '@types/webpack': specifier: ^5.28.5 version: 5.28.5 + dotenv-cli: + specifier: ^7.4.2 + version: 7.4.4 rollup: specifier: ^4.22.5 version: 4.22.5 @@ -48,8 +51,8 @@ packages: '@decky/rollup@1.0.1': resolution: {integrity: sha512-dx1VJwD7ul14PA/aZvOwAfY/GujHzqZJ+MFb4OIUVi63/z4KWMSuZrK6QWo0S4LrNW3RzB3ua6LT0WcJaNY9gw==} - '@decky/ui@4.7.2': - resolution: {integrity: sha512-jYXVhbyyupXAcCuFqr7G2qjYVjp8hlMGF8zl8ALv67y0YhikAtfhA2rGUjCuaV3kdo9YrpBh8djRUJXdFPg/Eg==} + '@decky/ui@4.10.6': + resolution: {integrity: sha512-1VxL260XiSHmxjiorR0Ds9r5fmvif+zbI8rrFjIqo5enbX5AjoQPOND1UNPNVBXcxzCsR3byuQFBdrK7gFdhQw==} '@isaacs/cliui@8.0.2': resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} @@ -405,6 +408,10 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} @@ -420,6 +427,18 @@ packages: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} + dotenv-cli@7.4.4: + resolution: {integrity: sha512-XkBYCG0tPIes+YZr4SpfFv76SQrV/LeCE8CI7JSEMi3VR9MvTihCGTOtbIexD6i2mXF+6px7trb1imVCXSNMDw==} + hasBin: true + + dotenv-expand@10.0.0: + resolution: {integrity: sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==} + engines: {node: '>=12'} + + dotenv@16.6.1: + resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==} + engines: {node: '>=12'} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -653,6 +672,9 @@ packages: resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} engines: {node: '>=16 || 14 >=14.17'} + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + minipass@7.1.2: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} @@ -920,7 +942,7 @@ snapshots: tslib: 2.7.0 typescript: 5.6.2 - '@decky/ui@4.7.2': {} + '@decky/ui@4.10.6': {} '@isaacs/cliui@8.0.2': dependencies: @@ -1268,6 +1290,12 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + csstype@3.1.3: {} deepmerge@4.3.1: {} @@ -1287,6 +1315,17 @@ snapshots: dependencies: path-type: 4.0.0 + dotenv-cli@7.4.4: + dependencies: + cross-spawn: 7.0.6 + dotenv: 16.6.1 + dotenv-expand: 10.0.0 + minimist: 1.2.8 + + dotenv-expand@10.0.0: {} + + dotenv@16.6.1: {} + eastasianwidth@0.2.0: {} electron-to-chromium@1.5.29: {} @@ -1502,6 +1541,8 @@ snapshots: dependencies: brace-expansion: 2.0.1 + minimist@1.2.8: {} + minipass@7.1.2: {} neo-async@2.6.2: {} diff --git a/src/index.tsx b/src/index.tsx index 16cd6cb..cd2df65 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,7 +2,6 @@ import { ButtonItem, PanelSection, PanelSectionRow, - Navigation, staticClasses } from "@decky/ui"; import { @@ -98,7 +97,7 @@ export default definePlugin(() => { return { // The name shown in various decky menus - name: "Test Plugin", + name: "Example Plugin", // The element displayed at the top of your plugin's menu titleView:
Decky Example Plugin
, // The content of your plugin's menu From 260c21e91533daee9a75c72e0457e1a45f569e6d Mon Sep 17 00:00:00 2001 From: Kim T Date: Fri, 10 Oct 2025 22:20:17 -0700 Subject: [PATCH 2/3] Remove shell script and ensure tasks inherit terminal path --- .vscode/build.sh | 10 ---------- .vscode/tasks.json | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) delete mode 100755 .vscode/build.sh diff --git a/.vscode/build.sh b/.vscode/build.sh deleted file mode 100755 index 2310ff0..0000000 --- a/.vscode/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -CLI_LOCATION="$(pwd)/cli" -echo "Building plugin in $(pwd)" -printf "Please input sudo password to proceed.\n" - -# read -s sudopass - -# printf "\n" - -echo $sudopass | sudo -E $CLI_LOCATION/decky plugin build $(pwd) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6f19e2b..024780d 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,5 +1,15 @@ { "version": "2.0.0", + "options": { + "shell": { + "executable": "/bin/bash", + "args": [ + "-l", + "-i", + "-c" + ] + } + }, "tasks": [ { "label": "setup", From dc9b24b4ec5669291681fd298c689501660ff533 Mon Sep 17 00:00:00 2001 From: Kim T Date: Fri, 10 Oct 2025 22:31:23 -0700 Subject: [PATCH 3/3] If deploying locally run commands directly on filesystem, otherwise connect via ssh --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 88483c4..d604db4 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,9 @@ "build": "rollup -c", "build:plugin": "pnpm run build && ./cli/decky plugin build .", "build:deploy": "pnpm run build:plugin && pnpm run deploy", - "deploy": "dotenv -- pnpm run deploy:run", - "deploy:run": "set -e; PLUGIN_SAFE_NAME=$(echo \"$PLUGIN_NAME\" | tr ' ' '-'); SSH_OPTS=\"-C -p $DECK_PORT -o StrictHostKeyChecking=no -o ConnectTimeout=10\"; [ -n \"$DECK_KEY\" ] && SSH_OPTS=\"$SSH_OPTS $DECK_KEY\"; echo \"📦 Deploying 'out/$PLUGIN_NAME.zip' to $DECK_USER@$DECK_IP:$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME\"; cat \"out/$PLUGIN_NAME.zip\" | ssh $SSH_OPTS $DECK_USER@$DECK_IP \"set -e; mkdir -p '$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME'; bsdtar -xpf - -C '$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME' --strip-components=1\"", + "deploy": "dotenv -- sh -c 'if [ \"$DECK_IP\" = \"localhost\" ] || [ \"$DECK_IP\" = \"127.0.0.1\" ]; then pnpm run deploy:local; else pnpm run deploy:remote; fi'", + "deploy:local": "set -e; PLUGIN_SAFE_NAME=$(echo \"$PLUGIN_NAME\" | tr ' ' '-'); echo \"📦 Deploying 'out/$PLUGIN_NAME.zip' locally to $DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME\"; mkdir -p \"$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME\"; bsdtar -xpf \"out/$PLUGIN_NAME.zip\" -C \"$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME\" --strip-components=1", + "deploy:remote": "set -e; PLUGIN_SAFE_NAME=$(echo \"$PLUGIN_NAME\" | tr ' ' '-'); SSH_OPTS=\"-C -p $DECK_PORT -o StrictHostKeyChecking=no -o ConnectTimeout=10\"; [ -n \"$DECK_KEY\" ] && SSH_OPTS=\"$SSH_OPTS $DECK_KEY\"; echo \"📦 Deploying 'out/$PLUGIN_NAME.zip' remotely to $DECK_USER@$DECK_IP:$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME\"; cat \"out/$PLUGIN_NAME.zip\" | ssh $SSH_OPTS $DECK_USER@$DECK_IP \"set -e; mkdir -p '$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME'; bsdtar -xpf - -C '$DECK_DIR/homebrew/plugins/$PLUGIN_SAFE_NAME' --strip-components=1\"", "watch": "rollup -c -w", "test": "echo \"Error: no test specified\" && exit 1" },