Skip to content
Source
Sign inSign up
TanStack/cli
Open History to see the last commit

server-environment.ts

41 lines1.1 KB

1import type { SerializedOptions } from '@tanstack/create'
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 showDeploymentOptions?: boolean
13​
14const serverEnvironment: ServerEnvironment = {
15 projectPath: '',
16 mode: 'add',
17 options: {} as SerializedOptions,
18 addOns: [],
19 forcedRouterMode: undefined,
20 forcedAddOns: undefined,
21 registry: undefined,
22 showDeploymentOptions: false,
24​
25export function setServerEnvironment(options: Partial<ServerEnvironment>) {
26 Object.assign(serverEnvironment, options)
28​
29export const getShowDeploymentOptions = () => serverEnvironment.showDeploymentOptions
30​
31export const getProjectPath = () => serverEnvironment.projectPath
32​
33export const getApplicationMode = () => serverEnvironment.mode
34​
35export const getProjectOptions = () => serverEnvironment.options!
36​
37export const getForcedRouterMode = () => serverEnvironment.forcedRouterMode
38​
39export const getForcedAddOns = () => serverEnvironment.forcedAddOns || []
40​
41export const getRegistry = () => serverEnvironment.registry