-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(angular): ng add @ionic/angular in standalone projects (#28523)
Issue number: Resolves #28514 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When using the `@ionic/angular` schematic in an Angular 17 project (`ng add @ionic/angular`), developers will receive an error preventing the schematic from running. Additionally, the previous implementations of the schematic are out of sync with the current state of the Ionic starters: - `variables.css` is empty and missing Ionic's defaults - `ionic.config.json` is not created - Schematic does not have support for module vs. standalone projects. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - `ng add @ionic/angular` works with Angular 17 projects - `ng add @ionic/angular` has fallback behavior for Angular 16 projects using `AppModule` - Schematics now includes the proper `variables.css` from Ionic starters - Ionicons assets will no longer be copied when being added to a standalone project - Refactors a majority of the implementation to use the utilities that come directly from `@angular-devkit/schematics` and `@schematics/angular`. - Sets the `@ionic/angular-toolkit` CLI configuration and schematics configuration in the `angular.json` - Creates missing `ionic.config.json` ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev-build: `7.5.5-dev.11700239837.1925bbdb` To test this PR: 1. Install Angular CLI v17 - `npm install -g @angular/cli@17` 2. Create a new project - `ng new angular-17` 3. Use the dev-build: - `ng add @ionic/[email protected]` 4. Confirm the prompts 5. Validate that `provideIonicAngular({})` is added to the `app.config.ts` 6. Validate that `ionic.config.json` was created 7. Validate that `angular.json` was updated with the `@ionic/angular-devkit` configurations Now verify legacy behavior: 1. Install Angular CLI v16 - `npm install -g @angular/cli@16` 2. Create a new project - `ng new angular-16` 3. Use the dev-build - `ng add @ionic/[email protected]` 4. Confirm the prompts 5. Validate that `IonicModule.forRoot({})` is added to the `app.module.ts` 8. Validate the ionicons glob pattern is added to the `angular.json` 9. Validate the `ionic.config.json` was created 10. Validate the `angular.json` was updated with the `@ionic/angular-devkit` configurations
- Loading branch information
1 parent
388d19e
commit c07312e
Showing
10 changed files
with
3,230 additions
and
1,042 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.