UNPKG

@storm-software/config-tools

Version:

A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.

42 lines (39 loc) 2.86 kB
import { StormWorkspaceConfig } from '@storm-software/config'; import * as z from 'zod'; /** * Get the config for the current Storm workspace * * @param extensionName - The name of the config extension * @param schema - The schema for the config extension * @param workspaceRoot - The root directory of the workspace * @param skipLogs - Skip writing logs to the console * @param useDefault - Whether to use the default config if no config file is found * @returns The config for the current Storm workspace */ declare const createStormWorkspaceConfig: <TExtensionName extends keyof StormWorkspaceConfig["extensions"] = keyof StormWorkspaceConfig["extensions"], TExtensionConfig = any, TExtensionSchema extends z.ZodType = z.ZodType, TUseDefault extends boolean | undefined = boolean | undefined, TResult = TUseDefault extends true ? StormWorkspaceConfig<TExtensionName, TExtensionConfig> : StormWorkspaceConfig<TExtensionName, TExtensionConfig> | undefined>(extensionName?: TExtensionName, schema?: TExtensionSchema, workspaceRoot?: string, skipLogs?: boolean, useDefault?: TUseDefault) => Promise<TResult>; /** * Get the config for a specific Storm config Extension * * @param extensionName - The name of the config extension * @param options - The options for the config extension * @returns The config for the specified Storm config extension. If the extension does not exist, `undefined` is returned. */ declare const createConfigExtension: <TExtensionName extends keyof StormWorkspaceConfig["extensions"] = keyof StormWorkspaceConfig["extensions"], TExtensionConfig = any, TExtensionSchema extends z.ZodType = z.ZodType>(extensionName: TExtensionName, schema: TExtensionSchema) => TExtensionConfig; /** * Load the config file values for the current Storm workspace into environment variables * * @param workspaceRoot - The root directory of the workspace * @param skipLogs - Skip writing logs to the console * @returns The config for the current Storm workspace, throws an error if the config file could not be loaded */ declare const loadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: boolean) => Promise<StormWorkspaceConfig>; /** * Try to load the config file values for the current Storm workspace into environment variables * * @param workspaceRoot - The root directory of the workspace * @param skipLogs - Skip writing logs to the console * @param useDefault - Whether to use the default config if no config file is found * @returns The config for the current Storm workspace, or undefined if the config file could not be loaded */ declare const tryLoadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: boolean, useDefault?: boolean) => Promise<StormWorkspaceConfig | undefined>; export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };