@dsivd/prestations-ng 19.0.0-beta.7 → 19.0.0

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,11 +77,11 @@ 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
 
84
- If you are using Brave Tracer (search `brace.Tracer` in the code, usually in backoffices), you need to replace it with
84
+ If you are using Brave Tracer (search `brave.Tracer` in the code, usually in backoffices), you need to replace it with
85
85
  OpenTelemetry by adding the following dependencies (already included by `ch.vd.cyber:starter-bo-jdbc-jms` and `ch.vd.cyber:starter-prestation`):
86
86
 
87
87
  ```xml
@@ -102,7 +102,8 @@ And replace `brave.Tracer` imports by `io.micrometer.tracing.Tracer`;
102
102
 
103
103
  This base class has been moved from `ch.vd.cyber.sdk:cyberadmin-be` to `ch.vd.cyber.sdk:backoffice-be`
104
104
  and renamed `EsbMessageListenerWithTracingPropagation`.
105
- the constructor has also been updated :
105
+
106
+ The constructor has also been updated :
106
107
 
107
108
  ```java
108
109
  import ch.vd.cyberadminbe.jms.EsbMessageListenerWithSleuthIntegration;
@@ -132,7 +133,7 @@ public class MyListener extends EsbMessageListenerWithTracingPropagation {
132
133
  }
133
134
  ```
134
135
 
135
- finally, if you have mock issues with you 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)`
136
137
 
137
138
  ### BO : ESB Integration
138
139
 
@@ -151,7 +152,19 @@ Run your application with this dependency :
151
152
  </dependency>
152
153
  ```
153
154
 
154
- 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
+
157
+ ### BO using jpa repositories
158
+
159
+ As we also have jdbc in the classpath, to avoid having dozens of logs like "Spring Data JDBC - Could not safely
160
+ identify store assignment for repository candidate interface", add the property in your application.properties :
161
+
162
+ `spring.data.jdbc.repositories.enabled=false`
163
+
164
+ ### BO using json payloads with primitives properties
165
+
166
+ `spring.jackson.deserialization.fail-on-null-for-primitives=false`
167
+ or update all concerned payloads to use wrapper classes instead of primitives.
155
168
 
156
169
  ### Debugging tips
157
170
 
@@ -173,20 +186,34 @@ mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.activeRecipes=or
173
186
 
174
187
  Take a look at Sonar to see other things that you can improve or ignore.
175
188
 
189
+ ### Postfinance 9.5.0
190
+
191
+ Since prestations-be 19.0.3, Postfinance dependency was updated to 9.5.0. Methods signatures and package have moved
192
+ but it is the only change that needs to be made on your application. The rest is handled by prestations-be.
193
+
194
+ You can run the renaming in your application :
195
+
196
+ ```bash
197
+ grep -rl 'ch\.postfinance\.sdk' --include='*.java' . \
198
+ | xargs perl -pi -e 's/\bch\.postfinance\.sdk\b/ch.postfinancecheckout.sdk/g'
199
+ ```
200
+
176
201
  ## PRESTATIONS-NG
177
202
 
178
- For the commands in this guide, it is supposed that your are in the `front` folder of your project.
203
+ For the commands in this guide, it is assumed that you are in the `front` folder of your project.
179
204
 
180
205
  The main feature in `prestations-ng` v19 is the update of the `@angular/*` peer dependencies
181
- to `^21.2.14`, using `node 22+` to build, `npm 10+` for package manager and `Foehn 2+ (Bootstrap 5+)` for our design system.
206
+ to `^21.2.14`, using `node 22+` to build, `npm 10+` as package manager, and `Foehn 2+ (Bootstrap 5+)` for our design system.
182
207
 
183
- A lot of breaking because our library has migrated to **standalone** components, **signals** and **inject function** instead of constructor injection parameters.
208
+ 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.
184
209
 
185
- > 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
210
+ > 🚨 **Read carefully the following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
211
+
212
+ > 🚨 **When working in a `multi-project` repository and `.husky` folder exists, delete `_` folder in `.husky` to be able to commit**
186
213
 
187
214
  ### Migrate to ESLint
188
215
 
189
- (NB : you can skip this step if you already have a `front/.eslintrc.json` file, it means it is already done.)
216
+ 💡 **NB : you can skip this step if you already have a `front/.eslintrc.json` file, it means it is already done.**
190
217
 
191
218
  Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project from TSLint to ESLint.
192
219
 
@@ -194,14 +221,12 @@ Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project
194
221
 
195
222
  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)
196
223
 
197
- **NB: Commit before continuing so your repository is clean.**
224
+ 💡 **NB: Commit before continuing so your repository is clean.**
198
225
 
199
- Remove your `resolutions` in `package.json` before starting : if you have `resolutions` in `package.json`, remove manually the section.
226
+ Remove your `resolutions` in `package.json` before starting: if you have `resolutions` in `package.json`, remove the section manually.
200
227
 
201
228
  In the next commands, commit before each ng update.
202
229
 
203
- Unlink `@dsivd/prestations-ng` by running `yarn unlink @dsivd/prestations-ng` in your `front` folder if you have linked it before.
204
-
205
230
  ```bash
206
231
  npm install
207
232
  npm install @angular/cli@19 -g
@@ -209,33 +234,6 @@ ng update @angular/core@19 @angular/cli@19
209
234
  ng update @dsivd/prestations-ng@18
210
235
  ```
211
236
 
212
- ```bash
213
- npm install @angular/cli@20 -g
214
- ng update @angular/core@20 @angular/cli@20
215
- ```
216
-
217
- When asked the question "Select the migrations that you'd like to run",
218
-
219
- accept **"use-application-builder"** by hitting "Space" key then "Enter".
220
-
221
- When asked the question "Select the migrations that you'd like to run",
222
-
223
- accept **"control-flow-migration"** by hitting "Space" key.
224
-
225
- accept **"router-current-navigation"** by hitting "Space" key.
226
-
227
- Then press "Enter" key.
228
-
229
- **IMPORTANT: Search for every `@for` in your project and check that `track` statement is present and has a unique identifier**
230
-
231
- **NB: When using `@angular/cdk` in your project**
232
-
233
- ```bash
234
- ng update @angular/cdk@20
235
- ```
236
-
237
- ### Running with node 22+
238
-
239
237
  #### Switch to node 22+
240
238
 
241
239
  ##### If you are using our `slave-apps`
@@ -248,7 +246,7 @@ Verify your node version in your terminal by executing:
248
246
  node -v
249
247
  ```
250
248
 
251
- **NB: If version is still v20+ by default, type `node22` in your terminal to switch to node v22+**
249
+ 💡 **NB: If the version is still v20+ by default, type `node22` in your terminal to switch to node v22+**
252
250
 
253
251
  ```bash
254
252
  node22
@@ -262,6 +260,37 @@ Be sure to use a node version 22+ in your terminal:
262
260
  node -v
263
261
  ```
264
262
 
263
+ ##### IntelliJ node version
264
+
265
+ 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`.
266
+
267
+ #### Continue with Angular 20 migration
268
+
269
+ ```bash
270
+ npm install @angular/cli@20 -g
271
+ ng update @angular/core@20 @angular/cli@20
272
+ ```
273
+
274
+ - When asked "Select the migrations that you'd like to run",
275
+ - accept **"use-application-builder"** by hitting "Space" key
276
+ - hit "Enter" key
277
+ - When asked "Select the migrations that you'd like to run",
278
+ - accept **"control-flow-migration"** by hitting "Space" key
279
+ - hit "Down arrow" key
280
+ - accept **"router-current-navigation"** by hitting "Space" key
281
+ - hit "Enter" key
282
+
283
+ 🚨 **IMPORTANT: Search for every `@for` in your project and check that `track` statement is present and has a unique identifier.
284
+ When a unique identifier such as `id` is not possible, track by object or as a last resort use `track $index`.**
285
+
286
+ 💡 **NB: When using `@angular/cdk` in your project**
287
+
288
+ ```bash
289
+ ng update @angular/cdk@20
290
+ ```
291
+
292
+ ### Running with node 22+
293
+
265
294
  #### In your project
266
295
 
267
296
  Update your `package.json` file to specify the node engine:
@@ -293,36 +322,36 @@ buildAppPipelinePodmanUT([
293
322
 
294
323
  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)
295
324
 
296
- **NB: Commit before continuing so your repository is clean.**
325
+ 💡 **NB: Commit before continuing so your repository is clean.**
297
326
 
298
327
  ```bash
299
328
  npm install @angular/cli@21 -g
300
329
  ng update @dsivd/prestations-ng@latest
301
330
  ```
302
331
 
303
- When asked again the question "Select the migrations that you'd like to run",
304
-
305
- accept **"router-current-navigation"** by hitting "Space" key then "Enter".
332
+ - When asked again "Select the migrations that you'd like to run"
333
+ - accept **"router-current-navigation"** by hitting "Space" key
334
+ - hit "Enter" key
306
335
 
307
336
  ```bash
308
337
  ng update @angular/cli@21
309
338
  ```
310
339
 
311
- When asked the question "Select the migrations that you'd like to run",
312
-
313
- accept **"use-application-builder"** by hitting "Space" key then "Enter".
340
+ - When asked "Select the migrations that you'd like to run"
341
+ - accept **"use-application-builder"** by hitting "Space" key
342
+ - hit "Enter" key
314
343
 
315
344
  ```bash
316
345
  npm install @types/node@22 ts-node@10
317
346
  ```
318
347
 
319
- **NB: When using `@angular/cdk` in your project**
348
+ 💡 **NB: When using `@angular/cdk` in your project**
320
349
 
321
350
  ```bash
322
351
  ng update @angular/cdk@21
323
352
  ```
324
353
 
325
- **NB: When using `ngx-matomo-client` in your project**
354
+ 💡 **NB: When using `ngx-matomo-client` in your project**
326
355
 
327
356
  ```bash
328
357
  ng update ngx-matomo-client@9
@@ -341,18 +370,17 @@ ng update ngx-matomo-client@9
341
370
  ```
342
371
 
343
372
  - In your `.eslintrc.json`, remove `"/src/main.ts",` from `ignorePatterns`.
344
-
345
373
  - In `main.ts`, replace `platformBrowserDynamic` by `platformBrowser`.
346
-
347
374
  - When using `<foehn-list-summary` component, replace `list` by `model`.
348
375
 
349
376
  ### Now fix your project before continuing
350
377
 
351
- **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.**
378
+ 🚨 **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.**
352
379
 
353
- Remove all your `@dsivd/prestations-ng` imports of modules and make sure you are using the new standalone components instead by adding them directly from your html file "alt+enter".
354
-
355
- Check every `constructor` in your project, and remove useless `constructor` parameters that are not used anymore (like `ActivatedRoute` in components extending `AbstractPageComponent`).
380
+ - Only keep `modules` related to your application, such as `AppRoutingModule`.
381
+ - 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).
382
+ - Add `providePrestationsNgCore(),` to the `providers` array of your `app.module.ts` file.
383
+ - Check every `constructor` in your project and remove unused `constructor` parameters (like `ActivatedRoute` in components extending `AbstractPageComponent`).
356
384
 
357
385
  Run the following command until you have no more errors.
358
386
 
@@ -360,7 +388,7 @@ Run the following command until you have no more errors.
360
388
  npm run build
361
389
  ```
362
390
 
363
- **TIP: If your IntelliJ is still showing you errors on `@if` or `@for`, close it and re-open it to fix.**
391
+ 💡 **TIP: If your IntelliJ is still showing you errors on `@if` or `@for`, close it and re-open it to fix.**
364
392
 
365
393
  ### Migrate to inject function
366
394
 
@@ -378,11 +406,13 @@ ng generate @angular/core:inject
378
406
  ✔ Do you want optional inject calls to be non-nullable? Enable this option if you want the return type to be identical to @Optional(), at the expense of worse
379
407
  type safety. **Yes**
380
408
 
381
- Go through every file that has changed and fix what is broken.
409
+ Then:
410
+
411
+ - Go through every file that has changed and fix what is broken.
412
+ - Reorder public / private and remove unused imports so ESLINT is happy again.
382
413
 
383
- Reorder public / private and remove unused imports so ESLINT is happy again.
414
+ Little example of cleaning when extending `AbstractPageComponent`:
384
415
 
385
- For example, when extending `AbstractPageComponent`:
386
416
  Before:
387
417
 
388
418
  ```ts
@@ -410,7 +440,7 @@ Most of the time, you can remove `activatedRoute` because it was used as a const
410
440
 
411
441
  ### Migrate to self-closing tags
412
442
 
413
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
443
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
414
444
 
415
445
  ```bash
416
446
  npm run build
@@ -426,9 +456,9 @@ ng generate @angular/core:self-closing-tag
426
456
 
427
457
  ### Migrate to standalone
428
458
 
429
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
459
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
430
460
 
431
- **TIP: Check [Migrating from NgModules](COMPONENTS.md#migrating_from_ngmodules) for more information before running following commands.**
461
+ 💡 **TIP: Check [Migrating from NgModules](COMPONENTS.md#migrating_from_ngmodules) for more information before running the following commands.**
432
462
 
433
463
  ```bash
434
464
  npm run build
@@ -527,11 +557,11 @@ bootstrapApplication(AppComponent, appConfig).catch((err) =>
527
557
  );
528
558
  ```
529
559
 
530
- Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if it has not already been done.
560
+ Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if they have not already been removed.
531
561
 
532
562
  #### Migration to lazy-loaded routes when working with large applications
533
563
 
534
- You may have some other modules that are maybe lazy-loaded. Just be sure that all your components are standalone before continuing.
564
+ You may have some other modules that are lazy-loaded. Just be sure that all your components are standalone before continuing.
535
565
 
536
566
  > 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.
537
567
 
@@ -541,7 +571,7 @@ You may have some other modules that are maybe lazy-loaded. Just be sure that al
541
571
  ng generate @angular/core:route-lazy-loading
542
572
  ```
543
573
 
544
- Here is a example when doing it manually because schematic above does not work as intended:
574
+ Here is an example when doing it manually because schematic above does not work as intended:
545
575
 
546
576
  Your `app.routing.ts` file should look something like this:
547
577
 
@@ -592,7 +622,7 @@ export const demandes_routes: Routes = [
592
622
 
593
623
  ### Migrate from NgClass to class bindings
594
624
 
595
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
625
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
596
626
 
597
627
  ```bash
598
628
  npm run build
@@ -608,9 +638,8 @@ ng generate @angular/core:ngclass-to-class
608
638
 
609
639
  ✔ Should the migration also migrate space-separated keys? **Yes**
610
640
 
611
- Check every file that has changed and fix what is broken.
612
-
613
- Check remaining `ngClass` usage in your project and replace it with class bindings.
641
+ - Check every file that has changed and fix what is broken.
642
+ - Check remaining `ngClass` usage in your project and replace it with class bindings.
614
643
 
615
644
  **Be aware that `[class]` replaces all element classes. When you have static classes, concatenate them with dynamic ones.**
616
645
 
@@ -660,7 +689,7 @@ After:
660
689
 
661
690
  ### Migrate from NgStyle to style bindings
662
691
 
663
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
692
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
664
693
 
665
694
  ```bash
666
695
  npm run build
@@ -676,13 +705,12 @@ ng generate @angular/core:ngstyle-to-style
676
705
 
677
706
  ✔ Should the migration also migrate object references? **No**
678
707
 
679
- Check every file that has changed and fix what is broken.
680
-
681
- Check remaining `ngStyle` usage in your project and replace it with style bindings.
708
+ - Check every file that has changed and fix what is broken.
709
+ - Check remaining `ngStyle` usage in your project and replace it with style bindings.
682
710
 
683
711
  ### Convert CommonModule usage to standalone imports
684
712
 
685
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
713
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
686
714
 
687
715
  ```bash
688
716
  npm run build
@@ -696,7 +724,7 @@ ng generate @angular/core:common-to-standalone
696
724
 
697
725
  ✔ Which directory do you want to migrate? **./**
698
726
 
699
- Check every file that has changed and fix what is broken.
727
+ - Check every file that has changed and fix what is broken.
700
728
 
701
729
  ### Migrate @HostListener
702
730
 
@@ -739,7 +767,7 @@ export class NumberCurrencyFormatterDirective implements OnInit {
739
767
 
740
768
  ### Migrate to signal queries
741
769
 
742
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
770
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
743
771
 
744
772
  ```bash
745
773
  npm run build
@@ -755,15 +783,13 @@ ng generate @angular/core:signal-queries-migration --insert-todos
755
783
 
756
784
  ✔ Do you want to migrate as much as possible, even if it may break your build? **No**
757
785
 
758
- Check every file that has changed and fix what is broken.
759
-
760
- Check every remaining `@ViewChild`, `@ViewChildren`, `@ContentChild`, and `@ContentChildren` usage in your project and replace them with signal queries.
761
-
762
- Check every **TODO** comment added by the migration and fix them.
786
+ - Check every file that has changed and fix what is broken.
787
+ - Check every remaining `@ViewChild`, `@ViewChildren`, `@ContentChild`, and `@ContentChildren` usage in your project and replace them with signal queries.
788
+ - Check every **TODO** comment added by the migration and fix them.
763
789
 
764
790
  ### Migrate to output functions
765
791
 
766
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
792
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
767
793
 
768
794
  ```bash
769
795
  npm run build
@@ -785,7 +811,7 @@ When needing to subscribe to an output, you can use `outputToObservable` from `@
785
811
 
786
812
  Check our [Angular signals guide](ANGULAR_SIGNALS.md) for more information about signals and input signals.
787
813
 
788
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
814
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
789
815
 
790
816
  ```bash
791
817
  npm run build
@@ -801,11 +827,9 @@ ng generate @angular/core:signal-input-migration --insert-todos
801
827
 
802
828
  ✔ Do you want to migrate as much as possible, even if it may break your build? **No**
803
829
 
804
- Check every file that has changed and fix what is broken.
805
-
806
- Check every remaining `@Input` usage in your project and replace them with input signals.
807
-
808
- Check every **TODO** comment added by the migration and fix them.
830
+ - Check every file that has changed and fix what is broken.
831
+ - Check every remaining `@Input` usage in your project and replace them with input signals.
832
+ - Check every **TODO** comment added by the migration and fix them.
809
833
 
810
834
  ### Migrate to vitest
811
835
 
@@ -877,10 +901,10 @@ npm uninstall @types/jasmine @types/jasminewd2
877
901
  rm karma.conf.js
878
902
  ```
879
903
 
880
- Now search for `karma.conf.js` in your project and remove all references to it.
881
- Now search for `protractor.conf.js` in your project and remove them if they still exist.
904
+ - search for `karma.conf.js` in your project and remove all references to it.
905
+ - search for `protractor.conf.js` in your project and remove them if they still exist.
882
906
 
883
- Then run following command to migrate from jasmine to vitest:
907
+ Then run the following command to migrate from jasmine to vitest:
884
908
 
885
909
  ```bash
886
910
  ng g @schematics/angular:refactor-jasmine-vitest
@@ -969,6 +993,28 @@ describe('AppComponent', () => {
969
993
  });
970
994
  ```
971
995
 
996
+ #### Running fakeAsync tests using spyOnProperty with Vitest
997
+
998
+ Example of transformation:
999
+
1000
+ ```diff
1001
+ beforeEach(() => {
1002
+ - spyOnProperty(sessionInfo, 'data').and.returnValue(of(sessionInfoData));
1003
+ + vi.spyOn(sessionInfo, 'data', 'get').mockReturnValue(of(sessionInfoData));
1004
+ });
1005
+
1006
+ - it('should properly map the initial data', fakeAsync(() => {
1007
+ + it('should properly map the initial data', async () => {
1008
+ const form = new MenuOrderForm();
1009
+ - service.enrichWithSessionInfoData(form);
1010
+ - tick(200);
1011
+ + await firstValueFrom(service.enrichWithSessionInfoData(form));
1012
+
1013
+ // expect(...) here
1014
+ - }));
1015
+ + });
1016
+ ```
1017
+
972
1018
  ### Migrate to eslint flat configuration
973
1019
 
974
1020
  ```bash
@@ -1024,9 +1070,8 @@ Remove your old `.eslintrc.json` file in your `front` folder:
1024
1070
  rm .eslintrc.json
1025
1071
  ```
1026
1072
 
1027
- Now search for `.eslintrc.json` in your project and remove them.
1028
-
1029
- Then add a new `eslint.config.mjs` file with the following content:
1073
+ - search for `.eslintrc.json` in your project and remove them.
1074
+ - add a new `eslint.config.mjs` file with the following content:
1030
1075
 
1031
1076
  ```ts
1032
1077
  // @ts-check
@@ -1194,9 +1239,9 @@ export default tseslint.config(
1194
1239
  );
1195
1240
  ```
1196
1241
 
1197
- #### Delete `typing.d.ts`
1242
+ #### Delete `typings.d.ts`
1198
1243
 
1199
- In `front/src/`, remove the file `typing.d.ts` if it is still there.
1244
+ In `front/src/`, remove the file `typings.d.ts` if it is still there.
1200
1245
 
1201
1246
  #### Update your tsconfig\*.json files
1202
1247
 
@@ -1270,6 +1315,8 @@ In `front/src/`, remove the file `typing.d.ts` if it is still there.
1270
1315
 
1271
1316
  ### Husky pre-commit hook
1272
1317
 
1318
+ 💡 **Tip: For multi-projects, see section below `Husky pre-commit hook for multi-project repository`**
1319
+
1273
1320
  ```bash
1274
1321
  npm install --save-dev husky lint-staged
1275
1322
  npx husky init
@@ -1280,14 +1327,95 @@ mv ./.husky ../.husky
1280
1327
  git add -A
1281
1328
  ```
1282
1329
 
1283
- - You can manually run formating commands as well:
1330
+ - In your `package.json`, modify `prepare` script to run husky from the parent folder:
1331
+
1332
+ ```diff
1333
+ - "prepare": "husky"
1334
+ + "prepare": "cd .. && husky"
1335
+ ```
1336
+
1337
+ Then run:
1338
+
1339
+ ```bash
1340
+ npm install
1341
+ ```
1342
+
1343
+ You should see in your project root folder `.husky` a new folder `_`.
1344
+
1345
+ #### Husky pre-commit hook for multi-project repository
1346
+
1347
+ 💡 **Tip: Skip this part if you are not in a multi-project repository and follow section `Husky pre-commit hook`**
1348
+ 🚨 **WARNING: You need to repeat this section for every "child" project**
1349
+
1350
+ ```bash
1351
+ npm install --save-dev husky lint-staged
1352
+ npx husky init
1353
+ chmod +x .husky/pre-commit
1354
+ ```
1355
+
1356
+ ---
1357
+
1358
+ 🚨 **WARNING: To be done in your "child" project folder only when migrating your first project. For other projects, you can skip this step and remove the `.husky` folder in your "child" project folder.**
1359
+
1360
+ ```bash
1361
+ mv ./.husky ../../.husky
1362
+ git add -A
1363
+ ```
1364
+
1365
+ Replace `.husky/pre-commit` content with the following:
1366
+
1367
+ ```bash
1368
+ projects=$(git diff --cached --name-only --diff-filter=ACMR | awk -F'/' '{print $1}' | sort -u)
1369
+
1370
+ for project in $projects; do
1371
+ if [ -d "$project/front" ]; then
1372
+ echo "➡️ lint-staged pour $project/front"
1373
+ (cd "$project/front" && npx lint-staged) || exit 1
1374
+ fi
1375
+ done
1376
+ ```
1377
+
1378
+ ---
1379
+
1380
+ Now continue adapting your `package.json` and modify `prepare` script to run husky from the parent folder:
1381
+
1382
+ ```diff
1383
+ - "prepare": "husky"
1384
+ + "prepare": "cd ../.. && husky"
1385
+ ```
1386
+
1387
+ Then run:
1388
+
1389
+ ```bash
1390
+ npm install
1391
+ ```
1392
+
1393
+ You should see in your project root folder `.husky` a new folder `_`.
1394
+
1395
+ #### lint-staged
1396
+
1397
+ 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:
1398
+
1399
+ ```json
1400
+ "lint-staged": {
1401
+ "*.ts": [
1402
+ "eslint --fix",
1403
+ "prettier --config ./.prettierrc --write"
1404
+ ],
1405
+ "*.{js,jsx,json,css,scss,md,html}": [
1406
+ "prettier --config ./.prettierrc --write"
1407
+ ]
1408
+ },
1409
+ ```
1410
+
1411
+ #### Manually run formatting commands
1284
1412
 
1285
1413
  ```bash
1286
1414
  npm run format:prettier
1287
1415
  npm run lint
1288
1416
  ```
1289
1417
 
1290
- Fix your `meta.service.ts` but replacing:
1418
+ Fix your `meta.service.ts` by replacing:
1291
1419
 
1292
1420
  Before:
1293
1421
 
@@ -1339,6 +1467,15 @@ npm uninstall @angular/platform-browser-dynamic
1339
1467
  npm uninstall @angular/animations
1340
1468
  ```
1341
1469
 
1470
+ ### Add missing `^` or `~` in `package.json` devDependencies
1471
+
1472
+ Check you devDependencies in your `package.json` file and add `^` in front of every version number if missing excepted for `typescript` where you should add `~`. Then run:
1473
+
1474
+ ```bash
1475
+ npm install
1476
+ npm update
1477
+ ```
1478
+
1342
1479
  ### Configure IntelliJ IDEA to use ESLint and Prettier on save
1343
1480
 
1344
1481
  - To configure ESLint automatically in the current project, open "_File -> Settings..._" (`Ctrl+Alt+S`) and either:
@@ -1364,7 +1501,7 @@ npm install
1364
1501
 
1365
1502
  #### Build and launch your application
1366
1503
 
1367
- **NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
1504
+ 💡 **NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
1368
1505
 
1369
1506
  ```bash
1370
1507
  npm run build
@@ -1378,7 +1515,7 @@ Finally check if your tests run well :
1378
1515
  npm run test
1379
1516
  ```
1380
1517
 
1381
- > 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8 and check again your application**
1518
+ > 🚨 **Read carefully the following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8 and check again your application**
1382
1519
 
1383
1520
  ### Release your application using `jenkins-libs`
1384
1521
 
Binary file