From 6c800e47472957758c622eb0d1d27897975bdc8f Mon Sep 17 00:00:00 2001 From: Emmanuel Roux <1926413+EmmanuelRoux@users.noreply.github.com> Date: Sun, 31 Mar 2024 13:37:51 +0200 Subject: [PATCH] fix: upgrade schematics to non-deprecated module names --- projects/demo/src/app/app.component.html | 2 +- projects/demo/src/app/app.component.spec.ts | 10 +++------- projects/demo/src/app/app.module.ts | 6 +++--- .../track-event-component.component.spec.ts | 4 ++-- .../track-event-template.component.spec.ts | 4 ++-- .../track-page-view-without-router.component.spec.ts | 4 ++-- .../track-simple-click-event.component.spec.ts | 4 ++-- .../ngx-matomo-client/core/tracker/configuration.ts | 2 +- .../ngx-matomo-client/schematics/ng-add/index.ts | 12 +++++++----- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/projects/demo/src/app/app.component.html b/projects/demo/src/app/app.component.html index 14f8a34..2a95a40 100644 --- a/projects/demo/src/app/app.component.html +++ b/projects/demo/src/app/app.component.html @@ -7,7 +7,7 @@
// app.module.ts - NgxMatomoTrackerModule.forRoot({{'{'}} + MatomoModule.forRoot({{'{'}} siteId: 'YOUR_MATOMO_SITE_ID_HERE', trackerUrl: 'YOUR_MATOMO_URL_HERE', })diff --git a/projects/demo/src/app/app.component.spec.ts b/projects/demo/src/app/app.component.spec.ts index 51e917c..f3ee5d2 100644 --- a/projects/demo/src/app/app.component.spec.ts +++ b/projects/demo/src/app/app.component.spec.ts @@ -1,11 +1,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; -import { - MatomoConfiguration, - NgxMatomoRouterModule, - NgxMatomoTrackerModule, -} from 'ngx-matomo-client'; +import { MatomoConfiguration, MatomoRouterModule, MatomoModule } from 'ngx-matomo-client'; import { AppComponent } from './app.component'; describe('AppComponent', () => { @@ -13,11 +9,11 @@ describe('AppComponent', () => { await TestBed.configureTestingModule({ imports: [ RouterTestingModule, - NgxMatomoTrackerModule.forRoot({ + MatomoModule.forRoot({ trackerUrl: '', siteId: '', } as MatomoConfiguration), - NgxMatomoRouterModule, + MatomoRouterModule, ], declarations: [AppComponent], schemas: [NO_ERRORS_SCHEMA], diff --git a/projects/demo/src/app/app.module.ts b/projects/demo/src/app/app.module.ts index c0b1af0..16b1107 100644 --- a/projects/demo/src/app/app.module.ts +++ b/projects/demo/src/app/app.module.ts @@ -7,7 +7,7 @@ import { MatInputModule } from '@angular/material/input'; import { MatTabsModule } from '@angular/material/tabs'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { NgxMatomoRouterModule, NgxMatomoTrackerModule } from 'ngx-matomo-client'; +import { MatomoRouterModule, MatomoModule } from 'ngx-matomo-client'; import { environment } from '../environments/environment'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @@ -31,11 +31,11 @@ import { TrackSimpleClickEventComponent } from './track-simple-click-event/track BrowserAnimationsModule, FormsModule, AppRoutingModule, - NgxMatomoTrackerModule.forRoot({ + MatomoModule.forRoot({ siteId: environment.matomoSiteId, trackerUrl: environment.matomoTrackerUrl, }), - NgxMatomoRouterModule.forRoot({ + MatomoRouterModule.forRoot({ exclude: /without-router$/, }), MatTabsModule, diff --git a/projects/demo/src/app/track-event-component/track-event-component.component.spec.ts b/projects/demo/src/app/track-event-component/track-event-component.component.spec.ts index dad6174..f177131 100644 --- a/projects/demo/src/app/track-event-component/track-event-component.component.spec.ts +++ b/projects/demo/src/app/track-event-component/track-event-component.component.spec.ts @@ -1,6 +1,6 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatomoConfiguration, NgxMatomoTrackerModule } from 'ngx-matomo-client'; +import { MatomoConfiguration, MatomoModule } from 'ngx-matomo-client'; import { TrackEventComponentComponent } from './track-event-component.component'; describe('TrackEventComponentComponent', () => { @@ -10,7 +10,7 @@ describe('TrackEventComponentComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ - NgxMatomoTrackerModule.forRoot({ + MatomoModule.forRoot({ trackerUrl: '', siteId: '', } as MatomoConfiguration), diff --git a/projects/demo/src/app/track-event-template/track-event-template.component.spec.ts b/projects/demo/src/app/track-event-template/track-event-template.component.spec.ts index a5ebc4e..d040dc0 100644 --- a/projects/demo/src/app/track-event-template/track-event-template.component.spec.ts +++ b/projects/demo/src/app/track-event-template/track-event-template.component.spec.ts @@ -1,6 +1,6 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatomoConfiguration, NgxMatomoTrackerModule } from 'ngx-matomo-client'; +import { MatomoConfiguration, MatomoModule } from 'ngx-matomo-client'; import { TrackEventTemplateComponent } from './track-event-template.component'; describe('TrackEventTemplateComponent', () => { @@ -10,7 +10,7 @@ describe('TrackEventTemplateComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ - NgxMatomoTrackerModule.forRoot({ + MatomoModule.forRoot({ trackerUrl: '', siteId: '', } as MatomoConfiguration), diff --git a/projects/demo/src/app/track-page-view-without-router/track-page-view-without-router.component.spec.ts b/projects/demo/src/app/track-page-view-without-router/track-page-view-without-router.component.spec.ts index 82cdd1e..2db3ca1 100644 --- a/projects/demo/src/app/track-page-view-without-router/track-page-view-without-router.component.spec.ts +++ b/projects/demo/src/app/track-page-view-without-router/track-page-view-without-router.component.spec.ts @@ -1,6 +1,6 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatomoConfiguration, NgxMatomoTrackerModule } from 'ngx-matomo-client'; +import { MatomoConfiguration, MatomoModule } from 'ngx-matomo-client'; import { TrackPageViewWithoutRouterComponent } from './track-page-view-without-router.component'; describe('TrackPageViewWithoutRouterComponent', () => { @@ -10,7 +10,7 @@ describe('TrackPageViewWithoutRouterComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ - NgxMatomoTrackerModule.forRoot({ + MatomoModule.forRoot({ trackerUrl: '', siteId: '', } as MatomoConfiguration), diff --git a/projects/demo/src/app/track-simple-click-event/track-simple-click-event.component.spec.ts b/projects/demo/src/app/track-simple-click-event/track-simple-click-event.component.spec.ts index b448538..7f50284 100644 --- a/projects/demo/src/app/track-simple-click-event/track-simple-click-event.component.spec.ts +++ b/projects/demo/src/app/track-simple-click-event/track-simple-click-event.component.spec.ts @@ -1,6 +1,6 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { MatomoConfiguration, NgxMatomoTrackerModule } from 'ngx-matomo-client'; +import { MatomoConfiguration, MatomoModule } from 'ngx-matomo-client'; import { TrackSimpleClickEventComponent } from './track-simple-click-event.component'; describe('TrackSimpleClickEventComponent', () => { @@ -10,7 +10,7 @@ describe('TrackSimpleClickEventComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ - NgxMatomoTrackerModule.forRoot({ + MatomoModule.forRoot({ trackerUrl: '', siteId: '', } as MatomoConfiguration), diff --git a/projects/ngx-matomo-client/core/tracker/configuration.ts b/projects/ngx-matomo-client/core/tracker/configuration.ts index 3f2164a..f0451ec 100644 --- a/projects/ngx-matomo-client/core/tracker/configuration.ts +++ b/projects/ngx-matomo-client/core/tracker/configuration.ts @@ -2,7 +2,7 @@ import { inject, InjectionToken } from '@angular/core'; import { requireNonNull } from '../utils/coercion'; const CONFIG_NOT_FOUND = - 'No Matomo configuration found! Have you included Matomo module using NgxMatomoTrackerModule.forRoot() ?'; + 'No Matomo configuration found! Have you included Matomo module using MatomoModule.forRoot() or provideMatomo()?'; /** Internal marker token to detect that router has been enabled */ export const MATOMO_ROUTER_ENABLED = new InjectionToken