nstudio / xplat

Cross-platform (xplat) tools for Nx workspaces.
MIT License
369 stars 52 forks source link

[Bug] nx generate @nstudio/angular:component with Electron target freezes #285

Open s0l4r opened 2 years ago

s0l4r commented 2 years ago

Possible bug detected..

When running this command all is ok (NS and Web):

nx generate @nstudio/angular:component --name=product --createBase --platforms=nativescript,web--dry-run

CREATE libs/xplat/features/src/lib/ui/base/product.base-component.ts
CREATE libs/xplat/nativescript/features/src/lib/ui/components/product/product.component.html
CREATE libs/xplat/nativescript/features/src/lib/ui/components/product/product.component.ts
CREATE libs/xplat/web/features/src/lib/ui/components/product/product.component.html
CREATE libs/xplat/web/features/src/lib/ui/components/product/product.component.ts
UPDATE libs/xplat/features/src/lib/ui/base/index.ts
UPDATE libs/xplat/nativescript/features/src/lib/ui/components/index.ts
UPDATE libs/xplat/web/features/src/lib/ui/components/index.ts
UPDATE angular.json

But when running this with Electron as well, it seems to get stuck in an endless loop somewhere (CPU goes to 100%):

nx generate @nstudio/angular:component --name=product --createBase --platforms=nativescript,web,electron --dry-run

The problems seems to be in the target platform Electron:

nx generate @nstudio/angular:component --name=product --createBase --platforms=electron --dry-run

My packages and versions:

├── @angular-devkit/build-angular@13.0.3
├── @angular-eslint/eslint-plugin-template@13.0.1
├── @angular-eslint/eslint-plugin@13.0.1
├── @angular-eslint/template-parser@13.0.1
├── @angular/animations@13.0.2
├── @angular/cli@13.0.3
├── @angular/common@13.0.2
├── @angular/compiler-cli@13.0.2
├── @angular/compiler@13.0.2
├── @angular/core@13.0.2
├── @angular/forms@13.0.2
├── @angular/language-service@13.0.2
├── @angular/platform-browser-dynamic@13.0.2
├── @angular/platform-browser@13.0.2
├── @angular/router@13.0.2
├── @eversec/xplat-scss@1.0.0 -> ./libs/xplat/scss/src
├── @nativescript/angular@12.2.0
├── @nativescript/core@8.1.5
├── @nativescript/eslint-plugin@0.0.4
├── @nativescript/types@8.0.1
├── @nativescript/webpack@5.0.1
├── @ngtools/webpack@12.2.13
├── @ngx-translate/core@13.0.0
├── @ngx-translate/http-loader@6.0.0
├── @nrwl/angular@13.2.3
├── @nrwl/cli@13.3.0-beta.3
├── @nrwl/cypress@13.3.0-beta.3
├── @nrwl/eslint-plugin-nx@13.3.0-beta.3
├── @nrwl/jest@13.3.0-beta.3
├── @nrwl/linter@13.3.0-beta.3
├── @nrwl/tao@13.3.0-beta.3
├── @nrwl/web@13.3.0-beta.3
├── @nrwl/workspace@13.3.0-beta.3
├── @nstudio/angular@13.0.1
├── @nstudio/electron-angular@13.0.1
├── @nstudio/electron@13.0.1
├── @nstudio/nativescript-angular@13.0.1
├── @nstudio/nativescript@13.0.1
├── @nstudio/schematics@13.0.1
├── @nstudio/web-angular@13.0.1
├── @nstudio/web@13.0.1
├── @nstudio/xplat@13.0.1
├── @parcel/node-addon-api@ extraneous
├── @types/jest@27.0.2
├── @types/node@14.14.33
├── @typescript-eslint/eslint-plugin@5.3.1
├── @typescript-eslint/parser@5.3.1
├── cypress@8.7.0
├── electron-builder@22.14.5
├── electron-installer-dmg@3.0.0
├── electron-packager@15.2.0
├── electron-rebuild@2.3.5
├── electron-reload@1.5.0
├── electron-store@7.0.3
├── electron-updater@4.3.10
├── electron@12.2.3
├── eslint-config-prettier@8.1.0
├── eslint-plugin-cypress@2.12.1
├── eslint@8.2.0
├── jest-preset-angular@10.0.1
├── jest@27.2.3
├── nativescript-ngx-fonticon@7.0.0
├── nativescript-theme-core@1.0.6
├── npm-run-all@4.1.5
├── prettier@2.5.0
├── rxjs@7.4.0
├── sass@1.43.4
├── ts-jest@27.0.5
├── tslib@2.3.1
├── typescript@4.4.4
├── wait-on@5.2.2
└── zone.js@0.11.4
s0l4r commented 2 years ago

After playing around a bit with Xplat, my understanding is that this should not be possible to run at all, since the web app is running with a target in Electron. Maybe it's a good idea to disable that platform target when generating features and components in Xplat.

NathanWalker commented 2 years ago

Thanks for this note, correct - the component would be generated for the web app since Electron target is just a shell for any web app target in the workspace. Good idea to disable the electron platform when using component generator.