feat: Implemented public plugin system accessible from the store.
feat: Implemented external ryujinx integration plugin refactor: moved sdk types and schemas to own workspace package fix: Fixed emulator launch with no game
This commit is contained in:
parent
9051834ace
commit
38cb752552
124 changed files with 1918 additions and 1067 deletions
|
|
@ -1,64 +0,0 @@
|
|||
import path from 'node:path';
|
||||
import appPkg from '../package.json';
|
||||
import sdkTsConfig from './sdk/sdk.tsconfig.json';
|
||||
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';
|
||||
|
||||
const zodTypeRegex = /z\.infer<typeof? ([\w\d]+)>/gm;
|
||||
|
||||
async function generateApiDeclarations ()
|
||||
{
|
||||
const tmpConfigPath = "./scripts/sdk/sdk.tsconfig.json";
|
||||
const outDir = path.join(path.dirname(tmpConfigPath), sdkTsConfig.compilerOptions.outDir);
|
||||
await emptyDir(outDir);
|
||||
|
||||
const results = generateDtsBundle([{
|
||||
filePath: './scripts/sdk/sdk.ts',
|
||||
output: {
|
||||
inlineDeclareGlobals: true,
|
||||
sortNodes: true,
|
||||
}
|
||||
},], { preferredConfigPath: './scripts/sdk/sdk.tsconfig.json' });
|
||||
|
||||
const auxiliaryTypeStore = createAuxiliaryTypeStore();
|
||||
|
||||
await Bun.write('./dist-sdk/index.d.ts', results.map(r =>
|
||||
{
|
||||
const result = r;
|
||||
return result.replaceAll(zodTypeRegex, (e, name) =>
|
||||
{
|
||||
const schema = types[name as keyof typeof types];
|
||||
if (schema)
|
||||
{
|
||||
try
|
||||
{
|
||||
const { node } = zodToTs(schema as any, { auxiliaryTypeStore, unrepresentable: 'any' });
|
||||
return printNode(node);
|
||||
} catch (error)
|
||||
{
|
||||
console.error(error);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return e;
|
||||
});
|
||||
}));
|
||||
|
||||
const pkg = {
|
||||
...sdkPackage,
|
||||
license: appPkg.license,
|
||||
version: appPkg.version,
|
||||
repository: appPkg.repository,
|
||||
author: appPkg.author,
|
||||
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();
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
# Gameflow Deck SDK
|
||||
|
||||
This is the type definitions for Gameflow Deck plugins.
|
||||
|
||||
## Developing a plugin
|
||||
|
||||
The plugin must have a default export class of type `PluginType`. It exposes the context and all the hooks to be tapped.
|
||||
Gameflow uses the [Tapable Hooks](https://github.com/webpack/tapable).
|
||||
|
||||
The package must expose a main script gameflow will import and validate. It must implement the type fields on `PluginDescriptionType`.
|
||||
|
||||
## 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)
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"name": "@simeonradivoev/gameflow-sdk",
|
||||
"types": "index.d.ts",
|
||||
"description": "plugin SDK for the Gameflow Deck Launcher",
|
||||
"keywords": [
|
||||
"gameflow",
|
||||
"sdk"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
import { SettingsType } from '@/shared/constants';
|
||||
import Conf from 'conf';
|
||||
import { AppEventMap } from '../../src/bun/types/types';
|
||||
import EventEmitter from "node:events";
|
||||
import { TaskQueue } from '@/bun/api/task-queue';
|
||||
|
||||
export * from '../../src/bun/types/types.schema';
|
||||
export * from '../../src/bun/types/types';
|
||||
export * from '../../src/bun/api/hooks/app';
|
||||
export * from '../../src/shared/constants';
|
||||
export * from '../../src/shared/types';
|
||||
export * from '../../src/shared/utils';
|
||||
|
||||
export declare const config: Conf<SettingsType>;
|
||||
export declare let events: EventEmitter<AppEventMap>;
|
||||
export declare let taskQueue: TaskQueue;
|
||||
|
||||
export { };
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": [
|
||||
"ES2024"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"emitDeclarationOnly": true,
|
||||
"declaration": true,
|
||||
"strict": true,
|
||||
"outDir": "../../dist-sdk",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"../../src/*"
|
||||
],
|
||||
"~/*": [
|
||||
"../../*"
|
||||
],
|
||||
"@shared/*": [
|
||||
"../../src/shared/*"
|
||||
],
|
||||
"@clients/*": [
|
||||
"../../src/clients/*"
|
||||
],
|
||||
"@schema/*": [
|
||||
"../../src/bun/api/schema/*"
|
||||
],
|
||||
"@queries/*": [
|
||||
"../../src/mainview/scripts/queries/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue