@dsivd/prestations-ng 19.0.0-beta.11 → 19.0.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/UPGRADING_V19.md CHANGED
@@ -25,13 +25,13 @@ mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCo
25
25
 
26
26
  #### Fixes
27
27
 
28
- Fix application.properties :
28
+ Fix `application.properties`:
29
29
 
30
30
  ```diff
31
- # Remove the following properties if it was added by the recipe
31
+ # Remove the following properties if they were added by the recipe
32
32
  spring.liquibase.password=${spring.datasource.password}
33
33
  spring.liquibase.username=${spring.datasource.username}
34
- Replace the spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS property by spring.jackson.datatype.datetime.write-dates-as-timestamps if it was not done by the recipe
34
+ Replace the `spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS` property with `spring.jackson.datatype.datetime.write-dates-as-timestamps` if it was not already done by the recipe
35
35
  ```
36
36
 
37
37
  If the following plugin with Lombok path was added by the recipe, remove this plugin:
@@ -62,9 +62,9 @@ If the code uses `AutoConfigureMockMvc`, add:
62
62
  </dependency>
63
63
  ```
64
64
 
65
- And replace the old `AutoConfigureMockMvc` import which is not recognized anymore by the new one.
65
+ And replace the old `AutoConfigureMockMvc` import, which is not recognized anymore, with the new one.
66
66
 
67
- If we use in pom.xml Spring/Hibernate dependencies (like hibernate-jpamodelgen), check the Spring Boot 4 migration
67
+ If you use Spring/Hibernate dependencies in `pom.xml` (like `hibernate-jpamodelgen`), check the Spring Boot 4 migration
68
68
  guide to see if it has been replaced by another library: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide
69
69
 
70
70
  ### Jackson migration
@@ -77,7 +77,7 @@ Replace `com.fasterxml.jackson.databind.ObjectMapper` with `tools.jackson.databi
77
77
  - `ch.vd.cyberadminbe.jms` has been moved to `ch.vd.cyber.backofficebe.jms`
78
78
  - `ch.vd.cyberadminbe.security` has been moved to `ch.vd.cyber.backofficebe.security`
79
79
  - `ch.vd.cyberadminbe.editique` has been moved to `ch.vd.cyber.backofficebe.editique`
80
- - `cyberadminbe.config.CyberAdminBeEsbHttpConfig` has renamed to `backofficebe.config.BoCommonEsbHttpConfig`
80
+ - `cyberadminbe.config.CyberAdminBeEsbHttpConfig` has been renamed to `backofficebe.config.BoCommonEsbHttpConfig`
81
81
 
82
82
  ### BO : Brave Tracer
83
83
 
@@ -133,7 +133,7 @@ public class MyListener extends EsbMessageListenerWithTracingPropagation {
133
133
  }
134
134
  ```
135
135
 
136
- finally, if you have mock issues with your integration tests, you can use `ch.vd.cyber.backofficebe.jms.JmsTestUtils.mockTracingPropagation(final Tracer tracerMock, final Propagator propagatorMock)`
136
+ Finally, if you have mock issues with your integration tests, you can use `ch.vd.cyber.backofficebe.jms.JmsTestUtils.mockTracingPropagation(final Tracer tracerMock, final Propagator propagatorMock)`
137
137
 
138
138
  ### BO : ESB Integration
139
139
 
@@ -152,11 +152,11 @@ Run your application with this dependency :
152
152
  </dependency>
153
153
  ```
154
154
 
155
- Look for logs that indicate property you should migrate (watch for WARN logs of class PropertiesMigrationListener), update them and remove the dependency
155
+ Look for logs that indicate properties you should migrate (watch for WARN logs of class PropertiesMigrationListener), update them and remove the dependency
156
156
 
157
157
  ### BO using jpa repositories
158
158
 
159
- As we also have jdbc in the classpath, to avoid having dozens of log like "Spring Data JDBC - Could not safely
159
+ As we also have jdbc in the classpath, to avoid having dozens of logs like "Spring Data JDBC - Could not safely
160
160
  identify store assignment for repository candidate interface", add the property in your application.properties :
161
161
 
162
162
  spring.data.jdbc.repositories.enabled=false
@@ -183,18 +183,18 @@ Take a look at Sonar to see other things that you can improve or ignore.
183
183
 
184
184
  ## PRESTATIONS-NG
185
185
 
186
- For the commands in this guide, it is supposed that you are in the `front` folder of your project.
186
+ For the commands in this guide, it is assumed that you are in the `front` folder of your project.
187
187
 
188
188
  The main feature in `prestations-ng` v19 is the update of the `@angular/*` peer dependencies
189
- to `^21.2.14`, using `node 22+` to build, `npm 10+` for package manager and `Foehn 2+ (Bootstrap 5+)` for our design system.
189
+ to `^21.2.14`, using `node 22+` to build, `npm 10+` as package manager, and `Foehn 2+ (Bootstrap 5+)` for our design system.
190
190
 
191
- A lot of breaking because our library has migrated to **standalone** components, **signals** and **inject function** instead of constructor injection parameters.
191
+ There are a lot of breaking changes because our library has migrated to **standalone** components, **signals**, and the **inject function** instead of constructor injection parameters.
192
192
 
193
- > 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
193
+ > 🚨 **Read carefully the following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
194
194
 
195
195
  ### Migrate to ESLint
196
196
 
197
- (NB : you can skip this step if you already have a `front/.eslintrc.json` file, it means it is already done.)
197
+ 💡 **NB : you can skip this step if you already have a `front/.eslintrc.json` file, it means it is already done.**
198
198
 
199
199
  Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project from TSLint to ESLint.
200
200
 
@@ -202,9 +202,9 @@ Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project
202
202
 
203
203
  Just FYI if you are curious about the details, you can find the Angular update guide at this address [https://angular.dev/update-guide?v=19.0-20.0&l=1](https://angular.dev/update-guide?v=19.0-20.0&l=1)
204
204
 
205
- **NB: Commit before continuing so your repository is clean.**
205
+ 💡 **NB: Commit before continuing so your repository is clean.**
206
206
 
207
- Remove your `resolutions` in `package.json` before starting : if you have `resolutions` in `package.json`, remove manually the section.
207
+ Remove your `resolutions` in `package.json` before starting: if you have `resolutions` in `package.json`, remove the section manually.
208
208
 
209
209
  In the next commands, commit before each ng update.
210
210
 
@@ -227,7 +227,7 @@ Verify your node version in your terminal by executing:
227
227
  node -v
228
228
  ```
229
229
 
230
- **NB: If version is still v20+ by default, type `node22` in your terminal to switch to node v22+**
230
+ 💡 **NB: If the version is still v20+ by default, type `node22` in your terminal to switch to node v22+**
231
231
 
232
232
  ```bash
233
233
  node22
@@ -241,6 +241,10 @@ Be sure to use a node version 22+ in your terminal:
241
241
  node -v
242
242
  ```
243
243
 
244
+ ##### IntelliJ node version
245
+
246
+ Change the IntelliJ Node.js version to 22+ by going to `File > Settings > Languages & Frameworks > TypeScript` and selecting a node version 22+ in `Node runtime`.
247
+
244
248
  #### Continue with Angular 20 migration
245
249
 
246
250
  ```bash
@@ -257,10 +261,10 @@ ng update @angular/core@20 @angular/cli@20
257
261
  - accept **"router-current-navigation"** by hitting "Space" key
258
262
  - hit "Enter" key
259
263
 
260
- **IMPORTANT: Search for every `@for` in your project and check that `track` statement is present and has a unique identifier.
264
+ 🚨 **IMPORTANT: Search for every `@for` in your project and check that `track` statement is present and has a unique identifier.
261
265
  When a unique identifier is not possible, use `track $index`.**
262
266
 
263
- **NB: When using `@angular/cdk` in your project**
267
+ 💡 **NB: When using `@angular/cdk` in your project**
264
268
 
265
269
  ```bash
266
270
  ng update @angular/cdk@20
@@ -299,7 +303,7 @@ buildAppPipelinePodmanUT([
299
303
 
300
304
  Just FYI if you are curious about the details, you can find the Angular update guide at this address [https://angular.dev/update-guide?v=20.0-21.0&l=1](https://angular.dev/update-guide?v=20.0-21.0&l=1)
301
305
 
302
- **NB: Commit before continuing so your repository is clean.**
306
+ 💡 **NB: Commit before continuing so your repository is clean.**
303
307
 
304
308
  ```bash
305
309
  npm install @angular/cli@21 -g
@@ -322,13 +326,13 @@ ng update @angular/cli@21
322
326
  npm install @types/node@22 ts-node@10
323
327
  ```
324
328
 
325
- **NB: When using `@angular/cdk` in your project**
329
+ 💡 **NB: When using `@angular/cdk` in your project**
326
330
 
327
331
  ```bash
328
332
  ng update @angular/cdk@21
329
333
  ```
330
334
 
331
- **NB: When using `ngx-matomo-client` in your project**
335
+ 💡 **NB: When using `ngx-matomo-client` in your project**
332
336
 
333
337
  ```bash
334
338
  ng update ngx-matomo-client@9
@@ -352,12 +356,12 @@ ng update ngx-matomo-client@9
352
356
 
353
357
  ### Now fix your project before continuing
354
358
 
355
- **IMPORTANT: Fix your project because our new prestations-ng v19+ is standalone, uses signals instead of observables and inject function instead of constructor injection parameter.**
359
+ 🚨 **IMPORTANT: Fix your project because our new prestations-ng v19+ is standalone, uses signals instead of observables, and uses the inject function instead of constructor injection parameters.**
356
360
 
357
- - Only keep `modules` relative to your application such as `AppRoutingModule`.
358
- - Remove all other imports of **modules** and make sure you are using the new **standalone components** by adding them directly from your HTML file "alt+enter".
359
- - Add `providePrestationsNgCore(),` in `providers` array of your `app.modules.ts` file.
360
- - Check every `constructor` in your project, and remove useless `constructor` parameters that are not used anymore (like `ActivatedRoute` in components extending `AbstractPageComponent`).
361
+ - Only keep `modules` related to your application, such as `AppRoutingModule`.
362
+ - Remove all other imports of **modules** and make sure you are using the new **standalone components** by adding them directly from your template (Alt+Enter).
363
+ - Add `providePrestationsNgCore(),` to the `providers` array of your `app.module.ts` file.
364
+ - Check every `constructor` in your project and remove unused `constructor` parameters (like `ActivatedRoute` in components extending `AbstractPageComponent`).
361
365
 
362
366
  Run the following command until you have no more errors.
363
367
 
@@ -365,7 +369,7 @@ Run the following command until you have no more errors.
365
369
  npm run build
366
370
  ```
367
371
 
368
- **TIP: If your IntelliJ is still showing you errors on `@if` or `@for`, close it and re-open it to fix.**
372
+ 💡 **TIP: If your IntelliJ is still showing you errors on `@if` or `@for`, close it and re-open it to fix.**
369
373
 
370
374
  ### Migrate to inject function
371
375
 
@@ -417,7 +421,7 @@ Most of the time, you can remove `activatedRoute` because it was used as a const
417
421
 
418
422
  ### Migrate to self-closing tags
419
423
 
420
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
424
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
421
425
 
422
426
  ```bash
423
427
  npm run build
@@ -433,9 +437,9 @@ ng generate @angular/core:self-closing-tag
433
437
 
434
438
  ### Migrate to standalone
435
439
 
436
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
440
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
437
441
 
438
- **TIP: Check [Migrating from NgModules](COMPONENTS.md#migrating_from_ngmodules) for more information before running following commands.**
442
+ 💡 **TIP: Check [Migrating from NgModules](COMPONENTS.md#migrating_from_ngmodules) for more information before running the following commands.**
439
443
 
440
444
  ```bash
441
445
  npm run build
@@ -534,11 +538,11 @@ bootstrapApplication(AppComponent, appConfig).catch((err) =>
534
538
  );
535
539
  ```
536
540
 
537
- Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if it has not already been done.
541
+ Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if they have not already been removed.
538
542
 
539
543
  #### Migration to lazy-loaded routes when working with large applications
540
544
 
541
- You may have some other modules that are maybe lazy-loaded. Just be sure that all your components are standalone before continuing.
545
+ You may have some other modules that are lazy-loaded. Just be sure that all your components are standalone before continuing.
542
546
 
543
547
  > You can run the following command to convert eagerly loaded component routes to lazy loaded routes. This allows the build process to split the production bundle into smaller chunks, to avoid a big JS bundle that includes all routes, which negatively affects initial page load of an application.
544
548
 
@@ -599,7 +603,7 @@ export const demandes_routes: Routes = [
599
603
 
600
604
  ### Migrate from NgClass to class bindings
601
605
 
602
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
606
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
603
607
 
604
608
  ```bash
605
609
  npm run build
@@ -666,7 +670,7 @@ After:
666
670
 
667
671
  ### Migrate from NgStyle to style bindings
668
672
 
669
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
673
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
670
674
 
671
675
  ```bash
672
676
  npm run build
@@ -687,7 +691,7 @@ ng generate @angular/core:ngstyle-to-style
687
691
 
688
692
  ### Convert CommonModule usage to standalone imports
689
693
 
690
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
694
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
691
695
 
692
696
  ```bash
693
697
  npm run build
@@ -744,7 +748,7 @@ export class NumberCurrencyFormatterDirective implements OnInit {
744
748
 
745
749
  ### Migrate to signal queries
746
750
 
747
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
751
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
748
752
 
749
753
  ```bash
750
754
  npm run build
@@ -766,7 +770,7 @@ ng generate @angular/core:signal-queries-migration --insert-todos
766
770
 
767
771
  ### Migrate to output functions
768
772
 
769
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
773
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
770
774
 
771
775
  ```bash
772
776
  npm run build
@@ -788,7 +792,7 @@ When needing to subscribe to an output, you can use `outputToObservable` from `@
788
792
 
789
793
  Check our [Angular signals guide](ANGULAR_SIGNALS.md) for more information about signals and input signals.
790
794
 
791
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
795
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
792
796
 
793
797
  ```bash
794
798
  npm run build
@@ -881,7 +885,7 @@ rm karma.conf.js
881
885
  - search for `karma.conf.js` in your project and remove all references to it.
882
886
  - search for `protractor.conf.js` in your project and remove them if they still exist.
883
887
 
884
- Then run following command to migrate from jasmine to vitest:
888
+ Then run the following command to migrate from jasmine to vitest:
885
889
 
886
890
  ```bash
887
891
  ng g @schematics/angular:refactor-jasmine-vitest
@@ -970,6 +974,28 @@ describe('AppComponent', () => {
970
974
  });
971
975
  ```
972
976
 
977
+ #### Running fakeAsync tests using spyOnProperty with Vitest
978
+
979
+ Example of transformation:
980
+
981
+ ```diff
982
+ beforeEach(() => {
983
+ - spyOnProperty(sessionInfo, 'data').and.returnValue(of(sessionInfoData));
984
+ + vi.spyOn(sessionInfo, 'data', 'get').mockReturnValue(of(sessionInfoData));
985
+ });
986
+
987
+ - it('should properly map the initial data', fakeAsync(() => {
988
+ + it('should properly map the initial data', async () => {
989
+ const form = new MenuOrderForm();
990
+ - service.enrichWithSessionInfoData(form);
991
+ - tick(200);
992
+ + await firstValueFrom(service.enrichWithSessionInfoData(form));
993
+
994
+ // expect(...) here
995
+ - }));
996
+ + });
997
+ ```
998
+
973
999
  ### Migrate to eslint flat configuration
974
1000
 
975
1001
  ```bash
@@ -1270,6 +1296,8 @@ In `front/src/`, remove the file `typings.d.ts` if it is still there.
1270
1296
 
1271
1297
  ### Husky pre-commit hook
1272
1298
 
1299
+ 💡 **Tip: For multi-projects, see section below `Husky pre-commit hook for multi-project repository`**
1300
+
1273
1301
  ```bash
1274
1302
  npm install --save-dev husky lint-staged
1275
1303
  npx husky init
@@ -1280,7 +1308,78 @@ mv ./.husky ../.husky
1280
1308
  git add -A
1281
1309
  ```
1282
1310
 
1283
- - You can manually run formatting commands as well:
1311
+ - In your `package.json`, modify `prepare` script to run husky from the parent folder:
1312
+
1313
+ ```diff
1314
+ - "prepare": "husky"
1315
+ + "prepare": "cd .. && husky"
1316
+ ```
1317
+
1318
+ Then run:
1319
+
1320
+ ```bash
1321
+ npm install
1322
+ ```
1323
+
1324
+ You should see in your project root folder `.husky` a new folder `_`.
1325
+
1326
+ #### Husky pre-commit hook for multi-project repository
1327
+
1328
+ 💡 **Tip: Skip this part if you have already followed section `Husky pre-commit hook`**
1329
+
1330
+ ```bash
1331
+ npm install --save-dev husky lint-staged
1332
+ npx husky init
1333
+ chmod +x .husky/pre-commit
1334
+ mv ./.husky ../../.husky
1335
+ git add -A
1336
+ ```
1337
+
1338
+ Replace `.husky/pre-commit` content with the following:
1339
+
1340
+ ```bash
1341
+ projects=$(git diff --cached --name-only --diff-filter=ACMR | awk -F'/' '{print $1}' | sort -u)
1342
+
1343
+ for project in $projects; do
1344
+ if [ -d "$project/front" ]; then
1345
+ echo "➡️ lint-staged pour $project/front"
1346
+ (cd "$project/front" && npx lint-staged) || exit 1
1347
+ fi
1348
+ done
1349
+ ```
1350
+
1351
+ - In your `package.json`, modify `prepare` script to run husky from the parent folder:
1352
+
1353
+ ```diff
1354
+ - "prepare": "husky"
1355
+ + "prepare": "cd ../.. && husky"
1356
+ ```
1357
+
1358
+ Then run:
1359
+
1360
+ ```bash
1361
+ npm install
1362
+ ```
1363
+
1364
+ You should see in your project root folder `.husky` a new folder `_`.
1365
+
1366
+ #### lint-staged
1367
+
1368
+ In your `package.json` file, check for existing `lint-staged` section and add/modify with the following content. If it does not exist, create it:
1369
+
1370
+ ```json
1371
+ "lint-staged": {
1372
+ "*.ts": [
1373
+ "eslint --fix",
1374
+ "prettier --config ./.prettierrc --write"
1375
+ ],
1376
+ "*.{js,jsx,json,css,scss,md,html}": [
1377
+ "prettier --config ./.prettierrc --write"
1378
+ ]
1379
+ },
1380
+ ```
1381
+
1382
+ #### Manually run formatting commands
1284
1383
 
1285
1384
  ```bash
1286
1385
  npm run format:prettier
@@ -1364,7 +1463,7 @@ npm install
1364
1463
 
1365
1464
  #### Build and launch your application
1366
1465
 
1367
- **NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
1466
+ 💡 **NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
1368
1467
 
1369
1468
  ```bash
1370
1469
  npm run build
@@ -1378,7 +1477,7 @@ Finally check if your tests run well :
1378
1477
  npm run test
1379
1478
  ```
1380
1479
 
1381
- > 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8 and check again your application**
1480
+ > 🚨 **Read carefully the following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8 and check again your application**
1382
1481
 
1383
1482
  ### Release your application using `jenkins-libs`
1384
1483