@dsivd/prestations-ng 19.0.0-beta.8 → 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/.browserslistrc +19 -6
- package/CHANGELOG.md +3 -0
- package/UPGRADING_V19.md +239 -109
- package/dsivd-prestations-ng-19.0.0.tgz +0 -0
- package/fesm2022/dsivd-prestations-ng.mjs +507 -486
- package/fesm2022/dsivd-prestations-ng.mjs.map +1 -1
- package/package.json +2 -2
- package/types/dsivd-prestations-ng.d.ts +7 -1
- package/dsivd-prestations-ng-19.0.0-beta.8.tgz +0 -0
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
|
|
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
|
|
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
|
|
65
|
+
And replace the old `AutoConfigureMockMvc` import, which is not recognized anymore, with the new one.
|
|
66
66
|
|
|
67
|
-
If
|
|
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 `
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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+`
|
|
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
|
-
|
|
210
|
+
> 🚨 **Read carefully the following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
|
|
191
211
|
|
|
192
|
-
> 🚨 **
|
|
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
|
-
|
|
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
|
|
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,37 @@ 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 `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
|
+
|
|
272
294
|
#### In your project
|
|
273
295
|
|
|
274
296
|
Update your `package.json` file to specify the node engine:
|
|
@@ -300,36 +322,36 @@ buildAppPipelinePodmanUT([
|
|
|
300
322
|
|
|
301
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)
|
|
302
324
|
|
|
303
|
-
**NB: Commit before continuing so your repository is clean.**
|
|
325
|
+
💡 **NB: Commit before continuing so your repository is clean.**
|
|
304
326
|
|
|
305
327
|
```bash
|
|
306
328
|
npm install @angular/cli@21 -g
|
|
307
329
|
ng update @dsivd/prestations-ng@latest
|
|
308
330
|
```
|
|
309
331
|
|
|
310
|
-
When asked again
|
|
311
|
-
|
|
312
|
-
|
|
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
|
|
313
335
|
|
|
314
336
|
```bash
|
|
315
337
|
ng update @angular/cli@21
|
|
316
338
|
```
|
|
317
339
|
|
|
318
|
-
When asked
|
|
319
|
-
|
|
320
|
-
|
|
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
|
|
321
343
|
|
|
322
344
|
```bash
|
|
323
345
|
npm install @types/node@22 ts-node@10
|
|
324
346
|
```
|
|
325
347
|
|
|
326
|
-
**NB: When using `@angular/cdk` in your project**
|
|
348
|
+
💡 **NB: When using `@angular/cdk` in your project**
|
|
327
349
|
|
|
328
350
|
```bash
|
|
329
351
|
ng update @angular/cdk@21
|
|
330
352
|
```
|
|
331
353
|
|
|
332
|
-
**NB: When using `ngx-matomo-client` in your project**
|
|
354
|
+
💡 **NB: When using `ngx-matomo-client` in your project**
|
|
333
355
|
|
|
334
356
|
```bash
|
|
335
357
|
ng update ngx-matomo-client@9
|
|
@@ -348,18 +370,17 @@ ng update ngx-matomo-client@9
|
|
|
348
370
|
```
|
|
349
371
|
|
|
350
372
|
- In your `.eslintrc.json`, remove `"/src/main.ts",` from `ignorePatterns`.
|
|
351
|
-
|
|
352
373
|
- In `main.ts`, replace `platformBrowserDynamic` by `platformBrowser`.
|
|
353
|
-
|
|
354
374
|
- When using `<foehn-list-summary` component, replace `list` by `model`.
|
|
355
375
|
|
|
356
376
|
### Now fix your project before continuing
|
|
357
377
|
|
|
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
|
|
359
|
-
|
|
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".
|
|
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.**
|
|
361
379
|
|
|
362
|
-
|
|
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`).
|
|
363
384
|
|
|
364
385
|
Run the following command until you have no more errors.
|
|
365
386
|
|
|
@@ -367,7 +388,7 @@ Run the following command until you have no more errors.
|
|
|
367
388
|
npm run build
|
|
368
389
|
```
|
|
369
390
|
|
|
370
|
-
**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.**
|
|
371
392
|
|
|
372
393
|
### Migrate to inject function
|
|
373
394
|
|
|
@@ -385,11 +406,13 @@ ng generate @angular/core:inject
|
|
|
385
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
|
|
386
407
|
type safety. **Yes**
|
|
387
408
|
|
|
388
|
-
|
|
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.
|
|
389
413
|
|
|
390
|
-
|
|
414
|
+
Little example of cleaning when extending `AbstractPageComponent`:
|
|
391
415
|
|
|
392
|
-
For example, when extending `AbstractPageComponent`:
|
|
393
416
|
Before:
|
|
394
417
|
|
|
395
418
|
```ts
|
|
@@ -417,7 +440,7 @@ Most of the time, you can remove `activatedRoute` because it was used as a const
|
|
|
417
440
|
|
|
418
441
|
### Migrate to self-closing tags
|
|
419
442
|
|
|
420
|
-
**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.**
|
|
421
444
|
|
|
422
445
|
```bash
|
|
423
446
|
npm run build
|
|
@@ -433,9 +456,9 @@ ng generate @angular/core:self-closing-tag
|
|
|
433
456
|
|
|
434
457
|
### Migrate to standalone
|
|
435
458
|
|
|
436
|
-
**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.**
|
|
437
460
|
|
|
438
|
-
**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.**
|
|
439
462
|
|
|
440
463
|
```bash
|
|
441
464
|
npm run build
|
|
@@ -534,11 +557,11 @@ bootstrapApplication(AppComponent, appConfig).catch((err) =>
|
|
|
534
557
|
);
|
|
535
558
|
```
|
|
536
559
|
|
|
537
|
-
Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if
|
|
560
|
+
Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if they have not already been removed.
|
|
538
561
|
|
|
539
562
|
#### Migration to lazy-loaded routes when working with large applications
|
|
540
563
|
|
|
541
|
-
You may have some other modules that are
|
|
564
|
+
You may have some other modules that are lazy-loaded. Just be sure that all your components are standalone before continuing.
|
|
542
565
|
|
|
543
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.
|
|
544
567
|
|
|
@@ -548,7 +571,7 @@ You may have some other modules that are maybe lazy-loaded. Just be sure that al
|
|
|
548
571
|
ng generate @angular/core:route-lazy-loading
|
|
549
572
|
```
|
|
550
573
|
|
|
551
|
-
Here is
|
|
574
|
+
Here is an example when doing it manually because schematic above does not work as intended:
|
|
552
575
|
|
|
553
576
|
Your `app.routing.ts` file should look something like this:
|
|
554
577
|
|
|
@@ -599,7 +622,7 @@ export const demandes_routes: Routes = [
|
|
|
599
622
|
|
|
600
623
|
### Migrate from NgClass to class bindings
|
|
601
624
|
|
|
602
|
-
**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.**
|
|
603
626
|
|
|
604
627
|
```bash
|
|
605
628
|
npm run build
|
|
@@ -615,9 +638,8 @@ ng generate @angular/core:ngclass-to-class
|
|
|
615
638
|
|
|
616
639
|
✔ Should the migration also migrate space-separated keys? **Yes**
|
|
617
640
|
|
|
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.
|
|
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.
|
|
621
643
|
|
|
622
644
|
**Be aware that `[class]` replaces all element classes. When you have static classes, concatenate them with dynamic ones.**
|
|
623
645
|
|
|
@@ -667,7 +689,7 @@ After:
|
|
|
667
689
|
|
|
668
690
|
### Migrate from NgStyle to style bindings
|
|
669
691
|
|
|
670
|
-
**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.**
|
|
671
693
|
|
|
672
694
|
```bash
|
|
673
695
|
npm run build
|
|
@@ -683,13 +705,12 @@ ng generate @angular/core:ngstyle-to-style
|
|
|
683
705
|
|
|
684
706
|
✔ Should the migration also migrate object references? **No**
|
|
685
707
|
|
|
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.
|
|
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.
|
|
689
710
|
|
|
690
711
|
### Convert CommonModule usage to standalone imports
|
|
691
712
|
|
|
692
|
-
**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.**
|
|
693
714
|
|
|
694
715
|
```bash
|
|
695
716
|
npm run build
|
|
@@ -703,7 +724,7 @@ ng generate @angular/core:common-to-standalone
|
|
|
703
724
|
|
|
704
725
|
✔ Which directory do you want to migrate? **./**
|
|
705
726
|
|
|
706
|
-
Check every file that has changed and fix what is broken.
|
|
727
|
+
- Check every file that has changed and fix what is broken.
|
|
707
728
|
|
|
708
729
|
### Migrate @HostListener
|
|
709
730
|
|
|
@@ -746,7 +767,7 @@ export class NumberCurrencyFormatterDirective implements OnInit {
|
|
|
746
767
|
|
|
747
768
|
### Migrate to signal queries
|
|
748
769
|
|
|
749
|
-
**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.**
|
|
750
771
|
|
|
751
772
|
```bash
|
|
752
773
|
npm run build
|
|
@@ -762,15 +783,13 @@ ng generate @angular/core:signal-queries-migration --insert-todos
|
|
|
762
783
|
|
|
763
784
|
✔ Do you want to migrate as much as possible, even if it may break your build? **No**
|
|
764
785
|
|
|
765
|
-
Check every file that has changed and fix what is broken.
|
|
766
|
-
|
|
767
|
-
Check every
|
|
768
|
-
|
|
769
|
-
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.
|
|
770
789
|
|
|
771
790
|
### Migrate to output functions
|
|
772
791
|
|
|
773
|
-
**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.**
|
|
774
793
|
|
|
775
794
|
```bash
|
|
776
795
|
npm run build
|
|
@@ -792,7 +811,7 @@ When needing to subscribe to an output, you can use `outputToObservable` from `@
|
|
|
792
811
|
|
|
793
812
|
Check our [Angular signals guide](ANGULAR_SIGNALS.md) for more information about signals and input signals.
|
|
794
813
|
|
|
795
|
-
**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.**
|
|
796
815
|
|
|
797
816
|
```bash
|
|
798
817
|
npm run build
|
|
@@ -808,11 +827,9 @@ ng generate @angular/core:signal-input-migration --insert-todos
|
|
|
808
827
|
|
|
809
828
|
✔ Do you want to migrate as much as possible, even if it may break your build? **No**
|
|
810
829
|
|
|
811
|
-
Check every file that has changed and fix what is broken.
|
|
812
|
-
|
|
813
|
-
Check every
|
|
814
|
-
|
|
815
|
-
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.
|
|
816
833
|
|
|
817
834
|
### Migrate to vitest
|
|
818
835
|
|
|
@@ -884,10 +901,10 @@ npm uninstall @types/jasmine @types/jasminewd2
|
|
|
884
901
|
rm karma.conf.js
|
|
885
902
|
```
|
|
886
903
|
|
|
887
|
-
|
|
888
|
-
|
|
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.
|
|
889
906
|
|
|
890
|
-
Then run following command to migrate from jasmine to vitest:
|
|
907
|
+
Then run the following command to migrate from jasmine to vitest:
|
|
891
908
|
|
|
892
909
|
```bash
|
|
893
910
|
ng g @schematics/angular:refactor-jasmine-vitest
|
|
@@ -976,6 +993,28 @@ describe('AppComponent', () => {
|
|
|
976
993
|
});
|
|
977
994
|
```
|
|
978
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
|
+
|
|
979
1018
|
### Migrate to eslint flat configuration
|
|
980
1019
|
|
|
981
1020
|
```bash
|
|
@@ -1031,9 +1070,8 @@ Remove your old `.eslintrc.json` file in your `front` folder:
|
|
|
1031
1070
|
rm .eslintrc.json
|
|
1032
1071
|
```
|
|
1033
1072
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
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:
|
|
1037
1075
|
|
|
1038
1076
|
```ts
|
|
1039
1077
|
// @ts-check
|
|
@@ -1201,9 +1239,9 @@ export default tseslint.config(
|
|
|
1201
1239
|
);
|
|
1202
1240
|
```
|
|
1203
1241
|
|
|
1204
|
-
#### Delete `
|
|
1242
|
+
#### Delete `typings.d.ts`
|
|
1205
1243
|
|
|
1206
|
-
In `front/src/`, remove the file `
|
|
1244
|
+
In `front/src/`, remove the file `typings.d.ts` if it is still there.
|
|
1207
1245
|
|
|
1208
1246
|
#### Update your tsconfig\*.json files
|
|
1209
1247
|
|
|
@@ -1277,6 +1315,8 @@ In `front/src/`, remove the file `typing.d.ts` if it is still there.
|
|
|
1277
1315
|
|
|
1278
1316
|
### Husky pre-commit hook
|
|
1279
1317
|
|
|
1318
|
+
💡 **Tip: For multi-projects, see section below `Husky pre-commit hook for multi-project repository`**
|
|
1319
|
+
|
|
1280
1320
|
```bash
|
|
1281
1321
|
npm install --save-dev husky lint-staged
|
|
1282
1322
|
npx husky init
|
|
@@ -1287,14 +1327,95 @@ mv ./.husky ../.husky
|
|
|
1287
1327
|
git add -A
|
|
1288
1328
|
```
|
|
1289
1329
|
|
|
1290
|
-
-
|
|
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
|
|
1291
1412
|
|
|
1292
1413
|
```bash
|
|
1293
1414
|
npm run format:prettier
|
|
1294
1415
|
npm run lint
|
|
1295
1416
|
```
|
|
1296
1417
|
|
|
1297
|
-
Fix your `meta.service.ts`
|
|
1418
|
+
Fix your `meta.service.ts` by replacing:
|
|
1298
1419
|
|
|
1299
1420
|
Before:
|
|
1300
1421
|
|
|
@@ -1346,6 +1467,15 @@ npm uninstall @angular/platform-browser-dynamic
|
|
|
1346
1467
|
npm uninstall @angular/animations
|
|
1347
1468
|
```
|
|
1348
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
|
+
|
|
1349
1479
|
### Configure IntelliJ IDEA to use ESLint and Prettier on save
|
|
1350
1480
|
|
|
1351
1481
|
- To configure ESLint automatically in the current project, open "_File -> Settings..._" (`Ctrl+Alt+S`) and either:
|
|
@@ -1371,7 +1501,7 @@ npm install
|
|
|
1371
1501
|
|
|
1372
1502
|
#### Build and launch your application
|
|
1373
1503
|
|
|
1374
|
-
**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**
|
|
1375
1505
|
|
|
1376
1506
|
```bash
|
|
1377
1507
|
npm run build
|
|
@@ -1385,7 +1515,7 @@ Finally check if your tests run well :
|
|
|
1385
1515
|
npm run test
|
|
1386
1516
|
```
|
|
1387
1517
|
|
|
1388
|
-
> 🚨 **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**
|
|
1389
1519
|
|
|
1390
1520
|
### Release your application using `jenkins-libs`
|
|
1391
1521
|
|
|
Binary file
|