mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced support for specifying and propagating a build number throughout the build process, including command-line options and workflow inputs. * TXZ package naming and URLs now include the build number for improved traceability. * **Improvements** * Enhanced robustness in locating TXZ files with improved fallback logic, especially in CI environments. * Improved flexibility and validation of environment schema for plugin builds. * **Style** * Minor formatting corrections for consistency and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1210677942019563
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import { join } from "path";
|
|
import {
|
|
getTxzName,
|
|
pluginName,
|
|
pluginNameWithExt,
|
|
startingDir,
|
|
TxzNameParams,
|
|
} from "./consts";
|
|
|
|
export interface PathConfig {
|
|
startingDir: string;
|
|
}
|
|
|
|
export interface TxzPathConfig extends PathConfig, TxzNameParams {}
|
|
|
|
export const deployDir = "deploy" as const;
|
|
|
|
export const apiDir = join(
|
|
startingDir,
|
|
"source",
|
|
pluginName,
|
|
"usr",
|
|
"local",
|
|
"unraid-api"
|
|
);
|
|
|
|
export const vendorStorePath = "/boot/config/plugins/dynamix.my.servers";
|
|
|
|
/**
|
|
* 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,
|
|
version,
|
|
build,
|
|
}: TxzPathConfig): string {
|
|
return join(startingDir, deployDir, getTxzName({ version, build }));
|
|
}
|