mirror of
https://github.com/unraid/api.git
synced 2026-01-01 06:01:18 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Standalone web bundle with auto-mount utilities and a self-contained test page. * New responsive modal components for consistent mobile/desktop dialogs. * Header actions to copy OS/API versions. * **Improvements** * Refreshed UI styles (muted borders), accessibility and animation refinements. * Theming updates and Tailwind v4–aligned, component-scoped styles. * Runtime GraphQL endpoint override and CSRF header support. * **Bug Fixes** * Safer network fetching and improved manifest/asset loading with duplicate protection. * **Tests/Chores** * Parallel plugin tests, new extractor test suite, and updated build/test scripts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
51 lines
1.4 KiB
TypeScript
51 lines
1.4 KiB
TypeScript
import { join } from "path";
|
|
import { z } from "zod";
|
|
import { Command } from "commander";
|
|
import { startingDir } from "../utils/consts";
|
|
import { deployDir } from "../utils/paths";
|
|
import { baseEnvSchema, addCommonOptions } from "./common-environment";
|
|
|
|
const txzEnvSchema = baseEnvSchema.extend({
|
|
skipValidation: z
|
|
.string()
|
|
.optional()
|
|
.default("false")
|
|
.refine((v) => v === "true" || v === "false", "Must be true or false"),
|
|
compress: z.string().optional().default("1"),
|
|
txzOutputDir: z.string().optional().default(join(startingDir, deployDir)),
|
|
});
|
|
|
|
export type TxzEnv = z.infer<typeof txzEnvSchema>;
|
|
|
|
export const validateTxzEnv = async (
|
|
envArgs: Record<string, any>
|
|
): Promise<TxzEnv> => {
|
|
const validatedEnv = txzEnvSchema.parse(envArgs);
|
|
|
|
if (validatedEnv.skipValidation === "true") {
|
|
console.warn("skipValidation is true, skipping validation");
|
|
}
|
|
|
|
return validatedEnv;
|
|
};
|
|
|
|
export const setupTxzEnv = async (argv: string[]): Promise<TxzEnv> => {
|
|
// CLI setup for TXZ environment
|
|
const program = new Command();
|
|
|
|
// Add common options first
|
|
addCommonOptions(program);
|
|
|
|
// Add TXZ-specific options
|
|
program
|
|
.option("--skip-validation", "Skip validation", "false")
|
|
.option("--compress, -z", "Compress level", "1")
|
|
.parse(argv);
|
|
|
|
const options = program.opts();
|
|
|
|
const env = await validateTxzEnv(options);
|
|
console.log("TXZ environment setup successfully:", env);
|
|
return env;
|
|
};
|