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
62
src/bun/api/plugins/services.ts
Normal file
62
src/bun/api/plugins/services.ts
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import path from 'node:path';
|
||||
import os from 'node:os';
|
||||
import { getStoreRootFolder } from '../store/services/gamesService';
|
||||
import { PluginDescriptionType } from '@simeonradivoev/gameflow-sdk';
|
||||
import { run } from 'npm-check-updates';
|
||||
|
||||
export function canDisable (description: PluginDescriptionType)
|
||||
{
|
||||
if (description.name === '@simeonradivoev/gameflow-store')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return description.canDisable ?? true;
|
||||
}
|
||||
|
||||
export async function getUpdates ()
|
||||
{
|
||||
const updated = await run({ packageManager: 'bun', peer: true, cwd: getStoreRootFolder(), jsonUpgraded: true, reject: ['@simeonradivoev/gameflow-sdk'] });
|
||||
return updated as Record<string, string>;
|
||||
}
|
||||
|
||||
export function canUninstall (description: PluginDescriptionType, source: string)
|
||||
{
|
||||
if (description.name === '@simeonradivoev/gameflow-store')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return source !== 'builtin';
|
||||
}
|
||||
|
||||
export async function runBunPackageCommand (commands: string[])
|
||||
{
|
||||
const tempCache = path.join(os.tmpdir(), "gameflow-bun-cache");
|
||||
const storeFolder = getStoreRootFolder();
|
||||
|
||||
let proc = Bun.spawn([process.execPath, ...commands, '--json'], {
|
||||
cwd: storeFolder,
|
||||
stdout: 'pipe',
|
||||
stderr: 'pipe',
|
||||
env: {
|
||||
BUN_BE_BUN: "1",
|
||||
BUN_INSTALL_CACHE_DIR: tempCache
|
||||
}
|
||||
});
|
||||
|
||||
let stdout = await new Response(proc.stdout).text();
|
||||
let stderr = await new Response(proc.stderr).text();
|
||||
if (stderr)
|
||||
console.error(stderr);
|
||||
await proc.exited;
|
||||
return stdout;
|
||||
}
|
||||
|
||||
export async function hasPackage (id: string)
|
||||
{
|
||||
const storeFolder = getStoreRootFolder();
|
||||
const packagePath = path.join(storeFolder, 'package.json');
|
||||
const packageFile = Bun.file(packagePath);
|
||||
if (!await packageFile.exists()) return false;
|
||||
const pkg = await packageFile.json();
|
||||
return !!pkg.dependencies?.[id];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue