nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.29k stars 2.32k forks source link

StandaloneConfig improvements #8474

Closed the-ult closed 2 years ago

the-ult commented 2 years ago

Description

It would be nice if the recommended standaloneConfig would be enabled by default when running npx create-nx-workspace Or add it as an options/configuration e.g.

npx create-nx-workspace --standalone-config or/and as part of the questions

npx create-nx-workspace --preset=angular
Need to install the following packages:
  create-nx-workspace
Ok to proceed? (y)
✔ Workspace name (e.g., org name)     · my-space
✔ Application name                    · my-app
✔ Default stylesheet format           · scss
✔ Use standalone configuration Y/n . Yes.   <=================
✔ Use Nx Cloud? (It's free and doesn't require registration.) · No

Set default configuration

After running nx g @nrwl/workspace:convert-to-nx-project --all newly created apps/libs do not have a standaloneConfig by default. It would be nice if these would be set as default in the nx.json

"generators": {
    "@nrwl/angular:application": {
      ...
      "standaloneConfig": true
    },
    "@nrwl/angular:library": {
      ...
      "standaloneConfig": true
    },

With Angular update angular.json version number

When running the convert command you will get the error:

nx g @nrwl/workspace:convert-to-nx-project --all

NX Only workspaces with version 2+ support project.json files.
To upgrade change the version number at the top of /angular.json and run 'nx format'.

v2+ Required

It would be nice if the version number would automatically be updated to 2, instead of throwing an error

Related

Coly010 commented 2 years ago

It's in discussion at the moment :) We'll provide more feedback when we know more

Coly010 commented 2 years ago

New Angular workspaces will be using standalone config and it's on our internal roadmap to address existing workspaces. I'll close this issue for now :)

Thanks for raising it!

the-ult commented 2 years ago

Another thing which might be interesting to address as well is that sometimes errors occur, when running nx commands:

❯ nx cache clear    
Unable to read workspace file '.../.../angular.json': Invalid format version detected - Expected:[ 1 ] Found: [ 2 ]

❯ nx lint
Unable to read workspace file '/.../.../angular.json': Invalid format version detected - Expected:[ 1 ] Found: [ 2 ]
❯ pnpm nx test   
> .....
> nx "test"

Unable to read workspace file '/.../.../.../angular.json': Invalid format version detected - Expected:[ 1 ] Found: [ 2 ]
 ELIFECYCLE  Command failed with exit code 1.
Den-dp commented 2 years ago

@the-ult experiencing the same. Any known solutions?

the-ult commented 2 years ago

No, not yet

GrumpyMeow commented 1 year ago

It worked for me... Should be added to the nx.json file:

"generators": {
    "@nrwl/angular:application": {
      "style": "scss",
      "linter": "eslint",
      "unitTestRunner": "jest",
      "e2eTestRunner": "cypress"
    },
    "@nrwl/angular:library": {
      "linter": "eslint",
      "unitTestRunner": "jest",
      "standaloneConfig": true,
      "setParserOptionsProject": true
    },
    "@nrwl/angular:component": {
      "style": "scss"
    }
  },
github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.