mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
## Summary - add a public `defineStackConfig` helper and `StackConfig` type for nested config authoring - emit helper-based nested config files from the CLI and local emulator - update type coverage and e2e expectations for the new `stack.config` format ## Testing - pnpm --filter ./packages/stack-shared typecheck - pnpm --filter ./packages/stack-cli typecheck - pnpm --filter ./apps/backend typecheck - pnpm --filter ./apps/e2e typecheck <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Type-safe configuration API with compile-time validation * New config rendering utility for producing typed config files * Public local-emulator settings and a public helper to detect emulator mode * Added --overwrite flag for config pull * **Improvements** * Stronger validation and clearer errors for invalid or conflicting config shapes * Config output now includes explicit TypeScript typing * **Tests** * Added and strengthened tests for config authoring, rendering, CLI behavior, and emulator flows <!-- end of auto-generated comment: release notes by coderabbit.ai -->
23 lines
870 B
TypeScript
23 lines
870 B
TypeScript
import type { BranchConfigNormalizedOverride } from "./config/schema";
|
|
|
|
export type StackConfig = BranchConfigNormalizedOverride;
|
|
|
|
type StrictConfigShape<Actual, Expected> =
|
|
Expected extends readonly unknown[]
|
|
? Actual extends readonly unknown[]
|
|
? { [K in keyof Actual]: K extends keyof Expected ? StrictConfigShape<Actual[K], Expected[K]> : never }
|
|
: Actual
|
|
: Expected extends object
|
|
? Actual extends object
|
|
? Exclude<keyof Actual, keyof Expected> extends never
|
|
? { [K in keyof Actual]: K extends keyof Expected ? StrictConfigShape<Actual[K], Expected[K]> : never }
|
|
: never
|
|
: Actual
|
|
: Actual;
|
|
|
|
type StrictStackConfig<T extends StackConfig> = T & StrictConfigShape<T, StackConfig>;
|
|
|
|
export function defineStackConfig<const T extends StackConfig>(config: StrictStackConfig<T>): T {
|
|
return config;
|
|
}
|