diff --git a/docs/api-reports/packages/config-tools/api-report.md b/docs/api-reports/packages/config-tools/api-report.md deleted file mode 100644 index bec9c2e7a..000000000 --- a/docs/api-reports/packages/config-tools/api-report.md +++ /dev/null @@ -1,371 +0,0 @@ -## API Report File for "@storm-software/config-tools" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts -import { Infer } from "@decs/typeschema"; -import { InferIn } from "@decs/typeschema"; -import { Schema } from "@decs/typeschema"; -import { TypeSchema } from "@decs/typeschema"; -import * as z from "zod"; - -// @public (undocumented) -type ColorConfig = Infer; -export { ColorConfig }; -export { ColorConfig as ColorConfig_alias_1 }; - -// @public (undocumented) -type ColorConfigInput = InferIn; -export { ColorConfigInput }; -export { ColorConfigInput as ColorConfigInput_alias_1 }; - -// @public -const ColorConfigSchema: z.ZodObject< - { - primary: z.ZodDefault; - background: z.ZodDefault; - success: z.ZodDefault; - info: z.ZodDefault; - warning: z.ZodDefault; - error: z.ZodDefault; - fatal: z.ZodDefault; - }, - "strip", - z.ZodTypeAny, - { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - }, - { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - } ->; -export { ColorConfigSchema }; -export { ColorConfigSchema as ColorConfigSchema_alias_1 }; - -// @public -const createConfigExtension: ( - schema: Schema, - extensionName: string -) => Promise; -export { createConfigExtension }; -export { createConfigExtension as createConfigExtension_alias_1 }; - -// @public -const createStormConfig: < - TModuleName extends string = string, - TModuleConfig = any ->( - schema?: Schema, - moduleName?: TModuleName -) => Promise>; -export { createStormConfig }; -export { createStormConfig as createStormConfig_alias_1 }; - -// @public -const DefaultColorConfig: ColorConfig; -export { DefaultColorConfig }; -export { DefaultColorConfig as DefaultColorConfig_alias_1 }; -export { DefaultColorConfig as DefaultColorConfig_alias_2 }; - -// @public -const DefaultStormConfig: Omit; -export { DefaultStormConfig }; -export { DefaultStormConfig as DefaultStormConfig_alias_1 }; -export { DefaultStormConfig as DefaultStormConfig_alias_2 }; - -// @public -const getConfigEnv: () => Partial; -export { getConfigEnv }; -export { getConfigEnv as getConfigEnv_alias_1 }; -export { getConfigEnv as getConfigEnv_alias_2 }; - -// @public -const getConfigFile: () => Promise>; -export { getConfigFile }; -export { getConfigFile as getConfigFile_alias_1 }; -export { getConfigFile as getConfigFile_alias_2 }; - -// @public -const getDefaultConfig: (config?: Partial) => Promise; -export { getDefaultConfig }; -export { getDefaultConfig as getDefaultConfig_alias_1 }; -export { getDefaultConfig as getDefaultConfig_alias_2 }; - -// @public -const getExtensionEnv: < - TConfig extends Record = Record ->( - extensionName: string -) => TConfig; -export { getExtensionEnv }; -export { getExtensionEnv as getExtensionEnv_alias_1 }; -export { getExtensionEnv as getExtensionEnv_alias_2 }; - -// @public -const setConfigEnv: (config: StormConfig) => void; -export { setConfigEnv }; -export { setConfigEnv as setConfigEnv_alias_1 }; -export { setConfigEnv as setConfigEnv_alias_2 }; - -// @public -const setExtensionEnv: < - TConfig extends Record = Record ->( - extensionName: string, - extension: TConfig -) => void; -export { setExtensionEnv }; -export { setExtensionEnv as setExtensionEnv_alias_1 }; -export { setExtensionEnv as setExtensionEnv_alias_2 }; - -// @public (undocumented) -type StormConfig< - TModuleName extends string = string, - TModuleConfig = any -> = TStormConfig & { - modules: Record & { - [moduleName in TModuleName]: TModuleConfig; - }; -}; -export { StormConfig }; -export { StormConfig as StormConfig_alias_1 }; - -// @public (undocumented) -type StormConfigInput = InferIn; -export { StormConfigInput }; -export { StormConfigInput as StormConfigInput_alias_1 }; - -// @public -const StormConfigSchema: z.ZodObject< - { - name: z.ZodString; - namespace: z.ZodDefault; - organization: z.ZodDefault; - repository: z.ZodOptional; - license: z.ZodDefault; - homepage: z.ZodDefault; - branch: z.ZodDefault; - preMajor: z.ZodDefault; - owner: z.ZodDefault; - worker: z.ZodDefault; - env: z.ZodDefault>; - ci: z.ZodDefault; - workspaceRoot: z.ZodString; - packageDirectory: z.ZodOptional; - buildDirectory: z.ZodOptional; - runtimeDirectory: z.ZodDefault; - runtimeVersion: z.ZodDefault; - timezone: z.ZodDefault; - locale: z.ZodDefault; - configFile: z.ZodDefault>; - colors: z.ZodObject< - { - primary: z.ZodDefault; - background: z.ZodDefault; - success: z.ZodDefault; - info: z.ZodDefault; - warning: z.ZodDefault; - error: z.ZodDefault; - fatal: z.ZodDefault; - }, - "strip", - z.ZodTypeAny, - { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - }, - { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - } - >; - extensions: z.ZodRecord; - }, - "strip", - z.ZodTypeAny, - { - name?: string; - namespace?: string; - organization?: string; - repository?: string; - license?: string; - homepage?: string; - branch?: string; - preMajor?: boolean; - owner?: string; - worker?: string; - env?: "development" | "staging" | "production"; - ci?: boolean; - workspaceRoot?: string; - packageDirectory?: string; - buildDirectory?: string; - runtimeDirectory?: string; - runtimeVersion?: string; - timezone?: string; - locale?: string; - configFile?: string; - colors?: { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - }; - extensions?: Record; - }, - { - name?: string; - namespace?: string; - organization?: string; - repository?: string; - license?: string; - homepage?: string; - branch?: string; - preMajor?: boolean; - owner?: string; - worker?: string; - env?: "development" | "staging" | "production"; - ci?: boolean; - workspaceRoot?: string; - packageDirectory?: string; - buildDirectory?: string; - runtimeDirectory?: string; - runtimeVersion?: string; - timezone?: string; - locale?: string; - configFile?: string; - colors?: { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - }; - extensions?: Record; - } ->; -export { StormConfigSchema }; -export { StormConfigSchema as StormConfigSchema_alias_1 }; - -// @public (undocumented) -const wrapped_ColorConfig: TypeSchema< - { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - }, - { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - } ->; -export { wrapped_ColorConfig }; -export { wrapped_ColorConfig as wrapped_ColorConfig_alias_1 }; - -// @public (undocumented) -const wrapped_StormConfig: TypeSchema< - { - name?: string; - namespace?: string; - organization?: string; - repository?: string; - license?: string; - homepage?: string; - branch?: string; - preMajor?: boolean; - owner?: string; - worker?: string; - env?: "development" | "staging" | "production"; - ci?: boolean; - workspaceRoot?: string; - packageDirectory?: string; - buildDirectory?: string; - runtimeDirectory?: string; - runtimeVersion?: string; - timezone?: string; - locale?: string; - configFile?: string; - colors?: { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - }; - extensions?: Record; - }, - { - name?: string; - namespace?: string; - organization?: string; - repository?: string; - license?: string; - homepage?: string; - branch?: string; - preMajor?: boolean; - owner?: string; - worker?: string; - env?: "development" | "staging" | "production"; - ci?: boolean; - workspaceRoot?: string; - packageDirectory?: string; - buildDirectory?: string; - runtimeDirectory?: string; - runtimeVersion?: string; - timezone?: string; - locale?: string; - configFile?: string; - colors?: { - primary?: string; - background?: string; - success?: string; - info?: string; - warning?: string; - error?: string; - fatal?: string; - }; - extensions?: Record; - } ->; -export { wrapped_StormConfig }; -export { wrapped_StormConfig as wrapped_StormConfig_alias_1 }; - -// (No @packageDocumentation comment for this package) -``` diff --git a/docs/api-reports/packages/config-tools/documents-model.api.json b/docs/api-reports/packages/config-tools/documents-model.api.json deleted file mode 100644 index ae593b328..000000000 --- a/docs/api-reports/packages/config-tools/documents-model.api.json +++ /dev/null @@ -1,1606 +0,0 @@ -{ - "metadata": { - "toolPackage": "@microsoft/api-extractor", - "toolVersion": "7.38.3", - "schemaVersion": 1011, - "oldestForwardsCompatibleVersion": 1001, - "tsdocConfig": { - "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", - "noStandardTags": true, - "tagDefinitions": [ - { - "tagName": "@alpha", - "syntaxKind": "modifier" - }, - { - "tagName": "@beta", - "syntaxKind": "modifier" - }, - { - "tagName": "@defaultValue", - "syntaxKind": "block" - }, - { - "tagName": "@decorator", - "syntaxKind": "block", - "allowMultiple": true - }, - { - "tagName": "@deprecated", - "syntaxKind": "block" - }, - { - "tagName": "@eventProperty", - "syntaxKind": "modifier" - }, - { - "tagName": "@example", - "syntaxKind": "block", - "allowMultiple": true - }, - { - "tagName": "@experimental", - "syntaxKind": "modifier" - }, - { - "tagName": "@inheritDoc", - "syntaxKind": "inline" - }, - { - "tagName": "@internal", - "syntaxKind": "modifier" - }, - { - "tagName": "@label", - "syntaxKind": "inline" - }, - { - "tagName": "@link", - "syntaxKind": "inline", - "allowMultiple": true - }, - { - "tagName": "@override", - "syntaxKind": "modifier" - }, - { - "tagName": "@packageDocumentation", - "syntaxKind": "modifier" - }, - { - "tagName": "@param", - "syntaxKind": "block", - "allowMultiple": true - }, - { - "tagName": "@privateRemarks", - "syntaxKind": "block" - }, - { - "tagName": "@public", - "syntaxKind": "modifier" - }, - { - "tagName": "@readonly", - "syntaxKind": "modifier" - }, - { - "tagName": "@remarks", - "syntaxKind": "block" - }, - { - "tagName": "@returns", - "syntaxKind": "block" - }, - { - "tagName": "@sealed", - "syntaxKind": "modifier" - }, - { - "tagName": "@see", - "syntaxKind": "block" - }, - { - "tagName": "@throws", - "syntaxKind": "block", - "allowMultiple": true - }, - { - "tagName": "@typeParam", - "syntaxKind": "block", - "allowMultiple": true - }, - { - "tagName": "@virtual", - "syntaxKind": "modifier" - }, - { - "tagName": "@betaDocumentation", - "syntaxKind": "modifier" - }, - { - "tagName": "@internalRemarks", - "syntaxKind": "block" - }, - { - "tagName": "@preapproved", - "syntaxKind": "modifier" - } - ], - "supportForTags": { - "@alpha": true, - "@beta": true, - "@defaultValue": true, - "@decorator": true, - "@deprecated": true, - "@eventProperty": true, - "@example": true, - "@experimental": true, - "@inheritDoc": true, - "@internal": true, - "@label": true, - "@link": true, - "@override": true, - "@packageDocumentation": true, - "@param": true, - "@privateRemarks": true, - "@public": true, - "@readonly": true, - "@remarks": true, - "@returns": true, - "@sealed": true, - "@see": true, - "@throws": true, - "@typeParam": true, - "@virtual": true, - "@betaDocumentation": true, - "@internalRemarks": true, - "@preapproved": true - }, - "reportUnsupportedHtmlElements": false - } - }, - "kind": "Package", - "canonicalReference": "@storm-software/config-tools!", - "docComment": "", - "name": "@storm-software/config-tools", - "preserveMemberOrder": false, - "members": [ - { - "kind": "EntryPoint", - "canonicalReference": "@storm-software/config-tools!", - "name": "", - "preserveMemberOrder": false, - "members": [ - { - "kind": "TypeAlias", - "canonicalReference": "@storm-software/config-tools!ColorConfig:type", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "export type ColorConfig = " - }, - { - "kind": "Reference", - "text": "Infer", - "canonicalReference": "!unknown" - }, - { - "kind": "Content", - "text": "" - }, - { - "kind": "Content", - "text": ";" - } - ], - "fileUrlPath": "packages/config-tools/src/types.ts", - "releaseTag": "Public", - "name": "ColorConfig", - "typeTokenRange": { - "startIndex": 1, - "endIndex": 5 - } - }, - { - "kind": "TypeAlias", - "canonicalReference": "@storm-software/config-tools!ColorConfigInput:type", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "export type ColorConfigInput = " - }, - { - "kind": "Reference", - "text": "InferIn", - "canonicalReference": "!unknown" - }, - { - "kind": "Content", - "text": "" - }, - { - "kind": "Content", - "text": ";" - } - ], - "fileUrlPath": "packages/config-tools/src/types.ts", - "releaseTag": "Public", - "name": "ColorConfigInput", - "typeTokenRange": { - "startIndex": 1, - "endIndex": 5 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!ColorConfigSchema:var", - "docComment": "/**\n * Storm theme color config values used for styling various workspace elements\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "ColorConfigSchema: " - }, - { - "kind": "Reference", - "text": "z.ZodObject", - "canonicalReference": "!z.ZodObject:type" - }, - { - "kind": "Content", - "text": "<{\n primary: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n background: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n success: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n info: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n warning: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n error: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n fatal: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n}, \"strip\", " - }, - { - "kind": "Reference", - "text": "z.ZodTypeAny", - "canonicalReference": "!z.ZodTypeAny:type" - }, - { - "kind": "Content", - "text": ", {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n}, {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n}>" - } - ], - "fileUrlPath": "packages/config-tools/src/schema.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "ColorConfigSchema", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 33 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!createConfigExtension:var", - "docComment": "/**\n * Get the config for a specific Storm config Extension\n *\n * @param moduleName - The name of the config module\n *\n * @param options - The options for the config module\n *\n * @returns The config for the specified Storm config module. If the module does not exist, `undefined` is returned.\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "createConfigExtension: " - }, - { - "kind": "Content", - "text": "(schema: " - }, - { - "kind": "Reference", - "text": "Schema", - "canonicalReference": "!unknown" - }, - { - "kind": "Content", - "text": ", extensionName: string) => " - }, - { - "kind": "Reference", - "text": "Promise", - "canonicalReference": "!Promise:interface" - }, - { - "kind": "Content", - "text": "" - } - ], - "fileUrlPath": "packages/config-tools/src/create-storm-config.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "createConfigExtension", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 6 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!createStormConfig:var", - "docComment": "/**\n * Get the config for the current Storm workspace\n *\n * @returns The config for the current Storm workspace\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "createStormConfig: " - }, - { - "kind": "Content", - "text": "(schema?: " - }, - { - "kind": "Reference", - "text": "Schema", - "canonicalReference": "!unknown" - }, - { - "kind": "Content", - "text": ", moduleName?: TModuleName) => " - }, - { - "kind": "Reference", - "text": "Promise", - "canonicalReference": "!Promise:interface" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "StormConfig", - "canonicalReference": "@storm-software/config-tools!StormConfig:type" - }, - { - "kind": "Content", - "text": ">" - } - ], - "fileUrlPath": "packages/config-tools/src/create-storm-config.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "createStormConfig", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 8 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!DefaultColorConfig:var", - "docComment": "/**\n * Storm theme config values used for styling various workspace elements\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "DefaultColorConfig: " - }, - { - "kind": "Reference", - "text": "ColorConfig", - "canonicalReference": "@storm-software/config-tools!ColorConfig:type" - } - ], - "fileUrlPath": "packages/config-tools/src/utilities/get-default-config.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "DefaultColorConfig", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 2 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!DefaultStormConfig:var", - "docComment": "/**\n * Storm Workspace config values used during various dev-ops processes\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "DefaultStormConfig: " - }, - { - "kind": "Reference", - "text": "Omit", - "canonicalReference": "!Omit:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "StormConfig", - "canonicalReference": "@storm-software/config-tools!StormConfig:type" - }, - { - "kind": "Content", - "text": ", \"name\">" - } - ], - "fileUrlPath": "packages/config-tools/src/utilities/get-default-config.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "DefaultStormConfig", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 5 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!getConfigEnv:var", - "docComment": "/**\n * Get the config for the current Storm workspace\n *\n * @returns The config for the current Storm workspace from environment variables\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "getConfigEnv: " - }, - { - "kind": "Content", - "text": "() => " - }, - { - "kind": "Reference", - "text": "Partial", - "canonicalReference": "!Partial:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "StormConfig", - "canonicalReference": "@storm-software/config-tools!StormConfig:type" - }, - { - "kind": "Content", - "text": ">" - } - ], - "fileUrlPath": "packages/config-tools/src/env/get-env.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "getConfigEnv", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 6 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!getConfigFile:var", - "docComment": "/**\n * Get the config file for the current Storm workspace\n *\n * @returns The config file for the current Storm workspace\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "getConfigFile: " - }, - { - "kind": "Content", - "text": "() => " - }, - { - "kind": "Reference", - "text": "Promise", - "canonicalReference": "!Promise:interface" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "Partial", - "canonicalReference": "!Partial:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "StormConfigInput", - "canonicalReference": "@storm-software/config-tools!StormConfigInput:type" - }, - { - "kind": "Content", - "text": ">>" - } - ], - "fileUrlPath": "packages/config-tools/src/config-file/get-config-file.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "getConfigFile", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 8 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!getDefaultConfig:var", - "docComment": "/**\n * Get the default Storm config values used during various dev-ops processes\n *\n * @returns The default Storm config values\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "getDefaultConfig: " - }, - { - "kind": "Content", - "text": "(config?: " - }, - { - "kind": "Reference", - "text": "Partial", - "canonicalReference": "!Partial:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "StormConfig", - "canonicalReference": "@storm-software/config-tools!StormConfig:type" - }, - { - "kind": "Content", - "text": ">) => " - }, - { - "kind": "Reference", - "text": "Promise", - "canonicalReference": "!Promise:interface" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "StormConfig", - "canonicalReference": "@storm-software/config-tools!StormConfig:type" - }, - { - "kind": "Content", - "text": ">" - } - ], - "fileUrlPath": "packages/config-tools/src/utilities/get-default-config.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "getDefaultConfig", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 10 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!getExtensionEnv:var", - "docComment": "/**\n * Get the config for an extension module of Storm workspace from environment variables\n *\n * @param extensionName - The name of the extension module\n *\n * @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "getExtensionEnv: " - }, - { - "kind": "Content", - "text": " = " - }, - { - "kind": "Reference", - "text": "Record", - "canonicalReference": "!Record:type" - }, - { - "kind": "Content", - "text": ">(extensionName: string) => TConfig" - } - ], - "fileUrlPath": "packages/config-tools/src/env/get-env.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "getExtensionEnv", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 6 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!setConfigEnv:var", - "docComment": "/**\n * Get the config for the current Storm workspace\n *\n * @returns The config for the current Storm workspace from environment variables\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "setConfigEnv: " - }, - { - "kind": "Content", - "text": "(config: " - }, - { - "kind": "Reference", - "text": "StormConfig", - "canonicalReference": "@storm-software/config-tools!StormConfig:type" - }, - { - "kind": "Content", - "text": ") => void" - } - ], - "fileUrlPath": "packages/config-tools/src/env/set-env.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "setConfigEnv", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 4 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!setExtensionEnv:var", - "docComment": "/**\n * Get the config for an extension module of Storm workspace from environment variables\n *\n * @param extensionName - The name of the extension module\n *\n * @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "setExtensionEnv: " - }, - { - "kind": "Content", - "text": " = " - }, - { - "kind": "Reference", - "text": "Record", - "canonicalReference": "!Record:type" - }, - { - "kind": "Content", - "text": ">(extensionName: string, extension: TConfig) => void" - } - ], - "fileUrlPath": "packages/config-tools/src/env/set-env.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "setExtensionEnv", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 6 - } - }, - { - "kind": "TypeAlias", - "canonicalReference": "@storm-software/config-tools!StormConfig:type", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "export type StormConfig = " - }, - { - "kind": "Reference", - "text": "TStormConfig", - "canonicalReference": "@storm-software/config-tools!~TStormConfig:type" - }, - { - "kind": "Content", - "text": " & {\n modules: " - }, - { - "kind": "Reference", - "text": "Record", - "canonicalReference": "!Record:type" - }, - { - "kind": "Content", - "text": " & {\n [moduleName in TModuleName]: TModuleConfig;\n };\n}" - }, - { - "kind": "Content", - "text": ";" - } - ], - "fileUrlPath": "packages/config-tools/src/types.ts", - "releaseTag": "Public", - "name": "StormConfig", - "typeParameters": [ - { - "typeParameterName": "TModuleName", - "constraintTokenRange": { - "startIndex": 1, - "endIndex": 2 - }, - "defaultTypeTokenRange": { - "startIndex": 3, - "endIndex": 4 - } - }, - { - "typeParameterName": "TModuleConfig", - "constraintTokenRange": { - "startIndex": 0, - "endIndex": 0 - }, - "defaultTypeTokenRange": { - "startIndex": 5, - "endIndex": 6 - } - } - ], - "typeTokenRange": { - "startIndex": 7, - "endIndex": 11 - } - }, - { - "kind": "TypeAlias", - "canonicalReference": "@storm-software/config-tools!StormConfigInput:type", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "export type StormConfigInput = " - }, - { - "kind": "Reference", - "text": "InferIn", - "canonicalReference": "!unknown" - }, - { - "kind": "Content", - "text": "" - }, - { - "kind": "Content", - "text": ";" - } - ], - "fileUrlPath": "packages/config-tools/src/types.ts", - "releaseTag": "Public", - "name": "StormConfigInput", - "typeTokenRange": { - "startIndex": 1, - "endIndex": 5 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!StormConfigSchema:var", - "docComment": "/**\n * Storm Workspace config values used during various dev-ops processes. It represents the config of the entire monorepo.\n */\n", - "excerptTokens": [ - { - "kind": "Content", - "text": "StormConfigSchema: " - }, - { - "kind": "Reference", - "text": "z.ZodObject", - "canonicalReference": "!z.ZodObject:type" - }, - { - "kind": "Content", - "text": "<{\n name: " - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ";\n namespace: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n organization: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n repository: " - }, - { - "kind": "Reference", - "text": "z.ZodOptional", - "canonicalReference": "!z.ZodOptional:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n license: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n homepage: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n branch: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n preMajor: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodBoolean", - "canonicalReference": "!z.ZodBoolean:type" - }, - { - "kind": "Content", - "text": ">;\n owner: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n worker: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n env: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodEnum", - "canonicalReference": "!z.ZodEnum:type" - }, - { - "kind": "Content", - "text": "<[\"development\", \"staging\", \"production\"]>>;\n ci: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodBoolean", - "canonicalReference": "!z.ZodBoolean:type" - }, - { - "kind": "Content", - "text": ">;\n workspaceRoot: " - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ";\n packageDirectory: " - }, - { - "kind": "Reference", - "text": "z.ZodOptional", - "canonicalReference": "!z.ZodOptional:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n buildDirectory: " - }, - { - "kind": "Reference", - "text": "z.ZodOptional", - "canonicalReference": "!z.ZodOptional:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n runtimeDirectory: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n runtimeVersion: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n timezone: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n locale: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n configFile: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodNullable", - "canonicalReference": "!z.ZodNullable:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">>;\n colors: " - }, - { - "kind": "Reference", - "text": "z.ZodObject", - "canonicalReference": "!z.ZodObject:type" - }, - { - "kind": "Content", - "text": "<{\n primary: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n background: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n success: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n info: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n warning: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n error: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n fatal: " - }, - { - "kind": "Reference", - "text": "z.ZodDefault", - "canonicalReference": "!z.ZodDefault:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ">;\n }, \"strip\", " - }, - { - "kind": "Reference", - "text": "z.ZodTypeAny", - "canonicalReference": "!z.ZodTypeAny:type" - }, - { - "kind": "Content", - "text": ", {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n }, {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n }>;\n extensions: " - }, - { - "kind": "Reference", - "text": "z.ZodRecord", - "canonicalReference": "!z.ZodRecord:type" - }, - { - "kind": "Content", - "text": "<" - }, - { - "kind": "Reference", - "text": "z.ZodString", - "canonicalReference": "!z.ZodString:type" - }, - { - "kind": "Content", - "text": ", " - }, - { - "kind": "Reference", - "text": "z.ZodAny", - "canonicalReference": "!z.ZodAny:type" - }, - { - "kind": "Content", - "text": ">;\n}, \"strip\", " - }, - { - "kind": "Reference", - "text": "z.ZodTypeAny", - "canonicalReference": "!z.ZodTypeAny:type" - }, - { - "kind": "Content", - "text": ", {\n name?: string;\n namespace?: string;\n organization?: string;\n repository?: string;\n license?: string;\n homepage?: string;\n branch?: string;\n preMajor?: boolean;\n owner?: string;\n worker?: string;\n env?: \"development\" | \"staging\" | \"production\";\n ci?: boolean;\n workspaceRoot?: string;\n packageDirectory?: string;\n buildDirectory?: string;\n runtimeDirectory?: string;\n runtimeVersion?: string;\n timezone?: string;\n locale?: string;\n configFile?: string;\n colors?: {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n };\n extensions?: " - }, - { - "kind": "Reference", - "text": "Record", - "canonicalReference": "!Record:type" - }, - { - "kind": "Content", - "text": ";\n}, {\n name?: string;\n namespace?: string;\n organization?: string;\n repository?: string;\n license?: string;\n homepage?: string;\n branch?: string;\n preMajor?: boolean;\n owner?: string;\n worker?: string;\n env?: \"development\" | \"staging\" | \"production\";\n ci?: boolean;\n workspaceRoot?: string;\n packageDirectory?: string;\n buildDirectory?: string;\n runtimeDirectory?: string;\n runtimeVersion?: string;\n timezone?: string;\n locale?: string;\n configFile?: string;\n colors?: {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n };\n extensions?: " - }, - { - "kind": "Reference", - "text": "Record", - "canonicalReference": "!Record:type" - }, - { - "kind": "Content", - "text": ";\n}>" - } - ], - "fileUrlPath": "packages/config-tools/src/schema.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "StormConfigSchema", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 125 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!wrapped_ColorConfig:var", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "wrapped_ColorConfig: " - }, - { - "kind": "Content", - "text": "import(\"@decs/typeschema\").TypeSchema<{\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n}, {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n}>" - } - ], - "fileUrlPath": "packages/config-tools/src/types.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "wrapped_ColorConfig", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 2 - } - }, - { - "kind": "Variable", - "canonicalReference": "@storm-software/config-tools!wrapped_StormConfig:var", - "docComment": "", - "excerptTokens": [ - { - "kind": "Content", - "text": "wrapped_StormConfig: " - }, - { - "kind": "Content", - "text": "import(\"@decs/typeschema\").TypeSchema<{\n name?: string;\n namespace?: string;\n organization?: string;\n repository?: string;\n license?: string;\n homepage?: string;\n branch?: string;\n preMajor?: boolean;\n owner?: string;\n worker?: string;\n env?: \"development\" | \"staging\" | \"production\";\n ci?: boolean;\n workspaceRoot?: string;\n packageDirectory?: string;\n buildDirectory?: string;\n runtimeDirectory?: string;\n runtimeVersion?: string;\n timezone?: string;\n locale?: string;\n configFile?: string;\n colors?: {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n };\n extensions?: " - }, - { - "kind": "Reference", - "text": "Record", - "canonicalReference": "!Record:type" - }, - { - "kind": "Content", - "text": ";\n}, {\n name?: string;\n namespace?: string;\n organization?: string;\n repository?: string;\n license?: string;\n homepage?: string;\n branch?: string;\n preMajor?: boolean;\n owner?: string;\n worker?: string;\n env?: \"development\" | \"staging\" | \"production\";\n ci?: boolean;\n workspaceRoot?: string;\n packageDirectory?: string;\n buildDirectory?: string;\n runtimeDirectory?: string;\n runtimeVersion?: string;\n timezone?: string;\n locale?: string;\n configFile?: string;\n colors?: {\n primary?: string;\n background?: string;\n success?: string;\n info?: string;\n warning?: string;\n error?: string;\n fatal?: string;\n };\n extensions?: " - }, - { - "kind": "Reference", - "text": "Record", - "canonicalReference": "!Record:type" - }, - { - "kind": "Content", - "text": ";\n}>" - } - ], - "fileUrlPath": "packages/config-tools/src/types.ts", - "isReadonly": true, - "releaseTag": "Public", - "name": "wrapped_StormConfig", - "variableTypeTokenRange": { - "startIndex": 1, - "endIndex": 6 - } - } - ] - } - ] -} diff --git a/packages/config-tools/package.json b/packages/config-tools/package.json index c0a5a2251..c6dbd9e19 100644 --- a/packages/config-tools/package.json +++ b/packages/config-tools/package.json @@ -9,7 +9,6 @@ "directory": "packages/config-tools" }, "dependencies": { - "@decs/typeschema": "^0.12.1", "cosmiconfig": "^9.0.0", "zod": "^3.22.4" }, diff --git a/packages/config-tools/project.json b/packages/config-tools/project.json index 2fd02584a..5acaba1a5 100644 --- a/packages/config-tools/project.json +++ b/packages/config-tools/project.json @@ -17,18 +17,10 @@ "deleteOutputPath": true, "bundle": true, "thirdParty": true, - "skipTypeCheck": true, + "skipTypeCheck": false, "metafile": true, "minify": false, "format": ["cjs"], - "external": [ - "ow", - "valibot", - "fp-ts/Either", - "@effect/schema", - "@effect/data", - "@deepkit/type" - ], "esbuildOptions": { "outExtension": { ".js": ".js" diff --git a/packages/config-tools/src/create-storm-config.ts b/packages/config-tools/src/create-storm-config.ts index e62044c21..46c701934 100644 --- a/packages/config-tools/src/create-storm-config.ts +++ b/packages/config-tools/src/create-storm-config.ts @@ -1,6 +1,7 @@ -import { Schema, wrap } from "@decs/typeschema"; +import * as z from "zod"; import { getConfigEnv, getExtensionEnv } from "./env/get-env"; -import { StormConfig, wrapped_StormConfig } from "./types"; +import { StormConfigSchema } from "./schema"; +import { StormConfig } from "./types"; const _extension_cache = new WeakMap<{ extensionName: string }, any>(); let _static_cache: StormConfig | undefined = undefined; @@ -10,19 +11,22 @@ let _static_cache: StormConfig | undefined = undefined; * * @returns The config for the current Storm workspace */ -export const createStormConfig = async < - TExtensionName extends string = string, - TExtensionConfig = any +export const createStormConfig = < + TExtensionName extends + keyof StormConfig["extensions"] = keyof StormConfig["extensions"], + TExtensionConfig extends Record = Record, + TExtensionSchema extends + z.ZodType = z.ZodType >( extensionName?: TExtensionName, - schema?: Schema -): Promise> => { + schema?: TExtensionSchema +): StormConfig => { let result!: StormConfig; if (!_static_cache) { let config = getConfigEnv() as StormConfig & { [extensionName in TExtensionName]: TExtensionConfig; }; - result = (await wrapped_StormConfig.parse(config)) as StormConfig< + result = StormConfigSchema.parse(config) as StormConfig< TExtensionName, TExtensionConfig >; @@ -31,8 +35,14 @@ export const createStormConfig = async < } if (schema && extensionName) { - const extensionConfig = await createConfigExtension(extensionName, schema); - result.extensions[extensionName] = extensionConfig; + result.extensions = { + ...result.extensions, + [extensionName]: createConfigExtension< + TExtensionName, + TExtensionConfig, + TExtensionSchema + >(extensionName, schema) + }; } _static_cache = result; @@ -46,10 +56,16 @@ export const createStormConfig = async < * @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. */ -export const createConfigExtension = async ( - extensionName: string, - schema: Schema -): Promise => { +export const createConfigExtension = < + TExtensionName extends + keyof StormConfig["extensions"] = keyof StormConfig["extensions"], + TExtensionConfig extends Record = Record, + TExtensionSchema extends + z.ZodType = z.ZodType +>( + extensionName: TExtensionName, + schema: TExtensionSchema +): TExtensionConfig => { const extension_cache_key = { extensionName }; if (_extension_cache.has(extension_cache_key)) { return _extension_cache.get(extension_cache_key) as TExtensionConfig; @@ -57,7 +73,7 @@ export const createConfigExtension = async ( let extension = getExtensionEnv(extensionName); if (schema) { - extension = await wrap(schema).parse(extension); + extension = schema.parse(extension); } _extension_cache.set(extension_cache_key, extension); diff --git a/packages/config-tools/src/schema.ts b/packages/config-tools/src/schema.ts index 76d3e72f8..a86472d84 100644 --- a/packages/config-tools/src/schema.ts +++ b/packages/config-tools/src/schema.ts @@ -187,6 +187,7 @@ export const StormConfigSchema = z ), extensions: z .record(z.any()) + .default({}) .describe("Configuration of each used extension") }) .describe( diff --git a/packages/config-tools/src/types.ts b/packages/config-tools/src/types.ts index d8021fd80..76c4d2030 100644 --- a/packages/config-tools/src/types.ts +++ b/packages/config-tools/src/types.ts @@ -1,21 +1,23 @@ -import { wrap, type Infer, type InferIn } from "@decs/typeschema"; +import * as z from "zod"; import { ColorConfigSchema, StormConfigSchema } from "./schema"; -export type ColorConfig = Infer; -export type ColorConfigInput = InferIn; -export const wrapped_ColorConfig = wrap(ColorConfigSchema); +export type ColorConfig = z.infer; +export type ColorConfigInput = z.input; -type TStormConfig = Infer; -export type StormConfigInput = InferIn; -export const wrapped_StormConfig = wrap(StormConfigSchema); +type TStormConfig = z.infer; +export type StormConfigInput = z.input; export type StormConfig< - TExtensionName extends string = string, - TExtensionConfig = any + TExtensionName extends + keyof TStormConfig["extensions"] = keyof TStormConfig["extensions"], + TExtensionConfig extends + TStormConfig["extensions"][TExtensionName] = TStormConfig["extensions"][TExtensionName] > = TStormConfig & { - extensions: Record & { - [extensionName in TExtensionName]: TExtensionConfig; - }; + extensions: + | (TStormConfig["extensions"] & { + [extensionName in TExtensionName]: TExtensionConfig; + }) + | {}; }; export type LogLevel = 0 | 10 | 20 | 30 | 40 | 60 | 70; diff --git a/packages/config-tools/src/utilities/get-default-config.ts b/packages/config-tools/src/utilities/get-default-config.ts index 57bb5929a..1b689a291 100644 --- a/packages/config-tools/src/utilities/get-default-config.ts +++ b/packages/config-tools/src/utilities/get-default-config.ts @@ -1,7 +1,7 @@ -import { existsSync } from "fs"; -import { readFile } from "fs/promises"; +import { existsSync, readFileSync } from "fs"; import { findWorkspaceRoot } from "nx/src/utils/find-workspace-root.js"; import { join } from "path"; +import { StormConfigSchema } from "../schema"; import { ColorConfig, StormConfig } from "../types"; /** @@ -37,9 +37,9 @@ export const DefaultStormConfig: Omit = { * * @returns The default Storm config values */ -export const getDefaultConfig = async ( +export const getDefaultConfig = ( config: Partial = {} -): Promise => { +): StormConfig => { let name = "storm-workspace"; let namespace = "storm-software"; let repository = "https://github.com/storm-software/storm-stack"; @@ -49,7 +49,7 @@ export const getDefaultConfig = async ( const workspaceRoot = getWorkspaceRoot() ?? process.cwd(); if (existsSync(join(workspaceRoot, "package.json"))) { - const file = await readFile(join(workspaceRoot, "package.json"), { + const file = readFileSync(join(workspaceRoot, "package.json"), { encoding: "utf-8" }); if (file) { @@ -63,7 +63,7 @@ export const getDefaultConfig = async ( } } - return { + return StormConfigSchema.parse({ ...(DefaultStormConfig as Required), colors: { ...DefaultColorConfig, ...config }, workspaceRoot, @@ -77,12 +77,12 @@ export const getDefaultConfig = async ( env: "production", branch: "main", organization: "storm-software", - extensions: {}, ci: true, configFile: join(workspaceRoot, "storm.config.js"), runtimeVersion: "1.0.0", + extensions: {}, ...config - }; + }) as StormConfig; }; const getWorkspaceRoot = () => { diff --git a/packages/workspace-tools/src/base/base-executor.ts b/packages/workspace-tools/src/base/base-executor.ts index f5cf9f6c3..376b1e6d1 100644 --- a/packages/workspace-tools/src/base/base-executor.ts +++ b/packages/workspace-tools/src/base/base-executor.ts @@ -79,7 +79,7 @@ export const withRunExecutor = let config: StormConfig | undefined; if (!executorOptions.skipReadingConfig) { - config = await getDefaultConfig({ + config = getDefaultConfig({ ...(await getConfigFile()), ...getConfigEnv() }); diff --git a/packages/workspace-tools/src/base/base-generator.ts b/packages/workspace-tools/src/base/base-generator.ts index 06146a9a0..0d385ed0d 100644 --- a/packages/workspace-tools/src/base/base-generator.ts +++ b/packages/workspace-tools/src/base/base-generator.ts @@ -60,12 +60,9 @@ export const withRunGenerator = let config: any | undefined; if (!generatorOptions.skipReadingConfig) { - const configFile = await getConfigFile(); - const configEnv = getConfigEnv(); - - config = await getDefaultConfig({ - ...configFile, - ...configEnv + config = getDefaultConfig({ + ...(await getConfigFile()), + ...getConfigEnv() }); setConfigEnv(config); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ebed2a349..a3afa6fdb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -158,9 +158,6 @@ importers: packages/config-tools: dependencies: - "@decs/typeschema": - specifier: ^0.12.1 - version: 0.12.1(zod@3.22.4) cosmiconfig: specifier: ^9.0.0 version: 9.0.0(typescript@5.2.2) @@ -2900,65 +2897,6 @@ packages: "@jridgewell/trace-mapping": 0.3.9 dev: false - /@decs/typeschema@0.12.1(zod@3.22.4): - resolution: - { - integrity: sha512-PhoCbaJ6T+9EfvUkemgYVnNfLmLoP2+Aa5yvQ3sIzH4fmIgDEFPGSRPuaTO04c99sqLeKuhHEY+WLzNubGABOA== - } - peerDependencies: - "@deepkit/type": ^1.0.1-alpha.97 - "@effect/data": ^0.18.6 - "@effect/schema": ^0.36.5 - "@sinclair/typebox": ^0.31.15 - ajv: ^8.12.0 - arktype: ^1.0.21-alpha - fp-ts: ^2.16.1 - io-ts: ^2.2.20 - joi: ^17.10.2 - ow: ^0.28.2 - runtypes: ^6.7.0 - superstruct: ^1.0.3 - valibot: ^0.17.0 - vite: ^4.4.10 - yup: ^1.2.0 - zod: ^3.22.2 - peerDependenciesMeta: - "@deepkit/type": - optional: true - "@effect/data": - optional: true - "@effect/schema": - optional: true - "@sinclair/typebox": - optional: true - ajv: - optional: true - arktype: - optional: true - fp-ts: - optional: true - io-ts: - optional: true - joi: - optional: true - ow: - optional: true - runtypes: - optional: true - superstruct: - optional: true - valibot: - optional: true - vite: - optional: true - yup: - optional: true - zod: - optional: true - dependencies: - zod: 3.22.4 - dev: false - /@esbuild/android-arm64@0.19.5: resolution: {