doc: Added plugin dev info

This commit is contained in:
Simeon Radivoev 2026-05-05 03:10:49 +03:00
parent 04e332d91e
commit 7029477392
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
5 changed files with 14 additions and 2 deletions

View file

@ -104,6 +104,14 @@ But given it's an existing setup, say from emudeck it won't matter much as it's
- `bun run download:chromium` downloads degoogled chromium to use as the frontend - `bun run download:chromium` downloads degoogled chromium to use as the frontend
- `bun run download:nwjs` downloads NW.js to use as a frontend. - `bun run download:nwjs` downloads NW.js to use as a frontend.
## Plugins
To create a plugin create a new npm project and install:
`bun i --peer @simeonradivoev/gameflow-sdk`
Then publish the package to npmjs with a tag `gameflow-plugin` to appear in the UI.
For more info check the [SDK README](./scripts/sdk/README.md)
### Tech Stack ### Tech Stack
- [Bun](https://bun.com/) for the backend - [Bun](https://bun.com/) for the backend

View file

@ -49,7 +49,8 @@
"download:nwjs": "bun scripts/download-nw.ts", "download:nwjs": "bun scripts/download-nw.ts",
"build:audiosprites": "bun ./scripts/generate-audio-sprites.ts", "build:audiosprites": "bun ./scripts/generate-audio-sprites.ts",
"tsc": "tsc --noEmit", "tsc": "tsc --noEmit",
"build:sdk": "bun ./scripts/build-sdk.ts" "build:sdk": "bun ./scripts/build-sdk.ts",
"publish:sdk": "bun build:sdk && bun publish --cwd ./dist-sdk/ --access public"
}, },
"dependencies": { "dependencies": {
"7zip-bin": "^5.2.0", "7zip-bin": "^5.2.0",

View file

@ -5,6 +5,7 @@ import sdkPackage from './sdk/package.json';
import { emptyDir } from 'fs-extra'; import { emptyDir } from 'fs-extra';
import { generateDtsBundle } from 'dts-bundle-generator'; import { generateDtsBundle } from 'dts-bundle-generator';
import { zodToTs, createAuxiliaryTypeStore, printNode } from 'zod-to-ts'; import { zodToTs, createAuxiliaryTypeStore, printNode } from 'zod-to-ts';
import fs from 'node:fs/promises';
import * as types from './sdk/sdk'; import * as types from './sdk/sdk';
@ -57,6 +58,7 @@ async function generateApiDeclarations ()
peerDependencies: appPkg.dependencies peerDependencies: appPkg.dependencies
}; };
await Bun.write(path.join(outDir, 'package.json'), JSON.stringify(pkg, null, 3)); await Bun.write(path.join(outDir, 'package.json'), JSON.stringify(pkg, null, 3));
await fs.cp('./scripts/sdk/README.md', path.join(outDir, 'README.md'));
} }
await generateApiDeclarations(); await generateApiDeclarations();

View file

@ -12,3 +12,4 @@ The package must expose a main script gameflow will import and validate. It must
## Publishing ## Publishing
For the plugin to show up in the UI for download. It must be published to NPM with the `gameflow-plugin` keyword. Gameflow uses bun to install plugins as packages from npmjs. For the plugin to show up in the UI for download. It must be published to NPM with the `gameflow-plugin` keyword. Gameflow uses bun to install plugins as packages from npmjs.
Follow publishing instruction check the [NPM Docs](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry)

View file

@ -1,5 +1,5 @@
{ {
"name": "gameflow-sdk", "name": "@simeonradivoev/gameflow-sdk",
"types": "index.d.ts", "types": "index.d.ts",
"description": "plugin SDK for the Gameflow Deck Launcher", "description": "plugin SDK for the Gameflow Deck Launcher",
"keywords": [ "keywords": [