nrwl / nx-console

Nx Console is the user interface for Nx & Lerna.
https://nx.dev
MIT License
1.31k stars 210 forks source link

Plugin not honoring nx.json default schematic settings #1319

Closed sir-captainmorgan21 closed 2 years ago

sir-captainmorgan21 commented 2 years ago

Current Behavior

We have default nx.json schematic settings defined like so.

...
"generators": {
    "@nrwl/angular:library": {
      "linter": "eslint",
      "unitTestRunner": "jest",
      "prefix": "saj",
      "simpleModuleName": true,
      "publishable": true,
      "directory": "dsm"
    },
    "@nrwl/angular:component": {
      "style": "none",
      "changeDetection": "OnPush",
      "flat": true
    },
    "@nrwl/angular:storybook-configuration": {
      "configureCypress": false,
      "generateCypressSpecs": false,
      "generateStories": true,
      "linter": "eslint",
      "tsConfiguration": true
    },
    "@nrwl/angular:application": {
      "style": "css",
      "linter": "eslint",
      "unitTestRunner": "jest",
      "e2eTestRunner": "none"
    }
  }
...

When using NX Console to run one of these generators, the defaults are populated in the form, but they aren't honored in the actual run of the generator. See below where style is set to none but it is still creating a .css file. Even if I changed it to another option and then back to "none", it will honor the other option (IE: scss), but not honor the "none". If I go remove that configuration in nx.json, the "none" option, along with the other previously defaulted options work fine.

image

Expected Behavior

NX Console run should honor default settings.

Steps to Reproduce

Steps to reproduce are covered in description of bug.

Failure Logs / Images / Videos

Nothing "fails"

Environment

Node : 16.15.0
   OS   : darwin x64
   npm  : 8.5.5

   nx : 14.4.2
   @nrwl/angular : 14.4.2
   @nrwl/cypress : 14.4.2
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.4.2
   @nrwl/eslint-plugin-nx : 14.4.2
   @nrwl/express : Not Found
   @nrwl/jest : 14.4.2
   @nrwl/js : 14.4.2
   @nrwl/linter : 14.4.2
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.4.2
   @nrwl/web : 14.4.2
   @nrwl/workspace : 14.4.2
   typescript : 4.7.3
   ---------------------------------------
   Community plugins:
     @compodoc/compodoc: 1.1.18
     @storybook/angular: 6.5.9
Cammisuli commented 2 years ago

Hmmm.. interesting. I'll take a look as soon as I can

Cammisuli commented 2 years ago

So it looks like this is an issue with the Nx CLI. It's not reading the defaults in the version you have installed (which was the same version Nx Console uses, so it happens here too 😅 ).

Upgrading to the latest version should have this issue fixed.

sir-captainmorgan21 commented 2 years ago

@Cammisuli are you bumping to the latest NX version in NX Console? Do we need to follow suite?

Cammisuli commented 2 years ago

I'll update Nx Console eventually, but you should update on your schedule.

For context, the version that Nx Console uses doesn't matter in this case because at this point we just call the locally installed Nx cli, with the modified values that were in the form. Nx itself didn't read the defaults.