# PRESTAKIT : Upgrading from v17 to v18

To migrate your project from `prestakit` v17 to v18, you need to migrate prestations-ng and prestations-be, as usual.
But to migrate to prestations-be v18, you need to migrate your project to spring boot 3 / java 21. And to be able to do
that, you need to migrate your project to openshift.

Let's start by migrating to openshift / spring boot 3 / prestations-be v18.

## Prequisites

### Mise à jour du darch

- Pour ce qui doit aller hors d'un namespace existant : Le GA met à jour, ou fait mettre à jour le **DARCH** (Ouvrir un Jira sur le
  modèle de "[ARCH-1120](https://issuetracker.etat-de-vaud.ch/outils/issuetracker/browse/ARCH-1120) - ClearPass Enroll, migration
  openshift - Mise à jour DARCH" pour demander un accompagnement et pour savoir qui sera le point de contact) afin de relocaliser
  l'applicatif dans openshift. Il met également à jour (ou s'assure que c'est fait par un architecte technique) la **matrice des flux**.
  (exemple de matrice, lien Fred : [ClearpassEnroll - Matrice des flux.xlsx](fred://930d2fd4-4be5-4f70-9dec-5d1e8ba13851/browse/id/workspace/SpacesStore/573a7cda-9507-46e0-9dbc-7dfdb3b4cedc))

### Demande de namespace (Back-office ou pas de pool d'application existant pour l'équipe de déploiement)

- Demander un namespace visible dans tesserakt (ex : https://portail.etat-de-vaud.ch/outils/tesserakt/namespace-groups/146420/),
  Easyvista → Nouveau changement → WEB → 030 - Création d'un nouvel environnement WEB (IIS, Apache, Tomcat...), pour chaque environnement
    - Si BO, demander à ajouter la network policy "allow-from-cybercloud" au namespace (ex : R260330_00015)

### Demande de liaison à un pool d'application

- Si vous avez déjà un pool d'application pour votre équipe dans tesserakt (ex : cyberimtpublic/cyberimtsecurise), il suffit de faire une DC **030 - Création d'un nouvel environnement WEB** :

> Merci de lier la DU https://portail.etat-de-vaud.ch/outils/agref/deploy-unit/897
>
> au pool d'application "cyberimtpublic"
>
> Charts : ssh://git@bitbucket.etat-de-vaud.ch/pee/imt-charts.git / prestation

Exemple pour cyberimtpublic : R260330_00012

## PRESTATIONS-BE (via parent - Spring boot 3 / java 21)

From here on, we are in the root folder of your project, for example ~/git/cybsdk/skeleton.

### Spring boot 3

You can use this openrewrite recipe to simplify the migration (run with java 11)

```bash
source ~/devtools/fordev.sh 11 22
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_5 -Pnof,noft
```

Fix application.properties :

```diff
logging.config=${ch.vd.configDir}/logback-spring.xml
+ # Restore sleuth traces at the same position as in spring boot 2
+ logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]
+ # remove sleuth traces added by spring boot 3
+ logging.pattern.correlation=
+ logging.include-application-name=false
```

After that, you can switch to java 21 `jdk21` and should continue based on your current parent :

<details>
  <summary>SPRING-BOOT-STARTER-PARENT</summary>

### SPRING-BOOT-STARTER-PARENT

- remove this profile `<id>devex.in</id>` and its properties (`<devex...`)
- set property `java.version` to `21`
- set property `build.nofront` to `false`
- set property `skipTests` to `false`
- set property `commons-lang3.version` to `3.17.0`
- set property `commons-io.version` to `2.19.0`
- set property `commons-text.version` to `1.13.1`
- set property `prestations-be.version` to `18.x.y`
- remove plugin `maven-assembly-plugin` and its properties (`<assembly.xxx`)
- remove dependency `spring-cloud-starter-netflix-eureka-client`
- remove dependency `javax.el` and its property (`<javax.el.version>`)

If you used `org.jvnet.jaxb2.maven2:maven-jaxb2-plugin`, you should replace it with `org.jvnet.jaxb:jaxb-maven-plugin`

```
<plugin>
    <groupId>org.jvnet.jaxb</groupId>
    <artifactId>jaxb-maven-plugin</artifactId>
    <version>${jaxb-maven-plugin.version}</version>
    <configuration>
        <strict>false</strict> <!-- see https://github.com/highsource/maven-jaxb2-plugin/wiki/Catalogs-in-Strict-Mode -->
        <schemaDirectory>${basedir}/src/main/resources/xsd/</schemaDirectory>
        <args>
            <arg>-extension</arg>
            <arg>-Xvalue-constructor</arg>
            <arg>-XsimpleEquals</arg>
            <arg>-XsimpleHashCode</arg>
            <arg>-Xinheritance</arg>
        </args>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <schemaIncludes>
                    <include>backoffice.xsd</include>
                </schemaIncludes>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.jvnet.jaxb</groupId>
            <artifactId>jaxb-plugins</artifactId>
            <version>${jaxb-plugins.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-namespace-prefix</artifactId>
            <version>${jaxb2-namespace-prefix.version}</version>
        </dependency>
    </dependencies>
</plugin>
```

with these properties :

```
<jaxb-maven-plugin.version>4.0.8</jaxb-maven-plugin.version>
<jaxb-plugins.version>3.0.0</jaxb-plugins.version>
<jaxb2-namespace-prefix.version>2.0</jaxb2-namespace-prefix.version>
```

</details>

<details>
  <summary>APPLICATION-PARENT (IMT-Portail)</summary>

### APPLICATION-PARENT

- set parent version to `14.x.x`, check the important changes that happened since the previous version :
  https://dgnsiwiki.etat-de-vaud.ch/outils/dgnsiwiki/spaces/PCYBER/pages/1094779109/Correspondance+versions+prestakit+libs+cyber+changelog
- remove property `java.version` (already set to `21` in the parent)
- if existing, remove exclusion `spring-cloud-starter-netflix-eureka-client` from `starter-prestation`
- remove dependency `spring-boot-starter-validation` (already in `starter-prestation`)
- remove devex properties (devex.configTag, devex.deployTarget..)

If you used `org.jvnet.jaxb2.maven2:maven-jaxb2-plugin`, you should replace it with `org.jvnet.jaxb:jaxb-maven-plugin`

```
 <plugin>
    <groupId>org.jvnet.jaxb</groupId>
    <artifactId>jaxb-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <schemaIncludes>
                    <include>backoffice.xsd</include>
                </schemaIncludes>
            </configuration>
        </execution>
    </executions>
</plugin>
```

</details>

### clean / build your project

- change your application version to a new major one
- remove the annotation `@EnableEurekaClient`
- remove the property `eureka.client.enabled`
- remove the property `eureka.client.serviceUrl.defaultZone` (in you configuration repository)
- replace deprecated annotation `@MockBean` with `@MockitoBean`
- remove deprecated field constructor `Validator validator` from `AbstractSdkController`
- use `SdkControllerTest.getValidator()` instead of creating a `LocalValidatorFactoryBean` to build your `FormValidationService` in tests

build your project with java 21 :

```
mvn -U clean install -Pnof,noft
```

### Property migration

run your application with this dependency :

```
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-properties-migrator</artifactId>
    <scope>runtime</scope>
</dependency>
```

look for logs that indicate property you should migrate (watch for WARN logs of class PropertiesMigrationListener), update them and remove the
dependency

### Captcha configuration

- As stated in the migration guide from v16 to v17, Cybercache is responsible for the captcha turnstile verify call.
- Therefore, you can remove properties related to this configuration :
    - `recaptcha.byPassUUID`
    - `recaptcha.proxyUrl`
    - `recaptcha.proxyPort`
    - `recaptcha.secretkey`
    - `recaptcha.publickey`
- If your application was not using Refinf through property `cyber-cache.configuration.enabled=false` and you still need the Recaptcha, you can replace this property with `cyber-cache.refinf-v5.enabled=false`, remove duplicated properties as before, add `cyber-cache.base-url` in your configuration and add your deployment unit in Mizo (Cybercache) for role `user`.

Cookie storage is kept as before, therefore you can keep cookie related properties that starts with `recaptcha.cookie.YYY` in your properties.

See [Skeleton](https://dsigit.etat-de-vaud.ch/outils/git/projects/CYBSDK/repos/skeleton/pull-requests/708/overview) for a working example

### HIBERNATE

## Sequences

Hibernate doesn't use the default sequence anymore, you can keep using it by replacing

```
@GeneratedValue(strategy = GenerationType.SEQUENCE)
```

with

```
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "hibernate_sequence")
@SequenceGenerator(name = "hibernate_sequence", allocationSize = 1)
```

## Dates mapping

replace `@Type(LocalDateTimeUserType.class)` by `@Convert(converter = LocalDateTimeConverter.class)`
replace `@Type(LocalDateUserType.class)` by `@Convert(converter = LocalDateConverter.class)`

## H2

- If you had a fixe H2 version for testing, you should upgrade to the latest version by removing :

```
<h2.version>1.4.200</h2.version>
```

- When using protected keywords in H2 (like "VALUE") add `NON_KEYWORDS=VALUE;` to your `spring.datasource.url` such as:

```
spring.datasource.url=jdbc:h2:mem:testdb;NON_KEYWORDS=VALUE;
```

## JpaExpression cast

replace `root.get(attribute).as(String.class)` by `((JpaExpression<?>) root.get(attribute)).cast(String.class)`

### Jenkins files for Unit tests

buildPipeline is not supported anymore, replace the content of jenkins>UT>JenkinsFile with :

```
@Library('devsup-library') _

buildAppPipelinePodmanUT([
        name  : 'the name of your application',
        label : 'your slaves label',
        jdk   : '21',
        node  : '20'
])
```

- Example for a repo git containing both BO and FO: https://dsigit.etat-de-vaud.ch/outils/git/projects/PEE/repos/refivdparent/browse/jenkins/UT/Jenkinsfile
- Example for a repo git containing only one application: https://dsigit.etat-de-vaud.ch/outils/git/projects/CYBSDK/repos/skeleton/browse/jenkins/UT/Jenkinsfile

### Code cleanup

You can use these openrewrite recipes to clean your code :

```bash
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.junit5.JUnit5BestPractices
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-static-analysis:RELEASE -Drewrite.activeRecipes=org.openrewrite.staticanalysis.CommonStaticAnalysis
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.activeRecipes=org.openrewrite.java.RemoveUnusedImports
```

Take a look at sonar to see what you can improve or ignore.

### Debugging tips

Spring boot 3 doesn't support calling a controller with a trailing slash, fix the url called (/api/ping != /api/ping**/**)

## Openshift

- Supprimer le fichier `assembly.xml`
- Supprimer le répertoire `addons`
- Supprimer le répertoire `scripts`
- Supprimer le répertoire `jenkins/devex`
- Supprimer l'annotation `@EnableDiscoveryClient` dans `Application.java`
- Remplacer `tomcat.port=1640` par `port.http=16400` (ou adapter le port si différent) dans les fichiers `environment.
properties`
- Remplacer `server.port=${tomcat.port}0` par `server.port=${port.http}` dans `application.properties`
- Adapter `pom.xml` :
    - Modifier le packaging : `<packaging>jar</packaging>`
    - Ajouter le finalName (sous `build`) : `<finalName>${project.artifactId}</finalName>`
    - Ajouter les properties t6kt. 'NOM TECHNIQUE DANS AGREF' est le nom de l'application listée dans tesserakt,
      exemple : cyberimtpublic
        - `<t6kt-maven-plugin.application>NOM TECHNIQUE DANS AGREF</t6kt-maven-plugin.application>`
        - `<t6kt-maven-plugin.configurationVersion>master</t6kt-maven-plugin.configurationVersion>`
        - `<t6kt-maven-plugin.chartVersion>master</t6kt-maven-plugin.chartVersion>`
        - `<t6kt-maven-plugin.cluster>int02 ou extint01</t6kt-maven-plugin.cluster>`
    - Si parent `spring-boot-starter-parent`
        - Ajouter `tesserakt-maven-plugin` :
            - ```
                 <!--  used by snap2t6kt (https://dsigit.etat-de-vaud.ch/outils/git/projects/DEVSUP/repos/jenkins-library/browse/vars/snap2t6kt.groovy)-->
                  <plugin>
                      <groupId>ch.vd.devsupport</groupId>
                      <artifactId>tesserakt-maven-plugin</artifactId>
                      <version>${t6kt-maven-plugin.version}</version>
                      <configuration>
                          <username>${T6KT_USERNAME}</username>
                          <password>${T6KT_PASSWORD}</password>
                          <application>${t6kt-maven-plugin.application}</application>
                          <deployUnit>${t6kt-maven-plugin.deployUnit}</deployUnit>
                          <applicationVersion>${t6kt-maven-plugin.applicationVersion}</applicationVersion>
                          <chartVersion>${t6kt-maven-plugin.chartVersion}</chartVersion>
                          <configurationVersion>${t6kt-maven-plugin.configurationVersion}</configurationVersion>
                          <environment>${t6kt-maven-plugin.environment}</environment>
                          <cluster>${t6kt-maven-plugin.cluster}</cluster>
                      </configuration>
                  </plugin>
              ```

NB : les 2 derniers points sont valables si le code concernée n'est déployé que dans 1 DU. Au cas où il y a
plusieurs DU, voir exemple ici : https://dsigit.etat-de-vaud.ch/outils/git/projects/CYBER/repos/formsupportcyber/browse/pom.xml#90-109

NB : int02 signifie "intégration 2" and "extint01" signifie "extranet intégration 1".
Donc si c'est pour l'intranet, c'est int02 par exemple, si c'est de l'internet, c'est extint01 par exemple.

### Move the configs (if it is a fo and it goes into an application pool like cyberimtpublic)

Move the files from your configuration repository into the target repository.
Example : skeleton-configuration (https://dsigit.etat-de-vaud.ch/outils/git/projects/CYBSDK/repos/skeleton-configuration/browse)
into
cyberimt-configuration (https://dsigit.etat-de-vaud.ch/outils/git/projects/PEE/repos/cyberimt-configuration/browse)
and leave a README.md file in the old repository to tell where it has been moved.

Clean the moved files by removing what is already defined in the application\*.properties files.

If you had folders by environment (IN / VA / PR) in your repo, move them into the vault folder of the target
repository. The subfolder name must correspond to the deployUnit name.

Define `deployUnit.groupId` et `deployUnit.name` in your moved base properties file.

In the helm folder, add a subfolder with the deployUnit name and fill it with a values.yaml file (copy-paste-replace
from another similar)
NB : if your application is using a `${ch.vd.dataDir}` that must survive a restart, your can mount a persistent
volume by adding `dataDirSize: 10Mi` (pick the right size) in the values.yaml file.

### Deployment of the first snapshot in IN

- **Equipe IMT-Portail** Ajouter le projet à jenkins
    - ajouter l'application à la liste :
      https://dsigit.etat-de-vaud.ch/outils/git/projects/PEE/repos/jenkins-libs/browse/vars/getImtPortailApplications.groovy
      (the name must correspond with the deployUnit name)
    - https://validation.portail.etat-de-vaud.ch/outils/jenkinsdgnsi/view/METIMT/job/000_Portail_SNAP_2t6kt/ => lancer un DRY_RUN
    - https://validation.portail.etat-de-vaud.ch/outils/jenkinsdgnsi/view/METIMT/job/000_Portail_STABLE_2t6kt/ => lancer un DRY_RUN
    - Supprimer l'applications des jobs "2Devex":
    - https://validation.portail.etat-de-vaud.ch/outils/jenkinsdgnsi/view/METIMT/job/000_Portail_SNAP_2Devex/
    - https://validation.portail.etat-de-vaud.ch/outils/jenkinsdgnsi/view/METIMT/job/000_Portail_STABLE_2Devex/

Once your changes are merged, you can launch the job to deploy the first snapshot in IN using 000_Portail_SNAP_2t6kt

Check the logs of the job to see if it is successful, and check the logs of your pod to see if it is running fine.

You can now change the access configuration of your application to use the openshift route in the configuration
repository (https://dsigit.etat-de-vaud.ch/outils/git/projects/CYBER/repos/configuration/browse/cyberzuul-IN.yml)
for a fo. For a BO you need to make a DS to ask the WEB team to change the route. Once done and merged, restart zuul
(https://portail.etat-de-vaud.ch/outils/devex/deployunit-sub/1322/containers?target=EmbeddedRHEL7) and stop your old
application.

Create a DS to desactivate the old containers in the IN vms.

Check that your application is running fine in IN, that you can see it properly in the monitoring
https://validation.portail.etat-de-vaud.ch/cyberadmin/int-consolesupport/springbootadmin/wallboard and that the
sensitive data are not exposed in the property configuration listing.

## PRESTATIONS-NG

For the commands in this guide, it is supposed that your are in the `front` folder of your project.

The main feature in `prestations-ng` v18 is the update of the `@angular/*` peer dependencies
to `^19.2.14`, using `node 20+` to build, `npm 10+` for package manager and `Foehn 2+ (Bootstrap 5+)` for our design system.

### Migrating to ESLint

(NB : you can skip this step if you already have a `front/eslintrc.json` file, it means it is already done.)
Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project from TSLint to ESLint.

### Updating to Angular 18

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=17.0-18.0&l=1](https://angular.dev/update-guide?v=17.0-18.0&l=1)

**NB: Commit before continuing so your repository is clean.**

Remove your `resolutions` in `package.json` before starting : if you have `resolutions` in `package.json`, remove manually the section.
In the next commands, commit before each ng update.

```bash
npm install
npm install @angular/cli@17 -g
ng update @angular/core@17 @angular/cli@17
ng update @dsivd/prestations-ng@17

npm install @angular/cli@18 -g
ng update @angular/core@18 @angular/cli@18
```

When asked the question "Select the migrations that you'd like to run", accept "use-application-builder" by hitting "Space" key then "Enter".

#### Add an empty "browser" to your output path in angular.json

```diff
{
  "projects": {
    "[YOUR_PROJECT_NAME]": {
      "architect": {
        "build": {
          "options": {
            "outputPath": {
-             "base": "dist"
+             "base": "dist",
+             "browser": ""
            }
```

Continue with your migration:

```bash
ng update @fortawesome/angular-fontawesome@0.15 --force
```

**NB: When using `@angular/cdk` in your project**

```bash
ng update @angular/cdk@18
```

### Updating to Angular 19

`prestations-ng` **v18+** now supports **Angular v19**.

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=18.0-19.0&l=1](https://angular.dev/update-guide?v=18.0-19.0&l=1)

**NB: Commit before continuing so your repository is clean.**

#### When having migrated to ESLint

```bash
npm install @angular/cli@19 -g
ng update typescript@5.5
ng update @dsivd/prestations-ng@18
```
NB: You might need to use the --force option.

When asked the question "Select the migrations that you'd like to run", accept "provide-initializer" by hitting "Space" key then "Enter".

```bash
ng update @angular/cli@19
```

When asked the question "Select the migrations that you'd like to run", accept "use-application-builder" by hitting "Space" key then "Enter".

```bash
ng update @angular-eslint/builder@19
```

**NB: When using `@angular/cdk` in your project**

```bash
ng update @angular/cdk@19
```

**NB: When using `ngx-matomo-client` in your project**

```bash
ng update ngx-matomo-client@7
```

Continue with your migration:

```bash
npm install --save-dev jasmine@5

ng update karma@6.4 karma-chrome-launcher@3.2 karma-coverage@2.2 karma-jasmine@5.1 karma-jasmine-html-reporter@2.1

npm install --save-dev @typescript-eslint/utils@7 @typescript-eslint/types@7

ng update @angular-eslint/eslint-plugin@19 @angular-eslint/eslint-plugin-template@19 @angular-eslint/template-parser@19
ng update @typescript-eslint/eslint-plugin@7 @typescript-eslint/parser@7
ng update eslint-plugin-import eslint-plugin-jasmine eslint-plugin-rxjs-angular eslint-plugin-simple-import-sort
ng update eslint@8
ng update eslint-plugin-rxjs
ng update @types/jasmine@5 @types/node@20 ts-node@10

npm remove eslint-plugin-jsdoc

npm remove puppeteer
npm install --save-dev puppeteer

npm update
```

#### Fix proxy.conf.json

In your `proxy.conf.json` file:

- remove `/*` at the end of your api url
- remove `"changeOrigin": true`

```diff
- "/pub/101102/api/*": {
+ "/pub/101102/api": {
    "target": "http://localhost:16400",
-   "changeOrigin": true,
    "secure": false,
    "pathRewrite": {
        "^/api": ""
    }
}
```

#### NgHttpLoader migration as standalone + Fix provideHttpClient withXsrfConfiguration

In your `app.module.ts` file:

- Remove `import { NgHttpLoaderModule } from 'ng-http-loader';`
- Remove `NgHttpLoaderModule.forRoot()` from `imports` in `@NgModule(...)`
- Add `NgHttpLoaderComponent` to `imports` in `@NgModule(...)`
- Add `withInterceptors([pendingRequestsInterceptor$])` to `providers` in `@NgModule(...)`

```diff
- import { NgHttpLoaderModule } from 'ng-http-loader';
+ import { NgHttpLoaderComponent, pendingRequestsInterceptor$ } from 'ng-http-loader';

@NgModule({
    imports: [
-       NgHttpLoaderModule.forRoot(),
+       NgHttpLoaderComponent,
    ], providers: [
-        provideHttpClient(withXsrfConfiguration()),
+        provideHttpClient(
+            withInterceptors([pendingRequestsInterceptor$]),
+            withXsrfConfiguration({
+                cookieName: 'XSRF-TOKEN',
+                headerName: 'X-XSRF-TOKEN'
+            })
+        ),
    ]
})
```

#### ImageCropper migration as standalone (if you are using it in your project)

- Remove `import { ImageCropperModule } from 'ngx-image-cropper';`
- Remove `ImageCropperModule` from `imports` in `@NgModule(...)`
- Add `ImageCropperComponent` to `imports` in `@NgModule(...)`

```diff
- import { ImageCropperModule } from 'ngx-image-cropper';
+ import { ImageCropperComponent } from 'ngx-image-cropper';

@NgModule({
    imports: [
-       ImageCropperModule,
+       ImageCropperComponent,
    ]
})
```

#### Matomo migration as standalone (if you are using it in your project)

In your `app.module.ts` file:

- Remove `import { MatomoInitializationMode, MatomoModule } from 'ngx-matomo-client';`
- Remove `MatomoModule.forRoot({mode: MatomoInitializationMode.AUTO_DEFERRED})` from `imports` in `@NgModule(...)`
- Add `provideMatomo` to `imports` in `@NgModule(...)`
- Add `provideMatomo({ mode: 'deferred' })` to `providers` in `@NgModule(...)`

```diff
- import { MatomoInitializationMode, MatomoInitializerService, MatomoModule } from 'ngx-matomo-client';
+ import { MatomoInitializerService, provideMatomo } from 'ngx-matomo-client';

@NgModule({
    imports: [
-       MatomoModule.forRoot({mode: MatomoInitializationMode.AUTO_DEFERRED}),
    ], providers: [
+       provideMatomo({ mode: 'deferred' })
    ]
})
```

#### Move and update your tsconfig\*.json files

- Move your `tsconfig.app.json` and `tsconfig.spec.json` from `src` to `front` (if not already done)
- Replace your `tsconfig.json` content with:

```json
{
    "compileOnSave": false,
    "compilerOptions": {
        "outDir": "./dist/out-tsc",
        "noImplicitOverride": true,
        "noPropertyAccessFromIndexSignature": false,
        "noImplicitReturns": true,
        "noFallthroughCasesInSwitch": true,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "sourceMap": true,
        "declaration": false,
        "experimentalDecorators": true,
        "moduleResolution": "bundler",
        "importHelpers": true,
        "target": "ES2022",
        "module": "ES2022",
        "paths": {
            "@dsivd/prestations-ng": ["./node_modules/@dsivd/prestations-ng"]
        }
    },
    "include": ["src/**/*"],
    "angularCompilerOptions": {
        "enableI18nLegacyMessageIdFormat": false,
        "strictInjectionParameters": true,
        "strictInputAccessModifiers": true
    }
}
```

- Replace your `tsconfig.app.json` content with:

```json
{
    "extends": "./tsconfig.json",
    "compilerOptions": {
        "outDir": "./out-tsc/app",
        "types": []
    },
    "files": ["src/main.ts"],
    "include": ["src/**/*.d.ts"]
}
```

- Replace your `tsconfig.spec.json` content with:

```json
{
    "extends": "./tsconfig.json",
    "compilerOptions": {
        "outDir": "./out-tsc/spec",
        "types": ["jasmine", "node"]
    },
    "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
}
```

#### Fix your angular.json file

Because your `tsconfig.app.json` and `tsconfig.spec.json` have been moved, you need to change the path in your `angular.json` file by removing `src/`

```diff
"projects": {
    "[YOUR_APPLICATION_NAME]": {
      "architect": {
        "build": {
            "options": {
-              "tsConfig": "src/tsconfig.app.json",
+              "tsConfig": "tsconfig.app.json",
            }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
-           "tsConfig": "src/tsconfig.spec.json",
+           "tsConfig": "tsconfig.spec.json",
          }
```

#### Browsers list update

Run update schematic:

```bash
ng g @dsivd/prestations-ng:replace-browsers-list
```

### Update ".eslintrc.json" file if your project was already migrated to ESLint

**NB: Replace your current `.eslintrc.json` file by the one found in [ESLINT_MIGRATION.GUIDE](ESLINT_MIGRATION_GUIDE.md#customizing_eslint__inspired_from_otia_and_prestations-ng_s_files_for_rules_).**
You will have to fix the json file after the copy as it won't copy the double quotes around the properties. (ask IntelliJ to do it for you, alt-enter, Wrap with double quotes -> fix all compliance with json standard ...)

Then run

```bash
npm run lint
```

Fix manually all errors **Components, Directives and Pipes should not opt out of standalone @angular-eslint/prefer-standalone** by either:

- Adding `// eslint-disable-next-line @angular-eslint/prefer-standalone` above `standalone: false` (recommended by
  IMT team, to focus on the current migration)
- Transforming your component into a `standalone` component by changing `standalone: false` into `standalone: true`
  (recommended by angular, but implies to make a standalone migration for each component, cf
- https://v19.angular.dev/reference/migrations/standalone, then check that your application is compiling/running well after that)

Then run again:

```bash
npm run lint
```

To be sure you haven't forgotten any.

Finally, run:

```bash
ng lint --fix=true
```

### Deprecated Features Removed

#### foehn-table component

- Removed:
    - Component input `@Input() list`
- Replaced by:
    - Component input `@Input() model`

### Language deprecations

When using `intellij`, you can run code inspection on your project to fix manually deprecations. Two ways:

- Intellij window menu, go to: `Code > Analyze code > Run inspection by name...` (or **Ctrl+Alt+Maj+i**) and type `Deprecated symbol used`.
- Or select your project in your project panel and `right click` on it then `Analyze > Run inspection by name...` (or **Ctrl+Alt+Maj+i**) and type `Deprecated symbol used`.

### Last but not least, check if your application is working!!!

#### Be sure your application gets a fresh start

```bash
rm -rf .angular/
rm -rf node_modules/
npm install
```

#### Build and launch your application

**NB: You will most probably need to fix some compilation errors such as adding `override` when needed**

```bash
npm run build
npm start
```

Your are good if no errors are remaining!
Finally check if your tests run well :

```bash
npm run test
```

**NB: If you are having trouble finding puppeteer ChromiumHeadless binary**

```bash
npx puppeteer browsers install chrome
npm run test
```

If there is a message complaining about HttpErrorResponse & NG0205: Injector has already been destroyed,
in your `app.component.spec.ts` file, add `HttpClientTestingModule` to `TestBed.configureTestingModule` in `beforeEach(waitForAsync` function
