nx icon indicating copy to clipboard operation
nx copied to clipboard

forwardAllArgs behaviour seems to default to "false" now

Open ajwootto opened this issue 2 years ago • 0 comments

Current Behavior

In previous versions of Nx, I was able to execute commands via nx affected or nx run which would pass along any "unknown" arguments to the underlying command.

For example, I was doing this: nx affected --base=origin/main~1 --target=npm-publish --otp=3534543

where the target was defined like this:

 "npm-publish": {
      "executor": "@nrwl/workspace:run-commands",
      "options": {
        "command": "../../../scripts/npm-safe-publish.sh \"@devcycle/nodejs-server-sdk\"",
        "cwd": "dist/sdk/nodejs"
      }
    }

Theotp argument would get passed along to the npm-safe-publish.sh script.

In the latest version of Nx I am using, the flag is no longer passed. Setting forwardAllArgs to true in the command definition fixes the problem. As far as I can understand, this should be the default behaviour and I can't find any documentation saying that this might have changed.

Expected Behavior

I would expect forwardAllArgs to continue being treated as true by default. If this default was deliberately changed, I would expect a migration or something to maintain the old behaviour for existing projects.

Steps to Reproduce

Here is the PR made to our open-source Nx repo which restored our ability to call this command with the flag. https://github.com/DevCycleHQ/js-sdks/pull/271

Environment

  Node : 16.17.0
   OS   : darwin arm64
   yarn : 3.2.0

   nx : 14.7.5
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.7.5
   @nrwl/detox : 14.7.5
   @nrwl/devkit : 14.7.5
   @nrwl/eslint-plugin-nx : 14.7.5
   @nrwl/express : Not Found
   @nrwl/jest : 14.7.5
   @nrwl/js : 14.7.5
   @nrwl/linter : 14.7.5
   @nrwl/nest : Not Found
   @nrwl/next : 14.7.5
   @nrwl/node : 14.7.5
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.7.5
   @nrwl/react-native : 14.7.5
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.7.5
   @nrwl/web : 14.7.5
   @nrwl/workspace : 14.7.5
   typescript : 4.8.3
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:

ajwootto avatar Sep 21 '22 21:09 ajwootto