🌳
pt0/deployF/dockerF/getEpCfgF.mts
1import * as _ from 'lodash-es'
6import {
7 epScopes, epScopeToCfgH, allEpScopeOptA, simpleEpScopeOptA,
8 type EpScope, type SimpleEpScope, type EpScopeCfg
12// Re-export types and constants for convenience
13export { epScopes, type EpScope } from './scopesF.mts'
15// Dynamic scope options based on ep type
16export const getEpScopeOptA = (): EpScope[] => {
17 const {usesExplicitEpPtPaths} = getAppCfg()
18 return usesExplicitEpPtPaths ? simpleEpScopeOptA : allEpScopeOptA
21const getEpScopeFromArgv = (): EpScope | undefined => cliArg(epScopeKey) as EpScope | undefined
23export const getEpCfg = ({defaultEpScope = epScopes.alljs}: {defaultEpScope?: EpScope} = {}): EpScopeCfg => {
24 const epScope = getEpScopeFromArgv() || defaultEpScope
25 const epCfg = epScopeToCfgH[epScope]
26 assertDefined(epCfg, {epScope, validScopes: getEpScopeOptA()})
27 return epCfg
30export const printEpScopeHint = ({defaultEpScope = epScopes.alljs}: {defaultEpScope?: EpScope} = {}) => {
31 const activeScope = getEpScopeFromArgv() || defaultEpScope
32 const optA = getEpScopeOptA()
33 const parts = _.map(optA, scope => scope === activeScope ? chalkGreen(scope) : scope)
34 console.log(chalkGray(`--${epScopeKey}=`) + parts.join(chalkGray('|')))