mirror of
https://github.com/unraid/api.git
synced 2026-01-01 14:10:10 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added detailed versioning for plugin packages incorporating architecture and build identifiers. - Simplified and improved install/uninstall scripts with backup and dynamic package detection. - Introduced comprehensive setup, verification, patching, and cleanup scripts for the Unraid API environment. - Enhanced service control with explicit start, stop, restart, and status commands. - Added robust dependency management scripts for restoring and archiving Node.js modules. - Implemented vendor archive metadata storage and dynamic handling during build and runtime. - Added new CLI options and environment schemas for consistent build configuration. - Introduced new shutdown scripts to gracefully stop flash-backup and unraid-api services. - Added utility scripts for API version detection and vendor archive configuration. - Added a new package description file detailing Unraid API features and homepage link. - **Bug Fixes** - Improved validation and error reporting for missing manifests, dependencies, and configuration files. - Enhanced fallback logic for locating and creating vendor archives. - Fixed iframe compatibility in UI by updating HTML and Firefox preference files. - **Chores** - Updated .gitignore with generated file patterns for Node.js binaries and archives. - Removed obsolete internal documentation and legacy cleanup scripts. - Refined Docker Compose and CI workflows to pass precise API versioning and manage build artifacts. - Centralized common environment validation and CLI option definitions across build tools. - Cleaned up plugin manifest by removing Node.js and PNPM-related entities and legacy logic. - Improved logging and error handling in build and installation scripts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { Command } from "commander";
|
|
import { z } from "zod";
|
|
|
|
/**
|
|
* Common base environment fields shared between different build setups
|
|
*/
|
|
export const baseEnvSchema = z.object({
|
|
ci: z.boolean().optional().default(false),
|
|
apiVersion: z.string(),
|
|
baseUrl: z.string().url(),
|
|
tag: z.string().optional().default(''),
|
|
});
|
|
|
|
export type BaseEnv = z.infer<typeof baseEnvSchema>;
|
|
|
|
/**
|
|
* Generate a default base URL for local development
|
|
*/
|
|
export const getDefaultBaseUrl = (): string => {
|
|
return process.env.CI === "true"
|
|
? "This is a CI build, please set the base URL manually"
|
|
: `http://${process.env.HOST_LAN_IP || 'localhost'}:5858`;
|
|
};
|
|
|
|
/**
|
|
* Common CLI options shared across different command setups
|
|
*/
|
|
export const addCommonOptions = (program: Command) => {
|
|
return program
|
|
.option("--ci", "CI mode", process.env.CI === "true")
|
|
.requiredOption("--api-version <version>", "API version", process.env.API_VERSION)
|
|
.requiredOption(
|
|
"--base-url <url>",
|
|
"Base URL for assets",
|
|
getDefaultBaseUrl()
|
|
)
|
|
.option("--tag <tag>", "Tag (used for PR and staging builds)", process.env.TAG);
|
|
};
|