Merge Dockerfile and example files for backend support example (#7)
* Add template dockerfile for testing * Switch to holo-docker image * Add default entrypoint.sh * Updated dockerfile to reflect CI/CD on database * Add template makefile, main.c * Adjusted entrypoint.sh to actually build binary * Made entrypoint.sh executable * Big README update and comments in Dockerfile
This commit is contained in:
parent
41103641bd
commit
af817b6b5f
6 changed files with 108 additions and 11 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -40,3 +40,7 @@ __pycache__/
|
||||||
yalc.lock
|
yalc.lock
|
||||||
|
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
|
|
||||||
|
# Ignore output folder
|
||||||
|
|
||||||
|
backend/out
|
||||||
|
|
79
README.md
79
README.md
|
@ -1,8 +1,9 @@
|
||||||
# React-Frontend Plugin Template
|
# React-Frontend Plugin Template [![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/ZU74G2NJzk)
|
||||||
|
|
||||||
Reference example for using [decky-frontend-lib](https://github.com/SteamDeckHomebrew/decky-frontend-lib) in a [decky-loader](https://github.com/SteamDeckHomebrew/decky-loader) plugin.
|
Reference example for using [decky-frontend-lib](https://github.com/SteamDeckHomebrew/decky-frontend-lib) in a [decky-loader](https://github.com/SteamDeckHomebrew/deckly-loader) plugin.
|
||||||
|
|
||||||
## Decky Loader Discord [![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/ZU74G2NJzk)
|
If you want to get in contact with the developers, we can be found in the
|
||||||
|
**[SteamDeckHomebrew Discord](https://discord.gg/ZU74G2NJzk)**.
|
||||||
|
|
||||||
## Developers
|
## Developers
|
||||||
|
|
||||||
|
@ -17,23 +18,79 @@ This can be downloaded from `npm` itself which is recommended.
|
||||||
sudo npm i -g pnpm
|
sudo npm i -g pnpm
|
||||||
```
|
```
|
||||||
|
|
||||||
### Getting Started
|
### Making your own plugin
|
||||||
|
|
||||||
1. Clone the repository to use as an example for making your plugin.
|
1. You can fork this repo or utilize the "Use this template" button on Github.
|
||||||
2. In your clone of the repository run these commands:
|
2. In your local fork/own plugin-repository run these commands:
|
||||||
1. ``pnpm i``
|
1. ``pnpm i``
|
||||||
2. ``pnpm run build``
|
2. ``pnpm run build``
|
||||||
3. You should do this every time you make changes to your plugin.
|
- These setup pnpm and build the frontend code for testing.
|
||||||
|
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,
|
||||||
|
- While decky-loader primarily targets Steam Deck hardware so keep this in mind when developing your plugin.
|
||||||
|
4. If you want an all encompassing demonstration of decky-frontend-lib's capabilites check out [decky-playground](https://github.com/SteamDeckHomebrew/decky-playground). It shows off almost all of decky-frontend-lib's features.
|
||||||
|
|
||||||
Note: If you are recieveing build errors due to an out of date library, you should run this command inside of your repository:
|
#### Other important information
|
||||||
|
|
||||||
|
Everytime you change the frontend code (`index.tsx` etc) you will need to rebuild using the commands from step 2 above or the build task if you're using vscode or a derivative.
|
||||||
|
|
||||||
|
Note: If you are receiving build errors due to an out of date library, you should run this command inside of your repository:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pnpm update decky-frontend-lib --latest
|
pnpm update decky-frontend-lib --latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Backend support
|
||||||
|
|
||||||
|
If you are developing with a backend for a plugin and would like to submit it to the [decky-plugin-database](https://github.com/SteamDeckHomebrew/decky-plugin-database) you will need to have all backend code located in ``backend/src``, with backend being located in the root of your git repository.
|
||||||
|
When building your plugin, the source code will be built and any finished binary or binaries will be output to ``backend/out`` (which is created during CI.)
|
||||||
|
If your buildscript, makefile or any other build method does not place the binary files in the ``backend/out`` directory they will not be properly picked up during CI and your plugin will not have the required binaries included for distribution.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
In our makefile used to demonstrate the CI process of building and distributing a plugin backend, note that the makefile explicitly creates the `out` folder (``backend/out``) and then compiles the binary into that folder. Here's the relevant snippet.
|
||||||
|
|
||||||
|
```make
|
||||||
|
hello:
|
||||||
|
mkdir -p ./out
|
||||||
|
gcc -o ./out/hello ./src/main.c
|
||||||
|
```
|
||||||
|
|
||||||
|
The CI does create the `out` folder itself but we recommend creating it yourself if possible during your build process to ensure the build process goes smoothly.
|
||||||
|
|
||||||
|
The out folder is not sent to the final plugin, but is then put into a ``bin`` folder which is found at the root of the plugin's directory.
|
||||||
|
More information on the bin folder can be found below in the distribution section below.
|
||||||
|
|
||||||
### Distribution
|
### Distribution
|
||||||
|
|
||||||
Plugins are distributed officially through the [decky-plugin-database](https://github.com/SteamDeckHomebrew/decky-plugin-database) via usage of submodules and PRs.
|
We recommend following the instructions found in the [decky-plugin-database](https://github.com/SteamDeckHomebrew/decky-plugin-database) on how to get your plugin up on the plugin store. This is the best way to get your plugin in front of users.
|
||||||
If you wish to distribute your plugin another way then you will need to build and bundle the plugin as a zip file.
|
You can also choose to do distribution via a zip file containing the needed files, if that zip file is uploaded to a URL it can then be downloded and installed via decky-loader.
|
||||||
Here users can install the zip file from a URL in the settings menu, they will be warned that the plugin is not verified via hash.
|
Please note that decky-loader will be warn them that the plugin is not verified via hash as it would be coming from the plugin store.
|
||||||
|
|
||||||
|
**NOTE: We do not currently have a method to install from a downloaded zip file in "game-mode" due to lack of a usable file-picking dialog.**
|
||||||
|
|
||||||
|
Layout of a plugin zip ready for distribution:
|
||||||
|
```
|
||||||
|
pluginname-v1.0.0.zip (version number is optional but recommended for users sake)
|
||||||
|
|
|
||||||
|
pluginname/ <directory>
|
||||||
|
| | |
|
||||||
|
| | bin/ <directory> (optional)
|
||||||
|
| | |
|
||||||
|
| | binary (optional)
|
||||||
|
| |
|
||||||
|
| dist/ <directory> [required]
|
||||||
|
| |
|
||||||
|
| index.js [required]
|
||||||
|
|
|
||||||
|
package.json [required]
|
||||||
|
plugin.json [required]
|
||||||
|
README.md (optional but recommended)
|
||||||
|
LICENSE(.md) {required in some cases, not in others}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note regarding licenses: Including a license is required for the plugin store if your chosen license requires the license to be included alongside usage of source-code/binaries!
|
||||||
|
|
||||||
|
If you wish to distribute your plugin another way then you will need to build and bundle the plugin as a zip file.
|
||||||
|
|
||||||
|
|
||||||
|
We cannot and will not distribute your plugin on the Plugin Store if it's license requires it's inclusion but you have not included a license to be re-distributed with your plugin in the root of your git repository.
|
||||||
|
|
9
backend/Dockerfile
Normal file
9
backend/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# we support images for building with a vanilla SteamOS base,
|
||||||
|
# or versions with ootb support for rust or go
|
||||||
|
# developers can also customize these images via this Dockerfile
|
||||||
|
#FROM ghcr.io/steamdeckhomebrew/holo-toolchain-rust:latest
|
||||||
|
#FROM ghcr.io/steamdeckhomebrew/holo-toolchain-go:latest
|
||||||
|
FROM ghcr.io/steamdeckhomebrew/holo-base:latest
|
||||||
|
|
||||||
|
# entrypoint.sh should always be located in the backend folder
|
||||||
|
ENTRYPOINT [ "/backend/entrypoint.sh" ]
|
14
backend/Makefile
Normal file
14
backend/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# This is the default target, which will be built when
|
||||||
|
# you invoke make
|
||||||
|
.PHONY: all
|
||||||
|
all: hello
|
||||||
|
|
||||||
|
# This rule tells make how to build hello from hello.cpp
|
||||||
|
hello:
|
||||||
|
mkdir -p ./out
|
||||||
|
gcc -o ./out/hello ./src/main.c
|
||||||
|
|
||||||
|
# This rule tells make to delete hello and hello.o
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -f hello
|
8
backend/entrypoint.sh
Executable file
8
backend/entrypoint.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Container's IP address: `awk 'END{print $1}' /etc/hosts`"
|
||||||
|
|
||||||
|
cd /backend
|
||||||
|
|
||||||
|
make
|
5
backend/src/main.c
Normal file
5
backend/src/main.c
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
int main() {
|
||||||
|
printf("Hello World\n");
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue