mirror of
https://github.com/Heretek-Games/drop-plugin-sdk.git
synced 2026-11-07 10:06:00 -10:00
9042a30bcec485fdfe4bd5a57098eb804a1649a2
- drop-plugin.json declares server/client blocks with client.entry (Drop Desktop never reads the legacy clientEntry alias), server capabilities at the top level, and no checked-in checksum/files map. - Remove stray tracked compiled test artifacts (index.test.js/.d.ts). - Point template dependencies and imports at @drop-oss/* and add the Node >=22 engine plus a typecheck script.
drop-plugin-sdk
Extensibility platform, runtime contract, and developer toolchain for the Drop game distribution platform.
Maintained by Heretek Games.
Packages
| Package | Version | Role |
|---|---|---|
@droposs/plugin-sdk (packages/plugin-sdk) |
0.5.9 |
Universal runtime types (PLUGIN_API_VERSION = 2), JSON Schema, RPC helper client, and test harnesses (MockPluginContext, MockClientPluginContext). |
@droposs/plugin-cli (packages/plugin-cli) |
0.5.9 |
Developer CLI (drop-plugin) providing scaffolding (init), bundling (build), validation (validate), testing (test), signing (sign), and packaging (pack). |
templates/starter-plugin |
1.0.0 |
Reference starter template for creating full-stack Drop plugins (server + desktop client). |
Quick Start
1. Scaffold a New Plugin
npx @droposs/plugin-cli init my-plugin
cd my-plugin
npm install
2. Implement Server and Client Logic
Server Entry (src/index.ts)
import type { PluginContext, ServerPlugin } from "@droposs/plugin-sdk";
export default class MyPlugin implements ServerPlugin {
metadata = {
id: "my-plugin",
name: "My First Plugin",
version: "1.0.0",
apiVersion: 2,
targets: ["server" as const],
capabilities: ["routes" as const, "storage" as const],
};
async init(ctx: PluginContext): Promise<void> {
ctx.registerRoute("GET", "/status", () => ({ ready: true }));
}
}
Client Entry (src/client.ts)
import type { ClientPlugin, ClientPluginContext } from "@droposs/plugin-sdk";
export default class MyClientPlugin implements ClientPlugin {
async init(ctx: ClientPluginContext): Promise<void> {
ctx.registerPlayAction((gameId) => [
{
id: "custom-play",
name: "Play with Custom Mod",
execute: async () => {
ctx.logger.info(`Launching game ${gameId} with custom mod`);
},
},
]);
}
}
3. Build, Validate & Test
# Bundles TS source to ESM dist/ using esbuild and updates drop-plugin.json digests
npx drop-plugin build .
# Validates drop-plugin.json against official JSON Schema
npx drop-plugin validate .
# Executes unit tests against MockPluginContext and MockClientPluginContext
npx drop-plugin test .
4. Sign & Package for Distribution
# Cryptographically sign drop-plugin.json (uses DROP_PLUGIN_SIGNING_KEY if present)
npx drop-plugin sign .
# Packages bundle into a .dropplugin archive ready for Drop server/desktop installation
npx drop-plugin pack . ./dist-package
Architecture & Invariants
PLUGIN_API_VERSION = 2: Target API version matching Drop's plugin manager contract.- Strict Confinement:
signerandpackenforce strict filesystem confinement, rejecting directory traversal (..) and symlinks escaping the bundle directory. - Capability Gating: All server and client capabilities must be explicitly declared in
drop-plugin.json. Undeclared API calls throw in runtime and mock harnesses. - Zero Runtime Dependencies:
@droposs/plugin-sdkcontains zero third-party runtime dependencies.
Documentation & Guides
Comprehensive guides are available in the docs/ directory:
- Getting Started Tutorial: Scaffolding, implementing, testing, and installing your first plugin.
- Server Plugins Guide: HTTP routing, persistent storage, schema migrations, WebSockets, event bus, and network egress.
- Client Plugins Guide: UI slots, Play Actions, context menus, game launch pipeline with reverse rollback, scoped filesystem, and native execution.
- Testing Guide: Unit testing server and client plugins using
MockPluginContextandMockClientPluginContext. - Manifest Reference (
drop-plugin.json): Complete schema specification and capabilities reference. - Packaging, Signing & Distribution: Cryptographic bundle signing, packaging, and hosting community registries.
- Community Ecosystem Patterns: Architectural patterns inspired by Playnite, Stash, and RomM.
License
MIT © Heretek Games
Description
Drop Plugin SDK, TypeScript contracts (@drop/plugin-sdk), and CLI toolchain (drop-plugin)
390 KiB
0 Stars
1 Watchers
0 Forks
Languages
TypeScript
81%
JavaScript
17.8%
Vue
1.2%