Skip to content

Commit f2cfdcc

Browse files
author
John Doe
committed
refactor: wip
1 parent a35f427 commit f2cfdcc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

packages/nx-plugin/src/executors/cli/executor.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { ExecutorContext } from '@nx/devkit';
22
import { executeProcess } from '../../internal/execute-process.js';
3+
import { normalizeContext } from '../internal/context.js';
34
import type { AutorunCommandExecutorOptions } from './schema.js';
5+
import { mergeExecutorOptions, parseAutorunExecutorOptions } from './utils.js';
46

57
export type ExecutorOutput = {
68
success: boolean;
@@ -11,10 +13,19 @@ export type ExecutorOutput = {
1113
/* eslint-disable max-lines-per-function */
1214
export default async function runAutorunExecutor(
1315
terminalAndExecutorOptions: AutorunCommandExecutorOptions,
14-
{ cwd }: ExecutorContext,
16+
context: ExecutorContext,
1517
): Promise<ExecutorOutput> {
1618
const { logger, stringifyError, objectToCliArgs, formatCommand } =
1719
await import('@code-pushup/utils');
20+
const normalizedContext = normalizeContext(context);
21+
const mergedOptions = mergeExecutorOptions(
22+
context.target?.options,
23+
terminalAndExecutorOptions,
24+
);
25+
const cliArgumentObject = parseAutorunExecutorOptions(
26+
mergedOptions,
27+
normalizedContext,
28+
);
1829
const {
1930
dryRun,
2031
verbose,
@@ -34,7 +45,7 @@ export default async function runAutorunExecutor(
3445
const binString = `${command} ${positionals.join(' ')} ${args.join(' ')}`;
3546
const formattedBinString = formatCommand(binString, {
3647
env: executorEnvVariables,
37-
cwd,
48+
cwd: context.cwd,
3849
});
3950

4051
if (dryRun) {
@@ -44,7 +55,7 @@ export default async function runAutorunExecutor(
4455
await executeProcess({
4556
command,
4657
args: [...positionals, ...args],
47-
...(cwd ? { cwd } : {}),
58+
...(context.cwd ? { cwd: context.cwd } : {}),
4859
});
4960
} catch (error) {
5061
logger.error(stringifyError(error));
@@ -55,7 +66,6 @@ export default async function runAutorunExecutor(
5566
};
5667
}
5768
}
58-
5969
return {
6070
success: true,
6171
command: formattedBinString,

0 commit comments

Comments
 (0)