@dsivd/prestations-ng 19.0.0-beta.8 → 19.0.1

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,14 +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
155
156
 
156
157
  ### BO using jpa repositories
157
158
 
158
- 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
159
160
  identify store assignment for repository candidate interface", add the property in your application.properties :
160
161
 
161
- spring.data.jdbc.repositories.enabled=false
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.
162
168
 
163
169
  ### Debugging tips
164
170
 
@@ -180,20 +186,34 @@ mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.activeRecipes=or
180
186
 
181
187
  Take a look at Sonar to see other things that you can improve or ignore.
182
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
+
183
201
  ## PRESTATIONS-NG
184
202
 
185
- 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.
186
204
 
187
205
  The main feature in `prestations-ng` v19 is the update of the `@angular/*` peer dependencies
188
- 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.
207
+
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.
189
209
 
190
- A lot of breaking because our library has migrated to **standalone** components, **signals** and **inject function** instead of constructor injection parameters.
210
+ > 🚨 **Read carefully the following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
191
211
 
192
- > 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
212
+ > 🚨 **When working in a `multi-project` repository and `.husky` folder exists, delete `_` folder in `.husky` to be able to commit**
193
213
 
194
214
  ### Migrate to ESLint
195
215
 
196
- (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.**
197
217
 
198
218
  Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project from TSLint to ESLint.
199
219
 
@@ -201,14 +221,12 @@ Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project
201
221
 
202
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)
203
223
 
204
- **NB: Commit before continuing so your repository is clean.**
224
+ 💡 **NB: Commit before continuing so your repository is clean.**
205
225
 
206
- 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.
207
227
 
208
228
  In the next commands, commit before each ng update.
209
229
 
210
- Unlink `@dsivd/prestations-ng` by running `yarn unlink @dsivd/prestations-ng` in your `front` folder if you have linked it before.
211
-
212
230
  ```bash
213
231
  npm install
214
232
  npm install @angular/cli@19 -g
@@ -216,33 +234,6 @@ ng update @angular/core@19 @angular/cli@19
216
234
  ng update @dsivd/prestations-ng@18
217
235
  ```
218
236
 
219
- ```bash
220
- npm install @angular/cli@20 -g
221
- ng update @angular/core@20 @angular/cli@20
222
- ```
223
-
224
- When asked the question "Select the migrations that you'd like to run",
225
-
226
- accept **"use-application-builder"** by hitting "Space" key then "Enter".
227
-
228
- When asked the question "Select the migrations that you'd like to run",
229
-
230
- accept **"control-flow-migration"** by hitting "Space" key.
231
-
232
- accept **"router-current-navigation"** by hitting "Space" key.
233
-
234
- Then press "Enter" key.
235
-
236
- **IMPORTANT: Search for every `@for` in your project and check that `track` statement is present and has a unique identifier**
237
-
238
- **NB: When using `@angular/cdk` in your project**
239
-
240
- ```bash
241
- ng update @angular/cdk@20
242
- ```
243
-
244
- ### Running with node 22+
245
-
246
237
  #### Switch to node 22+
247
238
 
248
239
  ##### If you are using our `slave-apps`
@@ -255,7 +246,7 @@ Verify your node version in your terminal by executing:
255
246
  node -v
256
247
  ```
257
248
 
258
- **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+**
259
250
 
260
251
  ```bash
261
252
  node22
@@ -269,6 +260,40 @@ Be sure to use a node version 22+ in your terminal:
269
260
  node -v
270
261
  ```
271
262
 
263
+ ##### IntelliJ node version
264
+
265
+ Change the IntelliJ Node.js version to 22+ by going to
266
+
267
+ - `File > Settings > Languages & Frameworks > TypeScript` and selecting a node version 22+ in `Node runtime`.
268
+ - `File > Settings > Languages & Frameworks > JavaScript Runtime` and selecting a node version 22+ in `Node runtime`.
269
+
270
+ #### Continue with Angular 20 migration
271
+
272
+ ```bash
273
+ npm install @angular/cli@20 -g
274
+ ng update @angular/core@20 @angular/cli@20
275
+ ```
276
+
277
+ - When asked "Select the migrations that you'd like to run",
278
+ - accept **"use-application-builder"** by hitting "Space" key
279
+ - hit "Enter" key
280
+ - When asked "Select the migrations that you'd like to run",
281
+ - accept **"control-flow-migration"** by hitting "Space" key
282
+ - hit "Down arrow" key
283
+ - accept **"router-current-navigation"** by hitting "Space" key
284
+ - hit "Enter" key
285
+
286
+ 🚨 **IMPORTANT: Search for every `@for` in your project and check that `track` statement is present and has a unique identifier.
287
+ When a unique identifier such as `id` is not possible, track by object or as a last resort use `track $index`.**
288
+
289
+ 💡 **NB: When using `@angular/cdk` in your project**
290
+
291
+ ```bash
292
+ ng update @angular/cdk@20
293
+ ```
294
+
295
+ ### Running with node 22+
296
+
272
297
  #### In your project
273
298
 
274
299
  Update your `package.json` file to specify the node engine:
@@ -300,36 +325,37 @@ buildAppPipelinePodmanUT([
300
325
 
301
326
  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)
302
327
 
303
- **NB: Commit before continuing so your repository is clean.**
328
+ 💡 **NB: Commit before continuing so your repository is clean.**
329
+ 💡 **NB: When using `ngx-matomo-client` in your project, you will need to add `--force` to `ng update @dsivd/prestations-ng` and `npm install @types/node@22 ts-node@10`**
304
330
 
305
331
  ```bash
306
332
  npm install @angular/cli@21 -g
307
333
  ng update @dsivd/prestations-ng@latest
308
334
  ```
309
335
 
310
- When asked again the question "Select the migrations that you'd like to run",
311
-
312
- accept **"router-current-navigation"** by hitting "Space" key then "Enter".
336
+ - When asked again "Select the migrations that you'd like to run"
337
+ - accept **"router-current-navigation"** by hitting "Space" key
338
+ - hit "Enter" key
313
339
 
314
340
  ```bash
315
341
  ng update @angular/cli@21
316
342
  ```
317
343
 
318
- When asked the question "Select the migrations that you'd like to run",
319
-
320
- accept **"use-application-builder"** by hitting "Space" key then "Enter".
344
+ - When asked "Select the migrations that you'd like to run"
345
+ - accept **"use-application-builder"** by hitting "Space" key
346
+ - hit "Enter" key
321
347
 
322
348
  ```bash
323
349
  npm install @types/node@22 ts-node@10
324
350
  ```
325
351
 
326
- **NB: When using `@angular/cdk` in your project**
352
+ 💡 **NB: When using `@angular/cdk` in your project**
327
353
 
328
354
  ```bash
329
355
  ng update @angular/cdk@21
330
356
  ```
331
357
 
332
- **NB: When using `ngx-matomo-client` in your project**
358
+ 💡 **NB: When using `ngx-matomo-client` in your project**
333
359
 
334
360
  ```bash
335
361
  ng update ngx-matomo-client@9
@@ -348,18 +374,17 @@ ng update ngx-matomo-client@9
348
374
  ```
349
375
 
350
376
  - In your `.eslintrc.json`, remove `"/src/main.ts",` from `ignorePatterns`.
351
-
352
377
  - In `main.ts`, replace `platformBrowserDynamic` by `platformBrowser`.
353
-
354
378
  - When using `<foehn-list-summary` component, replace `list` by `model`.
355
379
 
356
380
  ### Now fix your project before continuing
357
381
 
358
- **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.**
382
+ 🚨 **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.**
359
383
 
360
- 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".
361
-
362
- Check every `constructor` in your project, and remove useless `constructor` parameters that are not used anymore (like `ActivatedRoute` in components extending `AbstractPageComponent`).
384
+ - Only keep `modules` related to your application, such as `AppRoutingModule`.
385
+ - 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). You can search for `<foehn-` with a file mask `*.html` to help you find standalone components.
386
+ - Add `providePrestationsNgCore(),` to the `providers` array of your `app.module.ts` file.
387
+ - Check every `constructor` in your project and remove unused `constructor` parameters (like `ActivatedRoute` in components extending `AbstractPageComponent`).
363
388
 
364
389
  Run the following command until you have no more errors.
365
390
 
@@ -367,7 +392,7 @@ Run the following command until you have no more errors.
367
392
  npm run build
368
393
  ```
369
394
 
370
- **TIP: If your IntelliJ is still showing you errors on `@if` or `@for`, close it and re-open it to fix.**
395
+ 💡 **TIP: If your IntelliJ is still showing you errors on `@if` or `@for`, close it and re-open it to fix.**
371
396
 
372
397
  ### Migrate to inject function
373
398
 
@@ -385,11 +410,13 @@ ng generate @angular/core:inject
385
410
  ✔ 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
386
411
  type safety. **Yes**
387
412
 
388
- Go through every file that has changed and fix what is broken.
413
+ Then:
414
+
415
+ - Go through every file that has changed and fix what is broken.
416
+ - Reorder public / private and remove unused imports so ESLINT is happy again.
389
417
 
390
- Reorder public / private and remove unused imports so ESLINT is happy again.
418
+ Little example of cleaning when extending `AbstractPageComponent`:
391
419
 
392
- For example, when extending `AbstractPageComponent`:
393
420
  Before:
394
421
 
395
422
  ```ts
@@ -417,7 +444,7 @@ Most of the time, you can remove `activatedRoute` because it was used as a const
417
444
 
418
445
  ### Migrate to self-closing tags
419
446
 
420
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
447
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
421
448
 
422
449
  ```bash
423
450
  npm run build
@@ -433,9 +460,9 @@ ng generate @angular/core:self-closing-tag
433
460
 
434
461
  ### Migrate to standalone
435
462
 
436
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
463
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
437
464
 
438
- **TIP: Check [Migrating from NgModules](COMPONENTS.md#migrating_from_ngmodules) for more information before running following commands.**
465
+ 💡 **TIP: Check [Migrating from NgModules](COMPONENTS.md#migrating_from_ngmodules) for more information before running the following commands.**
439
466
 
440
467
  ```bash
441
468
  npm run build
@@ -501,7 +528,7 @@ export const routes: Routes = [
501
528
  ];
502
529
  ```
503
530
 
504
- Create a file under `src/app` called `app.config.ts` with the following content:
531
+ Create a file under `src/app` called `app.config.ts` with the following content or adapt it to your needs:
505
532
 
506
533
  ```ts
507
534
  export const appConfig: ApplicationConfig = {
@@ -534,11 +561,11 @@ bootstrapApplication(AppComponent, appConfig).catch((err) =>
534
561
  );
535
562
  ```
536
563
 
537
- Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if it has not already been done.
564
+ Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if they have not already been removed.
538
565
 
539
566
  #### Migration to lazy-loaded routes when working with large applications
540
567
 
541
- You may have some other modules that are maybe lazy-loaded. Just be sure that all your components are standalone before continuing.
568
+ You may have some other modules that are lazy-loaded. Just be sure that all your components are standalone before continuing.
542
569
 
543
570
  > 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
571
 
@@ -548,7 +575,7 @@ You may have some other modules that are maybe lazy-loaded. Just be sure that al
548
575
  ng generate @angular/core:route-lazy-loading
549
576
  ```
550
577
 
551
- Here is a example when doing it manually because schematic above does not work as intended:
578
+ Here is an example when doing it manually because schematic above does not work as intended:
552
579
 
553
580
  Your `app.routing.ts` file should look something like this:
554
581
 
@@ -599,7 +626,7 @@ export const demandes_routes: Routes = [
599
626
 
600
627
  ### Migrate from NgClass to class bindings
601
628
 
602
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
629
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
603
630
 
604
631
  ```bash
605
632
  npm run build
@@ -615,9 +642,8 @@ ng generate @angular/core:ngclass-to-class
615
642
 
616
643
  ✔ Should the migration also migrate space-separated keys? **Yes**
617
644
 
618
- Check every file that has changed and fix what is broken.
619
-
620
- Check remaining `ngClass` usage in your project and replace it with class bindings.
645
+ - Check every file that has changed and fix what is broken.
646
+ - Check remaining `ngClass` usage in your project and replace it with class bindings.
621
647
 
622
648
  **Be aware that `[class]` replaces all element classes. When you have static classes, concatenate them with dynamic ones.**
623
649
 
@@ -667,7 +693,7 @@ After:
667
693
 
668
694
  ### Migrate from NgStyle to style bindings
669
695
 
670
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
696
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
671
697
 
672
698
  ```bash
673
699
  npm run build
@@ -683,13 +709,12 @@ ng generate @angular/core:ngstyle-to-style
683
709
 
684
710
  ✔ Should the migration also migrate object references? **No**
685
711
 
686
- Check every file that has changed and fix what is broken.
687
-
688
- Check remaining `ngStyle` usage in your project and replace it with style bindings.
712
+ - Check every file that has changed and fix what is broken.
713
+ - Check remaining `ngStyle` usage in your project and replace it with style bindings.
689
714
 
690
715
  ### Convert CommonModule usage to standalone imports
691
716
 
692
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
717
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
693
718
 
694
719
  ```bash
695
720
  npm run build
@@ -703,7 +728,7 @@ ng generate @angular/core:common-to-standalone
703
728
 
704
729
  ✔ Which directory do you want to migrate? **./**
705
730
 
706
- Check every file that has changed and fix what is broken.
731
+ - Check every file that has changed and fix what is broken.
707
732
 
708
733
  ### Migrate @HostListener
709
734
 
@@ -746,7 +771,7 @@ export class NumberCurrencyFormatterDirective implements OnInit {
746
771
 
747
772
  ### Migrate to signal queries
748
773
 
749
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
774
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
750
775
 
751
776
  ```bash
752
777
  npm run build
@@ -762,15 +787,13 @@ ng generate @angular/core:signal-queries-migration --insert-todos
762
787
 
763
788
  ✔ Do you want to migrate as much as possible, even if it may break your build? **No**
764
789
 
765
- Check every file that has changed and fix what is broken.
766
-
767
- Check every remaining `@ViewChild`, `@ViewChildren`, `@ContentChild`, and `@ContentChildren` usage in your project and replace them with signal queries.
768
-
769
- Check every **TODO** comment added by the migration and fix them.
790
+ - Check every file that has changed and fix what is broken.
791
+ - Check every remaining `@ViewChild`, `@ViewChildren`, `@ContentChild`, and `@ContentChildren` usage in your project and replace them with signal queries.
792
+ - Check every **TODO** comment added by the migration and fix them.
770
793
 
771
794
  ### Migrate to output functions
772
795
 
773
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
796
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
774
797
 
775
798
  ```bash
776
799
  npm run build
@@ -792,7 +815,7 @@ When needing to subscribe to an output, you can use `outputToObservable` from `@
792
815
 
793
816
  Check our [Angular signals guide](ANGULAR_SIGNALS.md) for more information about signals and input signals.
794
817
 
795
- **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
818
+ 🚨 **WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
796
819
 
797
820
  ```bash
798
821
  npm run build
@@ -808,11 +831,9 @@ ng generate @angular/core:signal-input-migration --insert-todos
808
831
 
809
832
  ✔ Do you want to migrate as much as possible, even if it may break your build? **No**
810
833
 
811
- Check every file that has changed and fix what is broken.
812
-
813
- Check every remaining `@Input` usage in your project and replace them with input signals.
814
-
815
- Check every **TODO** comment added by the migration and fix them.
834
+ - Check every file that has changed and fix what is broken.
835
+ - Check every remaining `@Input` usage in your project and replace them with input signals.
836
+ - Check every **TODO** comment added by the migration and fix them.
816
837
 
817
838
  ### Migrate to vitest
818
839
 
@@ -884,10 +905,10 @@ npm uninstall @types/jasmine @types/jasminewd2
884
905
  rm karma.conf.js
885
906
  ```
886
907
 
887
- Now search for `karma.conf.js` in your project and remove all references to it.
888
- Now search for `protractor.conf.js` in your project and remove them if they still exist.
908
+ - search for `karma.conf.js` in your project and remove all references to it.
909
+ - search for `protractor.conf.js` in your project and remove them if they still exist.
889
910
 
890
- Then run following command to migrate from jasmine to vitest:
911
+ Then run the following command to migrate from jasmine to vitest:
891
912
 
892
913
  ```bash
893
914
  ng g @schematics/angular:refactor-jasmine-vitest
@@ -976,6 +997,28 @@ describe('AppComponent', () => {
976
997
  });
977
998
  ```
978
999
 
1000
+ #### Running fakeAsync tests using spyOnProperty with Vitest
1001
+
1002
+ Example of transformation:
1003
+
1004
+ ```diff
1005
+ beforeEach(() => {
1006
+ - spyOnProperty(sessionInfo, 'data').and.returnValue(of(sessionInfoData));
1007
+ + vi.spyOn(sessionInfo, 'data', 'get').mockReturnValue(of(sessionInfoData));
1008
+ });
1009
+
1010
+ - it('should properly map the initial data', fakeAsync(() => {
1011
+ + it('should properly map the initial data', async () => {
1012
+ const form = new MenuOrderForm();
1013
+ - service.enrichWithSessionInfoData(form);
1014
+ - tick(200);
1015
+ + await firstValueFrom(service.enrichWithSessionInfoData(form));
1016
+
1017
+ // expect(...) here
1018
+ - }));
1019
+ + });
1020
+ ```
1021
+
979
1022
  ### Migrate to eslint flat configuration
980
1023
 
981
1024
  ```bash
@@ -1031,9 +1074,8 @@ Remove your old `.eslintrc.json` file in your `front` folder:
1031
1074
  rm .eslintrc.json
1032
1075
  ```
1033
1076
 
1034
- Now search for `.eslintrc.json` in your project and remove them.
1035
-
1036
- Then add a new `eslint.config.mjs` file with the following content:
1077
+ - search for `.eslintrc.json` in your project and remove them.
1078
+ - add a new `eslint.config.mjs` file with the following content:
1037
1079
 
1038
1080
  ```ts
1039
1081
  // @ts-check
@@ -1201,9 +1243,9 @@ export default tseslint.config(
1201
1243
  );
1202
1244
  ```
1203
1245
 
1204
- #### Delete `typing.d.ts`
1246
+ #### Delete `typings.d.ts`
1205
1247
 
1206
- In `front/src/`, remove the file `typing.d.ts` if it is still there.
1248
+ In `front/src/`, remove the file `typings.d.ts` if it is still there.
1207
1249
 
1208
1250
  #### Update your tsconfig\*.json files
1209
1251
 
@@ -1277,6 +1319,8 @@ In `front/src/`, remove the file `typing.d.ts` if it is still there.
1277
1319
 
1278
1320
  ### Husky pre-commit hook
1279
1321
 
1322
+ 💡 **Tip: For multi-projects, see section below `Husky pre-commit hook for multi-project repository`**
1323
+
1280
1324
  ```bash
1281
1325
  npm install --save-dev husky lint-staged
1282
1326
  npx husky init
@@ -1287,14 +1331,95 @@ mv ./.husky ../.husky
1287
1331
  git add -A
1288
1332
  ```
1289
1333
 
1290
- - You can manually run formating commands as well:
1334
+ - In your `package.json`, modify `prepare` script to run husky from the parent folder:
1335
+
1336
+ ```diff
1337
+ - "prepare": "husky"
1338
+ + "prepare": "cd .. && husky"
1339
+ ```
1340
+
1341
+ Then run:
1342
+
1343
+ ```bash
1344
+ npm install
1345
+ ```
1346
+
1347
+ You should see in your project root folder `.husky` a new folder `_`.
1348
+
1349
+ #### Husky pre-commit hook for multi-project repository
1350
+
1351
+ 💡 **Tip: Skip this part if you are not in a multi-project repository and follow section `Husky pre-commit hook`**
1352
+ 🚨 **WARNING: You need to repeat this section for every "child" project**
1353
+
1354
+ ```bash
1355
+ npm install --save-dev husky lint-staged
1356
+ npx husky init
1357
+ chmod +x .husky/pre-commit
1358
+ ```
1359
+
1360
+ ---
1361
+
1362
+ 🚨 **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.**
1363
+
1364
+ ```bash
1365
+ mv ./.husky ../../.husky
1366
+ git add -A
1367
+ ```
1368
+
1369
+ Replace `.husky/pre-commit` content with the following:
1370
+
1371
+ ```bash
1372
+ projects=$(git diff --cached --name-only --diff-filter=ACMR | awk -F'/' '{print $1}' | sort -u)
1373
+
1374
+ for project in $projects; do
1375
+ if [ -d "$project/front" ]; then
1376
+ echo "➡️ lint-staged pour $project/front"
1377
+ (cd "$project/front" && npx lint-staged) || exit 1
1378
+ fi
1379
+ done
1380
+ ```
1381
+
1382
+ ---
1383
+
1384
+ Now continue adapting your `package.json` and modify `prepare` script to run husky from the parent folder:
1385
+
1386
+ ```diff
1387
+ - "prepare": "husky"
1388
+ + "prepare": "cd ../.. && husky"
1389
+ ```
1390
+
1391
+ Then run:
1392
+
1393
+ ```bash
1394
+ npm install
1395
+ ```
1396
+
1397
+ You should see in your project root folder `.husky` a new folder `_`.
1398
+
1399
+ #### lint-staged
1400
+
1401
+ 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:
1402
+
1403
+ ```json
1404
+ "lint-staged": {
1405
+ "*.ts": [
1406
+ "eslint --fix",
1407
+ "prettier --config ./.prettierrc --write"
1408
+ ],
1409
+ "*.{js,jsx,json,css,scss,md,html}": [
1410
+ "prettier --config ./.prettierrc --write"
1411
+ ]
1412
+ },
1413
+ ```
1414
+
1415
+ #### Manually run formatting commands
1291
1416
 
1292
1417
  ```bash
1293
1418
  npm run format:prettier
1294
1419
  npm run lint
1295
1420
  ```
1296
1421
 
1297
- Fix your `meta.service.ts` but replacing:
1422
+ Fix your `meta.service.ts` by replacing:
1298
1423
 
1299
1424
  Before:
1300
1425
 
@@ -1346,6 +1471,15 @@ npm uninstall @angular/platform-browser-dynamic
1346
1471
  npm uninstall @angular/animations
1347
1472
  ```
1348
1473
 
1474
+ ### Add missing `^` or `~` in `package.json` devDependencies
1475
+
1476
+ 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:
1477
+
1478
+ ```bash
1479
+ npm install
1480
+ npm update
1481
+ ```
1482
+
1349
1483
  ### Configure IntelliJ IDEA to use ESLint and Prettier on save
1350
1484
 
1351
1485
  - To configure ESLint automatically in the current project, open "_File -> Settings..._" (`Ctrl+Alt+S`) and either:
@@ -1371,7 +1505,7 @@ npm install
1371
1505
 
1372
1506
  #### Build and launch your application
1373
1507
 
1374
- **NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
1508
+ 💡 **NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
1375
1509
 
1376
1510
  ```bash
1377
1511
  npm run build
@@ -1385,7 +1519,7 @@ Finally check if your tests run well :
1385
1519
  npm run test
1386
1520
  ```
1387
1521
 
1388
- > 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8 and check again your application**
1522
+ > 🚨 **Read carefully the following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8 and check again your application**
1389
1523
 
1390
1524
  ### Release your application using `jenkins-libs`
1391
1525
 
Binary file