From 7029477392af54b865f2f1d950ec052dd83d2c40 Mon Sep 17 00:00:00 2001 From: Simeon Radivoev Date: Tue, 5 May 2026 03:10:49 +0300 Subject: [PATCH] doc: Added plugin dev info --- README.md | 8 ++++++++ package.json | 3 ++- scripts/build-sdk.ts | 2 ++ scripts/sdk/README.md | 1 + scripts/sdk/package.json | 2 +- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ceed36a..dfc57b3 100644 --- a/README.md +++ b/README.md @@ -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: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 - [Bun](https://bun.com/) for the backend diff --git a/package.json b/package.json index f83f902..f804746 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,8 @@ "download:nwjs": "bun scripts/download-nw.ts", "build:audiosprites": "bun ./scripts/generate-audio-sprites.ts", "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": { "7zip-bin": "^5.2.0", diff --git a/scripts/build-sdk.ts b/scripts/build-sdk.ts index 7018414..11ee929 100644 --- a/scripts/build-sdk.ts +++ b/scripts/build-sdk.ts @@ -5,6 +5,7 @@ import sdkPackage from './sdk/package.json'; import { emptyDir } from 'fs-extra'; import { generateDtsBundle } from 'dts-bundle-generator'; import { zodToTs, createAuxiliaryTypeStore, printNode } from 'zod-to-ts'; +import fs from 'node:fs/promises'; import * as types from './sdk/sdk'; @@ -57,6 +58,7 @@ async function generateApiDeclarations () peerDependencies: appPkg.dependencies }; 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(); \ No newline at end of file diff --git a/scripts/sdk/README.md b/scripts/sdk/README.md index cfe9b61..7ac9193 100644 --- a/scripts/sdk/README.md +++ b/scripts/sdk/README.md @@ -12,3 +12,4 @@ The package must expose a main script gameflow will import and validate. It must ## 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. +Follow publishing instruction check the [NPM Docs](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) diff --git a/scripts/sdk/package.json b/scripts/sdk/package.json index d92b663..17d855e 100644 --- a/scripts/sdk/package.json +++ b/scripts/sdk/package.json @@ -1,5 +1,5 @@ { - "name": "gameflow-sdk", + "name": "@simeonradivoev/gameflow-sdk", "types": "index.d.ts", "description": "plugin SDK for the Gameflow Deck Launcher", "keywords": [