Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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"
10 changes: 0 additions & 10 deletions .vscode/build.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .vscode/config.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .vscode/defsettings.json

This file was deleted.

68 changes: 0 additions & 68 deletions .vscode/setup.sh

This file was deleted.

139 changes: 20 additions & 119 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,141 +1,42 @@
{
"version": "2.0.0",
"options": {
"shell": {
"executable": "/bin/bash",
"args": [
"-l",
"-i",
"-c"
]
}
},
"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",
"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",
// },
"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",
"detail": "Setup dependencies",
"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 setup",
"problemMatcher": []
},
//
{
"label": "extractzip",
"detail": "",
"label": "build:plugin",
"detail": "Build plugin",
"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 '",
"command": "pnpm run build:plugin",
"problemMatcher": []
},
//"All-in-one" deploy task
{
"label": "deploy",
"dependsOrder": "sequence",
"group": "none",
"dependsOn": [
"copyzip",
"extractzip"
],
"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": "Deploy plugin to deck",
"type": "shell",
"group": "build",
"detail": "Update @decky/ui aka DFL",
"command": "pnpm update @decky/ui --latest",
"command": "pnpm run deploy",
"problemMatcher": []
},
//Used chmod plugins folder to allow copy-over of files
{
"label": "chmodplugins",
"detail": "chmods plugins folder to prevent perms issues",
"label": "builddeploy",
"detail": "Build and deploy plugin to deck",
"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": []
},
]
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
"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 -- 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"
},
Expand All @@ -27,10 +34,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"
},
Expand Down
Loading