From 9f00d079e11b3f0d9626e626ef0d8a7a53bdaeec Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Wed, 29 Nov 2023 10:37:39 -0500 Subject: [PATCH] feat: use Ionic standalone components --- ..._name@dasherize__.__type@dasherize__.spec.ts.template | 9 +++++---- .../__name@dasherize__.__type@dasherize__.ts.template | 3 ++- .../__name@dasherize__.page.ts | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template b/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template index 3eb9f76..13e9faf 100644 --- a/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template +++ b/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.spec.ts.template @@ -1,5 +1,5 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { IonicModule } from '@ionic/angular'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';<% if(!standalone) {%> +import { IonicModule } from '@ionic/angular';<%} %> import { <%= classify(name) %><%= classify(type) %> } from './<%= dasherize(name) %>.<%= dasherize(type) %>'; @@ -8,9 +8,10 @@ describe('<%= classify(name) %><%= classify(type) %>', () => { let fixture: ComponentFixture<<%= classify(name) %><%= classify(type) %>>; beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ + TestBed.configureTestingModule({<% if(!standalone) {%> declarations: [ <%= classify(name) %><%= classify(type) %> ], - imports: [IonicModule.forRoot()] + imports: [IonicModule.forRoot()]<%} %><% if(standalone) {%> + imports: [<%= classify(name) %><%= classify(type) %>],<%} %> }).compileComponents(); fixture = TestBed.createComponent(<%= classify(name) %><%= classify(type) %>); diff --git a/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template b/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template index 6803a8c..7272132 100644 --- a/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template +++ b/packages/schematics/component/files/__name@dasherize@if-flat__/__name@dasherize__.__type@dasherize__.ts.template @@ -3,7 +3,8 @@ import { Component, OnInit } from '@angular/core'; @Component({ selector: '<%= selector %>', templateUrl: './<%= dasherize(name) %>.<%= dasherize(type) %>.html', - styleUrls: ['./<%= dasherize(name) %>.<%= dasherize(type) %>.<%= styleext %>'], + styleUrls: ['./<%= dasherize(name) %>.<%= dasherize(type) %>.<%= styleext %>'],<% if(standalone) {%> + standalone: true,<%} %> }) export class <%= classify(name) %><%= classify(type) %> implements OnInit { diff --git a/packages/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.ts b/packages/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.ts index 48394e0..b3b3412 100644 --- a/packages/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.ts +++ b/packages/schematics/page/files/__name@dasherize@if-flat__/__name@dasherize__.page.ts @@ -2,14 +2,14 @@ import { Component, OnInit } from '@angular/core';<% if(routePath) { %> import { ActivatedRoute, Params } from '@angular/router';<% } %><% if(standalone) {%> import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; -import { IonicModule } from '@ionic/angular';<%} %> +import { IonContent, IonHeader, IonTitle, IonToolbar } from '@ionic/angular/standalone';<%} %> @Component({ selector: '<%= selector %>', templateUrl: './<%= dasherize(name) %>.page.html', styleUrls: ['./<%= dasherize(name) %>.page.<%= styleext %>'],<% if(standalone) {%> standalone: true, - imports: [IonicModule, CommonModule, FormsModule]<%} %> + imports: [IonContent, IonHeader, IonTitle, IonToolbar, CommonModule, FormsModule]<%} %> }) export class <%= classify(name) %>Page implements OnInit {<% if(routePath) { %>