cli icon indicating copy to clipboard operation
cli copied to clipboard

terminal options as object (`--persist.format`) overwrite the full property of `nx-plugin:autorun` executor options in `package.json`

Open BioPhoton opened this issue 1 year ago • 3 comments

What happened?

When I have a executor option like this:

// target config i project.json

{
    "code-pushup": {
        "executor": "@code-pushup/nx-plugin:autorun",
        "options": {
            "persist" : {
              "outputDir": "my-dir",
              "filename": "my-report" 
            }
      }
    },
}

and a terminal argument that touches that object like this:

nx code-pushup --persist.filename=terminal-report

The logged options executor now runs with are:

{
  "persist" : {
    "filename": "terminal-report" 
  }
}

What would you expect to happen?

I expect the executor options after passinf the --persist.filename=terminal-report to keep the outputDir:

{
  "persist" : {
    "outputDir": "my-dir",
    "filename": "terminal-report" 
  }
}

What steps did you take?

place configuration in shape of an object into schema and terminal args

Code PushUp package version

No response

What operation system are you on?

MacOS

Node version

No response

Related

Potentially related: https://github.com/nrwl/nx/issues/26611

BioPhoton avatar Jul 17 '24 17:07 BioPhoton

I have the opposite expectations :laughing: I wouldn't expect --persist.filename to effectively reset other persist settings.

I think we should have consistent handling of nested property overrides, there shouldn't be one rule for persist and another rule for upload, for example. A reasonable use-case is to define most of the required upload options (server, organization, project) in the config file, but set the secret API key on the command-line using --upload.apiKey=${{ secrets.CP_API_KEY }}. This can only work if we combine the config and CLI arguments.

matejchalk avatar Jul 18 '24 08:07 matejchalk

Adjusted the expected options

vmasek avatar Jul 18 '24 12:07 vmasek

There was a typo that cause confusion. Now it is fixed and we agreed on it.

BioPhoton avatar Jul 18 '24 16:07 BioPhoton