mirror of
https://github.com/unraid/api.git
synced 2026-01-01 06:01:18 -06:00
- **New Features** - Created a dynamic plugin system for the API to enable community augmentation of GraphQL, CLI, and Cron functionalities capabilities. - Included an example plugin under `packages/unraid-api-plugin-health` that adds a new graphql query for API health checks. - Added `rc.unraid-api` commands for backing up, restoring, and installing production dependencies, streamlining maintenance and deployment. - Improved dependency vendoring by bundling a versioned pnpm store (instead of `node_modules`). Versioning will allow users to add plugins to a specific api release without requiring an internet connection on subsequent reboots. - **Chores** - Upgraded build workflows and versioning processes to ensure more reliable artifact handling and production packaging.
58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import { join } from "path";
|
|
import {
|
|
getTxzName,
|
|
pluginName,
|
|
pluginNameWithExt,
|
|
startingDir,
|
|
} from "./consts";
|
|
|
|
export interface PathConfig {
|
|
startingDir: string;
|
|
}
|
|
|
|
export interface TxzPathConfig extends PathConfig {
|
|
pluginVersion?: string;
|
|
}
|
|
|
|
export const deployDir = "deploy" as const;
|
|
|
|
export const apiDir = join(
|
|
startingDir,
|
|
"source",
|
|
pluginName,
|
|
"usr",
|
|
"local",
|
|
"unraid-api"
|
|
);
|
|
|
|
/**
|
|
* Get the path to the root plugin directory
|
|
* @param startingDir - The starting directory
|
|
* @returns The path to the root plugin directory
|
|
*/
|
|
export function getRootPluginPath({ startingDir }: PathConfig): string {
|
|
return join(startingDir, "/plugins/", pluginNameWithExt);
|
|
}
|
|
|
|
/**
|
|
* Get the path to the deploy plugin directory
|
|
* @param startingDir - The starting directory
|
|
* @returns The path to the deploy plugin directory
|
|
*/
|
|
export function getDeployPluginPath({ startingDir }: PathConfig): string {
|
|
return join(startingDir, deployDir, pluginNameWithExt);
|
|
}
|
|
|
|
/**
|
|
* Get the path to the TXZ file
|
|
* @param startingDir - The starting directory
|
|
* @param pluginVersion - The plugin version
|
|
* @returns The path to the TXZ file
|
|
*/
|
|
export function getTxzPath({
|
|
startingDir,
|
|
pluginVersion,
|
|
}: TxzPathConfig): string {
|
|
return join(startingDir, deployDir, getTxzName(pluginVersion));
|
|
}
|