diff --git a/CHANGELOG.md b/CHANGELOG.md index f33a7e4b..4703863b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [2.6.0-dev-test] - 2025-07-15 + +- Migrate to angular 19 + ## [2.5.0-dev-test] - 2025-07-15 - Migrate to angular 18 diff --git a/angular.json b/angular.json index deddb4d4..ff751e93 100644 --- a/angular.json +++ b/angular.json @@ -51,90 +51,90 @@ } ] } - }, - "defaultConfiguration": "" - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "ngx-jsonapi:build" - }, - "configurations": { - "production": { - "browserTarget": "ngx-jsonapi:build:production" - } } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "buildTarget": "ngx-jsonapi:build" }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "ngx-jsonapi:build" + "configurations": { + "production": { + "buildTarget": "ngx-jsonapi:build:production" } } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "buildTarget": "ngx-jsonapi:build" + } } - }, - "ngx-jsonapi-e2e": { - "root": "e2e", - "sourceRoot": "e2e", - "projectType": "application", - "architect": { - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "./protractor.conf.js", - "devServerTarget": "ngx-jsonapi:serve" - } + } + }, + "ngx-jsonapi-e2e": { + "root": "e2e", + "sourceRoot": "e2e", + "projectType": "application", + "architect": { + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "./protractor.conf.js", + "devServerTarget": "ngx-jsonapi:serve" } } - }, - "ngx-jsonapi-lib": { - "projectType": "library", - "root": "projects/ngx-jsonapi-lib", - "sourceRoot": "projects/ngx-jsonapi-lib/src", - "prefix": "lib", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:ng-packagr", - "options": { - "project": "projects/ngx-jsonapi-lib/ng-package.json" - }, - "configurations": { - "production": { - "tsConfig": "projects/ngx-jsonapi-lib/tsconfig.lib.prod.json" - }, - "development": { - "tsConfig": "projects/ngx-jsonapi-lib/tsconfig.lib.json" - } - }, - "defaultConfiguration": "production" + } + }, + "ngx-jsonapi-lib": { + "projectType": "library", + "root": "projects/ngx-jsonapi-lib", + "sourceRoot": "projects/ngx-jsonapi-lib/src", + "prefix": "lib", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:ng-packagr", + "options": { + "project": "projects/ngx-jsonapi-lib/ng-package.json" }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "tsConfig": "projects/ngx-jsonapi-lib/tsconfig.spec.json", - "polyfills": [ - "zone.js", - "zone.js/testing" - ] + "configurations": { + "production": { + "tsConfig": "projects/ngx-jsonapi-lib/tsconfig.lib.prod.json" + }, + "development": { + "tsConfig": "projects/ngx-jsonapi-lib/tsconfig.lib.json" } + }, + "defaultConfiguration": "production" + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "tsConfig": "projects/ngx-jsonapi-lib/tsconfig.spec.json", + "polyfills": [ + "zone.js", + "zone.js/testing" + ] } } } + } +}, +"schematics": { + "@schematics/angular:component": { + "inlineStyle": true, + "inlineTemplate": true, + "flat": true, + "skipTests": true, + "prefix": "bc", + "style": "css" }, - "schematics": { - "@schematics/angular:component": { - "inlineStyle": true, - "inlineTemplate": true, - "flat": true, - "skipTests": true, - "prefix": "bc", - "style": "css" - }, - "@schematics/angular:directive": { - "prefix": "bc" - } - }, - "cli": { - "analytics": false + "@schematics/angular:directive": { + "prefix": "bc" } +}, +"cli": { + "analytics": false } +} \ No newline at end of file diff --git a/demo/app/app.component.ts b/demo/app/app.component.ts index 09a6dcb8..6e47a23d 100644 --- a/demo/app/app.component.ts +++ b/demo/app/app.component.ts @@ -1,12 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; import { JsonapiCore } from 'ngx-jsonapi'; +import { RouterModule } from '@angular/router'; +import { CommonModule } from '@angular/common'; @Component({ selector: 'demo-app', styleUrls: ['./app.component.scss'], + standalone: true, + imports: [RouterModule, CommonModule], templateUrl: './app.component.html' }) -export class AppComponent /* implements OnInit */ { +export class AppComponent { public loading: string = ''; public constructor( diff --git a/demo/app/app.module.ts b/demo/app/app.module.ts index 61b22460..f3ec5dd3 100644 --- a/demo/app/app.module.ts +++ b/demo/app/app.module.ts @@ -51,12 +51,12 @@ const appRoutes: Routes = [ BrowserModule, HttpClientModule, SharedModule, + AppComponent, RouterModule.forRoot(appRoutes, { useHash: true }), NgxJsonapiModule.forRoot({ url: environment.api_saldo, }) ], - declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule {} diff --git a/demo/app/authors/authors.module.ts b/demo/app/authors/authors.module.ts index 42398b5e..f3b1dc4d 100644 --- a/demo/app/authors/authors.module.ts +++ b/demo/app/authors/authors.module.ts @@ -1,12 +1,11 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { AuthorComponent } from './components/author.component'; -import { AuthorsComponent } from './components/authors.component'; import { AuthorsRoutingModule } from './authors-routing.module'; import { SharedModule } from '../shared/shared.module'; +import { AuthorComponent } from './components/author.component'; +import { AuthorsComponent } from './components/authors.component'; @NgModule({ - imports: [CommonModule, SharedModule, AuthorsRoutingModule], - declarations: [AuthorComponent, AuthorsComponent] + imports: [CommonModule, SharedModule, AuthorsRoutingModule, AuthorComponent, AuthorsComponent] }) export class AuthorsModule {} diff --git a/demo/app/authors/components/author.component.ts b/demo/app/authors/components/author.component.ts index cab6c0f5..2e8cde8d 100644 --- a/demo/app/authors/components/author.component.ts +++ b/demo/app/authors/components/author.component.ts @@ -4,9 +4,14 @@ import { Resource } from 'ngx-jsonapi'; import { PhotosService } from '../../photos/photos.service'; import { AuthorsService, Author } from '../authors.service'; import { BooksService } from '../../books/books.service'; +import { CommonModule } from '@angular/common'; +import { CollectionInfoComponent } from '../../shared/collection-info.component'; +import { ResourceInfoComponent } from '../../shared/resource-info.component'; @Component({ selector: 'demo-author', + standalone: true, + imports: [CommonModule, CollectionInfoComponent, ResourceInfoComponent], templateUrl: './author.component.html' }) export class AuthorComponent { diff --git a/demo/app/authors/components/authors.component.ts b/demo/app/authors/components/authors.component.ts index d7818320..f9bd82c5 100644 --- a/demo/app/authors/components/authors.component.ts +++ b/demo/app/authors/components/authors.component.ts @@ -3,9 +3,14 @@ import { Component } from '@angular/core'; import { DocumentCollection } from 'ngx-jsonapi'; import { AuthorsService, Author } from './../authors.service'; import { ActivatedRoute } from '@angular/router'; +import { CommonModule } from '@angular/common'; +import { CollectionInfoComponent } from '../../shared/collection-info.component'; +import { CollectionPaginatorComponent } from '../../shared/collection-paginator.component'; @Component({ selector: 'demo-authors', + standalone: true, + imports: [CommonModule, CollectionInfoComponent, CollectionPaginatorComponent], templateUrl: './authors.component.html' }) export class AuthorsComponent { diff --git a/demo/app/books/books.module.ts b/demo/app/books/books.module.ts index 890e3965..32a29fdc 100644 --- a/demo/app/books/books.module.ts +++ b/demo/app/books/books.module.ts @@ -1,12 +1,11 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { BookComponent } from './components/book.component'; -import { BooksComponent } from './components/books.component'; import { BooksRoutingModule } from './books-routing.module'; import { SharedModule } from '../shared/shared.module'; +import { BookComponent } from './components/book.component'; +import { BooksComponent } from './components/books.component'; @NgModule({ - imports: [CommonModule, SharedModule, BooksRoutingModule], - declarations: [BookComponent, BooksComponent] + imports: [CommonModule, SharedModule, BooksRoutingModule, BookComponent, BooksComponent] }) export class BooksModule {} diff --git a/demo/app/books/components/book.component.ts b/demo/app/books/components/book.component.ts index 8aea9ccd..bf26a1d1 100644 --- a/demo/app/books/components/book.component.ts +++ b/demo/app/books/components/book.component.ts @@ -1,12 +1,16 @@ import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; import { ActivatedRoute } from '@angular/router'; import { Resource } from 'ngx-jsonapi'; import { AuthorsService } from '../../authors/authors.service'; import { BooksService, Book } from './../books.service'; import { PhotosService } from '../../photos/photos.service'; +import { ResourceInfoComponent } from '../../shared/resource-info.component'; @Component({ selector: 'demo-book', + imports: [CommonModule, ResourceInfoComponent], + standalone: true, templateUrl: './book.component.html' }) export class BookComponent { diff --git a/demo/app/books/components/books.component.ts b/demo/app/books/components/books.component.ts index 028f259a..a8864608 100644 --- a/demo/app/books/components/books.component.ts +++ b/demo/app/books/components/books.component.ts @@ -1,13 +1,18 @@ import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; import { Resource, DocumentCollection } from 'ngx-jsonapi'; import { BooksService, Book } from './../books.service'; import { AuthorsService } from './../../authors/authors.service'; import { PhotosService } from '../../photos/photos.service'; import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs'; +import { CollectionInfoComponent } from '../../shared/collection-info.component'; +import { CollectionPaginatorComponent } from '../../shared/collection-paginator.component'; @Component({ selector: 'demo-books', + imports: [CommonModule, CollectionInfoComponent, CollectionPaginatorComponent], + standalone: true, templateUrl: './books.component.html' }) export class BooksComponent { diff --git a/demo/app/shared/collection-info.component.ts b/demo/app/shared/collection-info.component.ts index 1051daf7..c152987b 100644 --- a/demo/app/shared/collection-info.component.ts +++ b/demo/app/shared/collection-info.component.ts @@ -1,7 +1,10 @@ import { Component, Input } from '@angular/core'; +import { CommonModule } from '@angular/common'; import { DocumentCollection } from 'ngx-jsonapi'; @Component({ selector: 'demo-collection-info', + imports: [CommonModule], + standalone: true, templateUrl: './collection-info.component.html' }) export class CollectionInfoComponent { diff --git a/demo/app/shared/collection-paginator.component.ts b/demo/app/shared/collection-paginator.component.ts index f926e248..b77a5a84 100644 --- a/demo/app/shared/collection-paginator.component.ts +++ b/demo/app/shared/collection-paginator.component.ts @@ -1,7 +1,11 @@ import { Component, Input } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; import { DocumentCollection } from 'ngx-jsonapi'; @Component({ selector: 'demo-collection-paginator', + standalone: true, + imports: [CommonModule, RouterModule], templateUrl: './collection-paginator.component.html' }) export class CollectionPaginatorComponent { diff --git a/demo/app/shared/resource-info.component.ts b/demo/app/shared/resource-info.component.ts index 209900f1..ba702973 100644 --- a/demo/app/shared/resource-info.component.ts +++ b/demo/app/shared/resource-info.component.ts @@ -1,7 +1,10 @@ import { Component, Input } from '@angular/core'; +import { CommonModule } from '@angular/common'; import { DocumentResource } from 'ngx-jsonapi'; @Component({ selector: 'demo-resource-info', + imports: [CommonModule], + standalone: true, templateUrl: './resource-info.component.html' }) export class ResourceInfoComponent { diff --git a/demo/app/shared/shared.module.ts b/demo/app/shared/shared.module.ts index 322923fe..43f11991 100644 --- a/demo/app/shared/shared.module.ts +++ b/demo/app/shared/shared.module.ts @@ -5,8 +5,7 @@ import { ResourceInfoComponent } from './resource-info.component'; import { CollectionPaginatorComponent } from './collection-paginator.component'; import { RouterModule } from '@angular/router'; @NgModule({ - imports: [CommonModule, RouterModule], - exports: [CollectionInfoComponent, ResourceInfoComponent, CollectionPaginatorComponent], - declarations: [CollectionInfoComponent, ResourceInfoComponent, CollectionPaginatorComponent] + imports: [CommonModule, RouterModule, CollectionInfoComponent, ResourceInfoComponent, CollectionPaginatorComponent], + exports: [CollectionInfoComponent, ResourceInfoComponent, CollectionPaginatorComponent] }) export class SharedModule {} diff --git a/demo/app/systems/systems.component.ts b/demo/app/systems/systems.component.ts index 738287e2..54c4c824 100644 --- a/demo/app/systems/systems.component.ts +++ b/demo/app/systems/systems.component.ts @@ -1,13 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; import { ActivatedRoute } from '@angular/router'; import { DocumentCollection } from 'ngx-jsonapi'; import { System, SystemsService } from './systems.service'; +import { CollectionInfoComponent } from '../shared/collection-info.component'; +import { CollectionPaginatorComponent } from '../shared/collection-paginator.component'; @Component({ selector: 'bc-systems', templateUrl: './systems.component.html', - styles: [ - ] + standalone: true, + imports: [CommonModule, CollectionInfoComponent, CollectionPaginatorComponent] }) export class SystemsComponent { public systems: DocumentCollection; diff --git a/demo/app/systems/systems.module.ts b/demo/app/systems/systems.module.ts index 8233115d..986645b2 100644 --- a/demo/app/systems/systems.module.ts +++ b/demo/app/systems/systems.module.ts @@ -20,12 +20,10 @@ export class SystemsRoutingModule { } @NgModule({ - declarations: [ - SystemsComponent - ], imports: [ CommonModule, SharedModule, + SystemsComponent, SystemsRoutingModule ], providers: [SystemsService] diff --git a/demo/main.ts b/demo/main.ts index 09b61e3f..94ae706b 100644 --- a/demo/main.ts +++ b/demo/main.ts @@ -1,12 +1,56 @@ import './polyfills'; -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { enableProdMode } from '@angular/core'; +import { enableProdMode, importProvidersFrom } from '@angular/core'; +import { bootstrapApplication } from '@angular/platform-browser'; +import { RouterModule, Routes } from '@angular/router'; +import { HttpClientModule } from '@angular/common/http'; import { environment } from './environments/environment'; -import { AppModule } from './app/app.module'; +import { NgxJsonapiModule, JSONAPI_RIPPER_SERVICE, JSONAPI_STORE_SERVICE } from 'ngx-jsonapi'; +import { AppComponent } from './app/app.component'; +import { AuthorsService } from './app/authors/authors.service'; +import { BooksService } from './app/books/books.service'; +import { PhotosService } from './app/photos/photos.service'; +import { SharedModule } from './app/shared/shared.module'; +import { JsonRipper, StoreService } from '../projects/ngx-jsonapi-lib/src/lib/store'; + +const appRoutes: Routes = [ + { + path: '', + redirectTo: '/authors', + pathMatch: 'full' + }, + { + path: 'authors', + loadChildren: () => import('./app/authors/authors.module').then((m) => m.AuthorsModule) + }, + { + path: 'systems', + loadChildren: () => import('./app/systems/systems.module').then((m) => m.SystemsModule) + }, + { + path: 'books', + loadChildren: () => import('./app/books/books.module').then((m) => m.BooksModule) + } +]; if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule); +bootstrapApplication(AppComponent, { + providers: [ + importProvidersFrom( + HttpClientModule, + SharedModule, + RouterModule.forRoot(appRoutes, { useHash: true }), + NgxJsonapiModule.forRoot({ + url: environment.api_saldo, + }) + ), + { provide: JSONAPI_RIPPER_SERVICE, useClass: JsonRipper }, + { provide: JSONAPI_STORE_SERVICE, useClass: StoreService }, + AuthorsService, + BooksService, + PhotosService + ] +}); diff --git a/package.json b/package.json index 613aff07..383fb7c7 100644 --- a/package.json +++ b/package.json @@ -95,26 +95,25 @@ "jest-environment-jsdom": "27.4.6" }, "devDependencies": { - "@angular-devkit/build-angular": "18.0.0", + "@angular-devkit/build-angular": "19.2.14", "@angular-eslint/builder": "20.1.1", "@angular-eslint/eslint-plugin": "20.1.1", "@angular-eslint/eslint-plugin-template": "20.1.1", "@angular-eslint/schematics": "20.1.1", "@angular-eslint/template-parser": "20.1.1", - "@angular/animations": "18.0.0", - "@angular/cli": "18.0.0", - "@angular/common": "18.0.0", - "@angular/compiler": "18.0.0", - "@angular/compiler-cli": "18.0.0", - "@angular/core": "18.0.0", - "@angular/forms": "18.0.0", - "@angular/platform-browser": "18.0.0", - "@angular/platform-browser-dynamic": "18.0.0", - "@angular/platform-server": "18.0.0", - "@angular/router": "18.0.0", + "@angular/animations": "19.2.14", + "@angular/cli": "19.2.14", + "@angular/common": "19.2.14", + "@angular/compiler": "19.2.14", + "@angular/compiler-cli": "19.2.14", + "@angular/core": "19.2.14", + "@angular/forms": "19.2.14", + "@angular/platform-browser": "19.2.14", + "@angular/platform-browser-dynamic": "19.2.14", + "@angular/platform-server": "19.2.14", + "@angular/router": "19.2.14", "@types/jest": "29.5.12", "@types/node": "20.11.30", - "codelyzer": "6.0.2", "coveralls": "3.1.1", "cpy-cli": "4.2.0", "deep-freeze": "0.0.1", @@ -136,7 +135,7 @@ "lint-staged": "15.2.0", "module-alias": "2.2.3", "ncp": "2.0.0", - "ng-packagr": "20.1.0", + "ng-packagr": "19.2.2", "nyc": "15.1.0", "ora": "7.0.1", "prettier": "3.2.5", @@ -148,8 +147,8 @@ "ts-jest": "29.1.1", "ts-mockito": "2.6.1", "ts-node": "10.9.2", - "typescript": "5.4.5", - "zone.js": "0.15.1" + "typescript": "5.8.3", + "zone.js": "0.14.0" }, "dependencies": { "dexie": "4.0.11", @@ -158,5 +157,5 @@ "tsickle": "0.46.3", "tslib": "2.6.2" }, - "version": "2.5.0-dev-test" + "version": "2.6.0-dev-test" } \ No newline at end of file