nxtend-team / nxtend

MIT License
189 stars 42 forks source link

Monorepo issue with angular.json #615

Open Zankel-Engineering opened 2 years ago

Zankel-Engineering commented 2 years ago

Hello gentleman,

I currently face an issue in my nx monorepo with an Ionic 6 project and your library. As soon as I run:

nx run text-macht-mobile-app:add:ios

He complains about the version in the angular.json which is 2 at the moment and he expects 1. The compiler says:

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

When I change the version nothing works. Any ideas how to fix that?

nx "report"

NX Report complete - copy this into the issue template

Node : 16.13.2 OS : darwin x64 npm : 8.5.2

nx : 13.7.3 @nrwl/angular : 13.7.3 @nrwl/cli : 13.7.3 @nrwl/cypress : 13.7.3 @nrwl/detox : undefined @nrwl/devkit : 13.7.3 @nrwl/eslint-plugin-nx : 13.7.3 @nrwl/express : undefined @nrwl/jest : 13.7.3 @nrwl/js : undefined @nrwl/linter : 13.7.3 @nrwl/nest : 13.7.3 @nrwl/next : undefined @nrwl/node : 13.7.3 @nrwl/nx-cloud : 13.1.2 @nrwl/react : undefined @nrwl/react-native : undefined @nrwl/schematics : undefined @nrwl/storybook : 13.7.3 @nrwl/tao : 13.7.3 @nrwl/web : undefined @nrwl/workspace : 13.7.3 typescript : 4.5.5 rxjs : 7.4.0

Community plugins: @angular-architects/module-federation: 13.0.1 @angular/animations: 13.2.1 @angular/common: 13.2.1 @angular/compiler: 13.2.1 @angular/core: 13.2.1 @angular/forms: 13.2.1 @angular/platform-browser: 13.2.1 @angular/platform-browser-dynamic: 13.2.1 @angular/router: 13.2.1 @ionic/angular: 6.0.8 @ngrx/store: 13.0.2 @angular-devkit/build-angular: 13.2.2 @angular/cli: 13.2.2 @angular/compiler-cli: 13.2.1 @angular/language-service: 13.2.1 @nxtend/capacitor: 13.0.0 @nxtend/ionic-angular: 13.0.0

Help would be greatly appreciated.

Thanks,

Sebastian

Zankel-Engineering commented 2 years ago

No comments? Why you don't mention that it is not compatible with newest version of NX šŸ‘Ž ! I have to set up the whole workspace now again!

Zankel-Engineering commented 2 years ago

Not possible to set that plugin up working with nx workspace and Angular 13 šŸ‘Ž šŸ‘Ž šŸ‘Ž . Outdated.

mrambow commented 2 years ago

Having the same issue :)

the incompatibility isn't with angular 13 or nx 13, it's with the nx standalone config.. as described here: https://nx.dev/getting-started/nx-and-angular#angularjson -- don't do that šŸ˜…

angular, ionic, capacitor and nearly all other plugins require a single angular.json (or workspace.json), with the standalone config there isn't any and nx / nxtend need to wrap the schematic to generate a single angular.json..

you could wait until it's wrapped correctly or just go back to one single angular.json to rule them all ;)

Zankel-Engineering commented 2 years ago

Nx 13 only works with schema version 2 isn't it? They even have a schematic to format with nx format.

mrambow commented 2 years ago

Working even without version 2, but I only used build and run with 13 šŸ¤”

Zankel-Engineering commented 2 years ago

What version is written in your angular.json? Does your project have project.json files for the apps and libs? Cause then it only works with schema version 2 in the angular.json, as far as I was able to see. I recreated the whole workspace to try to make it run, but ran into plenty dependency issues, when I go back to nx version 12.x.

mrambow commented 2 years ago

You're right, the standalone config (project.json in every lib/app) only works with angular.json version 2, as described by NX in the link I shared.

But you can just use the old angular.json(version 1 with all config in the root angular json) with NX 13.

Zankel-Engineering commented 2 years ago

Hi man but I tried to move everything from project.json's into angular.json and changed the version and ran into plenty of errors. Can you explain what I did wrong? Thanks

Markus-Ende commented 2 years ago

No comments? Why you don't mention that it is not compatible with newest version of NX šŸ‘Ž ! I have to set up the whole workspace now again!

No you don't. You could also just don't use it or create a PR to fix. It's open source.