Open History to see the last commit
1import type { SerializedOptions } from '@tanstack/cta-engine'
2
3export type ServerEnvironment = {
4 projectPath: string
5 mode: 'add' | 'setup'
6 options?: SerializedOptions
7 addOns?: Array<string>
8 forcedRouterMode?: string
9 forcedAddOns?: Array<string>
10 registry?: string
11}
12
13const serverEnvironment: ServerEnvironment = {
14 projectPath: '',
15 mode: 'add',
16 options: {} as SerializedOptions,
17 addOns: [],
18 forcedRouterMode: undefined,
19 forcedAddOns: undefined,
20 registry: undefined,
21}
22
23export function setServerEnvironment(options: Partial<ServerEnvironment>) {
24 Object.assign(serverEnvironment, options)
25}
26
27export const getProjectPath = () => serverEnvironment.projectPath
28
29export const getApplicationMode = () => serverEnvironment.mode
30
31export const getProjectOptions = () => serverEnvironment.options!
32
33export const getForcedRouterMode = () => serverEnvironment.forcedRouterMode
34
35export const getForcedAddOns = () => serverEnvironment.forcedAddOns || []
36
37export const getRegistry = () => serverEnvironment.registry