mirror of
https://github.com/SteamDeckHomebrew/decky-plugin-template.git
synced 2025-11-16 13:27:29 -06:00
Migrate bash scripts to package scripts. Update VSCode tasks to use package scripts. Use ssh key instead of password.
This commit is contained in:
parent
8262602460
commit
14dfd8e8c2
9 changed files with 78 additions and 221 deletions
12
.vscode/config.sh
vendored
12
.vscode/config.sh
vendored
|
|
@ -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
|
||||
12
.vscode/defsettings.json
vendored
12
.vscode/defsettings.json
vendored
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
68
.vscode/setup.sh
vendored
68
.vscode/setup.sh
vendored
|
|
@ -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
|
||||
129
.vscode/tasks.json
vendored
129
.vscode/tasks.json
vendored
|
|
@ -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": []
|
||||
},
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue