( options: Partial<CliCommandExecutorOptions>, normalizedContext: NormalizedExecutorContext, )
| 33 | } |
| 34 | |
| 35 | export function parseCliExecutorOptions( |
| 36 | options: Partial<CliCommandExecutorOptions>, |
| 37 | normalizedContext: NormalizedExecutorContext, |
| 38 | ): CliCommandExecutorOptions { |
| 39 | const { projectPrefix, persist, upload, command, output } = options; |
| 40 | const needsUploadParams = |
| 41 | command === 'upload' || command === 'autorun' || command === undefined; |
| 42 | const uploadCfg = uploadConfig( |
| 43 | { projectPrefix, ...upload }, |
| 44 | normalizedContext, |
| 45 | ); |
| 46 | const hasApiToken = uploadCfg?.apiKey != null; |
| 47 | return { |
| 48 | ...parsePrintConfigExecutorOptions(options), |
| 49 | ...parseCliExecutorOnlyOptions(options), |
| 50 | ...globalConfig(options, normalizedContext), |
| 51 | ...(output ? { output } : {}), |
| 52 | persist: persistConfig({ projectPrefix, ...persist }, normalizedContext), |
| 53 | // @TODO This is a hack to avoid validation errors of upload config for commands that dont need it. |
| 54 | // Fix: use utils and execute the core logic directly |
| 55 | // Blocked by Nx plugins can't compile to es6 |
| 56 | ...(needsUploadParams && hasApiToken ? { upload: uploadCfg } : {}), |
| 57 | }; |
| 58 | } |
no test coverage detected