mirror of
https://github.com/Lifeforge-app/lifeforge.git
synced 2026-07-01 08:16:35 +00:00
refactor: extract shared configs & federation packages; rename log/server-utils
- Create @lifeforge/configs package with shared client/module Vite configs and the `@` path alias resolver extracted from client/vite.config.ts - Create @lifeforge/federation package with module loading, federation provider, and route utilities moved out of the client app - Rename packages/lifeforge-log → packages/log - Rename packages/lifeforge-server-utils → packages/server-utils - Update all imports, tsconfig references, Dockerfiles, and workspace scripts to reflect the new package names and locations
This commit is contained in:
16
packages/federation/src/api/createForgeModuleClient.ts
Normal file
16
packages/federation/src/api/createForgeModuleClient.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createForgeProxy } from '@lifeforge/shared'
|
||||
import type { ProxyTree } from '@lifeforge/shared'
|
||||
import type { ModuleConfig } from '../interfaces/module_config.types'
|
||||
|
||||
/**
|
||||
* Wraps a module configuration and automatically appends a type-safe `forgeAPI` proxy client
|
||||
* resolved dynamically from the module's contract.
|
||||
*/
|
||||
export default function createForgeModuleClient<T extends ModuleConfig>(
|
||||
config: T
|
||||
): T & { forgeAPI: T['contract'] extends undefined ? undefined : ProxyTree<T['contract']> } {
|
||||
return {
|
||||
...config,
|
||||
forgeAPI: config.contract ? (createForgeProxy(config.contract) as any) : undefined
|
||||
} as any
|
||||
}
|
||||
Reference in New Issue
Block a user