MCPcopy Index your code
hub / github.com/code-pushup/cli / parseCliExecutorOptions

Function parseCliExecutorOptions

packages/nx-plugin/src/executors/cli/utils.ts:35–58  ·  view source on GitHub ↗
(
  options: Partial<CliCommandExecutorOptions>,
  normalizedContext: NormalizedExecutorContext,
)

Source from the content-addressed store, hash-verified

33}
34
35export 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}

Callers 3

utils.int.test.tsFile · 0.85
runCliExecutorFunction · 0.85
utils.unit.test.tsFile · 0.85

Calls 5

globalConfigFunction · 0.85
persistConfigFunction · 0.85
uploadConfigFunction · 0.50

Tested by

no test coverage detected