ionic-team / ionic-cli

The Ionic command-line interface
MIT License
2k stars 654 forks source link

ionic generate page inconsistency with Angular #4218

Closed Raven0us closed 4 years ago

Raven0us commented 4 years ago

Pages generated via ionic generate page are created following a different pattern than the one recommended by Angular's https://angular.io/guide/styleguide, which is feature.type.ts

ionic generate page test Expected output:

- test-page.module.ts
- test-page.component.html
- test-page.component.scss
- test-page.component.spec.ts
- test-page.component.ts

Ionic output:

- test.module.ts
- test.page.html
- test.page.scss
- test.page.spec.ts
- test.page.ts

When using Refactor in IDEs like WebStorm, the entire component & related files get renamed to test-page.component.extension.

I find this default behaviour confusing, perhaps a configurable template would be ideal.

Ionic:

   Ionic CLI                     : 5.4.6
   Ionic Framework               : @ionic/angular 4.11.1
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.13.0
   npm    : 6.13.0
mhartington commented 4 years ago

This more just a preference here. The actual file generated should matter too much. But based on feedback from the Angular team and other devs, the .page. notation is totally fine.

Since we make the mental notation that these are components tied to a route, we call them pages.

I don't think this is too much of an issue here, as the style guide is just that, a guide. It's not rules to be followed exactly.

WhatsThatItsPat commented 4 years ago

@Raven0us here are some old discussions about these conventions: