From c84c6f78599cbbd65a172fcfb9c1dd109bd9a262 Mon Sep 17 00:00:00 2001 From: Ron Netzer Date: Sun, 6 Mar 2022 21:17:05 +0200 Subject: [PATCH] fix(utils): configuration is not parsed from args & args name format (#36) --- packages/nx-distributed-task/src/app/nx.ts | 12 ++++++++---- packages/utils/src/lib/inputs.ts | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/nx-distributed-task/src/app/nx.ts b/packages/nx-distributed-task/src/app/nx.ts index f5d4024b..ee1abb6d 100644 --- a/packages/nx-distributed-task/src/app/nx.ts +++ b/packages/nx-distributed-task/src/app/nx.ts @@ -1,12 +1,14 @@ +import * as _Exec from '@actions/exec'; import type { context as Context } from '@actions/github'; +import { getPackageManagerCommand, getPackageManagerVersion } from '@nrwl/tao/src/shared/package-manager'; +import { NxArgs } from '@nrwl/workspace/src/command-line/utils'; +import { names } from '@nrwl/devkit/src/utils/names'; import { Exec } from '@e-square/utils/exec'; import { BaseInputs } from '@e-square/utils/inputs'; import { debug, group, logger } from '@e-square/utils/logger'; -import * as _Exec from '@actions/exec'; + import { Inputs } from './inputs'; -import { getPackageManagerCommand, getPackageManagerVersion } from '@nrwl/tao/src/shared/package-manager'; -import { NxArgs } from '@nrwl/workspace/src/command-line/utils'; export async function assertNxInstalled(exec: Exec) { debug(`Checking existence of nx`); @@ -26,7 +28,9 @@ export async function nxCommand(nxCommand: string, target: string, exec: Exec, a .withCommand(`${command} -p @nrwl/cli nx ${nxCommand}`) .withArgs( `--target=${target}`, - ...Object.entries(args).map(([k, v]) => (typeof v === 'boolean' && v ? `--${k}` : `--${k}=${v}`)) + ...Object.entries(args).map(([k, v]) => + typeof v === 'boolean' && v ? `--${names(k).fileName}` : `--${names(k).fileName}=${v}` + ) ) .build(); diff --git a/packages/utils/src/lib/inputs.ts b/packages/utils/src/lib/inputs.ts index e238e6f2..a3365dab 100644 --- a/packages/utils/src/lib/inputs.ts +++ b/packages/utils/src/lib/inputs.ts @@ -25,7 +25,9 @@ export function getArgsInput( mode: Parameters[1] = 'print-affected', options?: Core.InputOptions ): NxArgs { - const args = getStringArrayInput(core, 'args', /[= ]/g, options); + const args = getStringArrayInput(core, 'args', /[= ]/g, options).map((arg) => + arg === '-c' ? '--configuration' : arg + ); return ( splitArgsIntoNxArgsAndOverrides({ _: args, $0: '' }, mode, { printWarnings: false,