@dsivd/prestations-ng 18.8.0-beta.13 → 19.0.0-beta-9
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 +12 -21
- package/ANGULAR_SIGNALS.md +850 -0
- package/CHANGELOG.md +366 -312
- package/COMPONENTS.md +350 -0
- package/CONTRIBUTING.md +8 -19
- package/ESLINT_MIGRATION_GUIDE.md +64 -67
- package/IAM_ACV_MIGRATION_OIDC.md +138 -0
- package/MULTI_ETAPES.md +1 -1
- package/README.md +5 -2
- package/UPGRADING_V12.md +0 -10
- package/UPGRADING_V16.md +0 -1
- package/UPGRADING_V18.md +398 -233
- package/UPGRADING_V19.md +1405 -0
- package/dsivd-prestations-ng-19.0.0-beta-9.tgz +0 -0
- package/fesm2022/dsivd-prestations-ng.mjs +9238 -10390
- package/fesm2022/dsivd-prestations-ng.mjs.map +1 -1
- package/index.html +1 -1
- package/package.json +19 -18
- package/schematics/package.json +3 -0
- package/schematics/utility/add-allow-synthetic-default-imports.js +2 -2
- package/schematics/utility/add-allowed-common-js-dependencies.js +3 -3
- package/schematics/utility/foehn2-bootstrap5-migration.js +21 -21
- package/schematics/utility/migrate-to-karma-coverage.js +2 -2
- package/schematics/utility/remove-emit-decorator-metadata.js +2 -2
- package/types/dsivd-prestations-ng.d.ts +3698 -0
- package/MODULES.md +0 -371
- package/abstract-page-component.d.ts +0 -57
- package/directives/currency-formatter.directive.d.ts +0 -20
- package/directives/formatter.module.d.ts +0 -11
- package/directives/iban-formatter.directive.d.ts +0 -10
- package/directives/ide-formatter.directive.d.ts +0 -17
- package/directives/ndc-formatter.directive.d.ts +0 -24
- package/dsivd-prestations-ng-18.8.0-beta.13.tgz +0 -0
- package/foehn-address/address.type.d.ts +0 -27
- package/foehn-address/foehn-address.module.d.ts +0 -15
- package/foehn-address/foehn-display-address.component.d.ts +0 -16
- package/foehn-address/foehn-input-address.component.d.ts +0 -107
- package/foehn-address/foehn-input-foreign-locality.component.d.ts +0 -16
- package/foehn-address/foehn-input-foreign-street.component.d.ts +0 -12
- package/foehn-agenda/calendar.type.d.ts +0 -9
- package/foehn-agenda/current-week.type.d.ts +0 -5
- package/foehn-agenda/day-slots.type.d.ts +0 -5
- package/foehn-agenda/foehn-agenda-navigation/foehn-agenda-navigation.component.d.ts +0 -21
- package/foehn-agenda/foehn-agenda-timeslot-panel/foehn-agenda-timeslot-panel.component.d.ts +0 -51
- package/foehn-agenda/foehn-agenda.component.d.ts +0 -29
- package/foehn-agenda/foehn-agenda.module.d.ts +0 -17
- package/foehn-agenda/pagination-week.type.d.ts +0 -5
- package/foehn-agenda/selected-slot.type.d.ts +0 -7
- package/foehn-autocomplete/foehn-autocomplete.component.d.ts +0 -126
- package/foehn-autocomplete/foehn-autocomplete.module.d.ts +0 -13
- package/foehn-boolean/foehn-boolean-checkbox.component.d.ts +0 -6
- package/foehn-boolean/foehn-boolean-radio.component.d.ts +0 -9
- package/foehn-boolean/foehn-boolean.module.d.ts +0 -12
- package/foehn-breadcrumb/breadcrumb-event.service.d.ts +0 -48
- package/foehn-breadcrumb/breadcrumb.d.ts +0 -19
- package/foehn-breadcrumb/foehn-breadcrumb.component.d.ts +0 -30
- package/foehn-breadcrumb/foehn-breadcrumb.module.d.ts +0 -10
- package/foehn-checkables/foehn-checkable-group.component.d.ts +0 -64
- package/foehn-checkables/foehn-checkables.module.d.ts +0 -17
- package/foehn-checkables/foehn-checkbox.component.d.ts +0 -9
- package/foehn-checkables/foehn-radio.component.d.ts +0 -12
- package/foehn-checkables/foehn-select.component.d.ts +0 -22
- package/foehn-checkables/form-select-option-group.d.ts +0 -4
- package/foehn-checkables/form-select-option.d.ts +0 -5
- package/foehn-confirm-modal/foehn-confirm-modal-content.d.ts +0 -9
- package/foehn-confirm-modal/foehn-confirm-modal.component.d.ts +0 -17
- package/foehn-confirm-modal/foehn-confirm-modal.module.d.ts +0 -9
- package/foehn-confirm-modal/foehn-confirm-modal.service.d.ts +0 -18
- package/foehn-date-picker/date-picker-navigation.helper.d.ts +0 -26
- package/foehn-date-picker/date-picker.helper.d.ts +0 -30
- package/foehn-date-picker/day-month.type.d.ts +0 -8
- package/foehn-date-picker/focused-day.type.d.ts +0 -6
- package/foehn-date-picker/foehn-date-picker.component.d.ts +0 -78
- package/foehn-date-picker/foehn-date-picker.module.d.ts +0 -13
- package/foehn-date-picker/month-year.type.d.ts +0 -4
- package/foehn-date-picker-button/foehn-date-picker-button.component.d.ts +0 -31
- package/foehn-date-picker-button/foehn-date-picker-button.module.d.ts +0 -12
- package/foehn-debug-summary/foehn-debug-summary.component.d.ts +0 -21
- package/foehn-debug-summary/foehn-debug-summary.component.module.d.ts +0 -9
- package/foehn-decision-electronique/foehn-decision-electronique.component.d.ts +0 -11
- package/foehn-decision-electronique/foehn-decision-electronique.module.d.ts +0 -11
- package/foehn-dropdown-menu/dropdown-menu-group.type.d.ts +0 -5
- package/foehn-dropdown-menu/dropdown-menu-item.type.d.ts +0 -9
- package/foehn-dropdown-menu/foehn-dropdown-menu.component.d.ts +0 -42
- package/foehn-dropdown-menu/foehn-dropdown-menu.module.d.ts +0 -11
- package/foehn-feedback-notification/foehn-feedback-notification.component.d.ts +0 -32
- package/foehn-feedback-notification/foehn-feedback-notification.module.d.ts +0 -11
- package/foehn-feedback-notification/foehn-feedback-notification.type.d.ts +0 -8
- package/foehn-footer/foehn-footer.component.d.ts +0 -44
- package/foehn-footer/foehn-footer.module.d.ts +0 -9
- package/foehn-footer/footer-link.type.d.ts +0 -4
- package/foehn-form/foehn-form.component.d.ts +0 -27
- package/foehn-form/foehn-form.module.d.ts +0 -10
- package/foehn-form/register-ng-model.service.d.ts +0 -9
- package/foehn-growl/foehn-growl.component.d.ts +0 -17
- package/foehn-growl/foehn-growl.module.d.ts +0 -8
- package/foehn-growl/growl-broker.service.d.ts +0 -12
- package/foehn-growl/growl-message.d.ts +0 -7
- package/foehn-growl/growl-types.d.ts +0 -6
- package/foehn-header/foehn-header.component.d.ts +0 -47
- package/foehn-header/foehn-header.module.d.ts +0 -14
- package/foehn-header/foehn-skip-link.component.d.ts +0 -23
- package/foehn-help-modal/foehn-help-modal.component.d.ts +0 -17
- package/foehn-help-modal/foehn-help-modal.module.d.ts +0 -10
- package/foehn-help-modal/foehn-help-modal.type.d.ts +0 -13
- package/foehn-icons/abstract-icon-component.d.ts +0 -9
- package/foehn-icons/foehn-icon-calendar.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-check-square-o.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-check.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-chevron-down.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-chevron-left.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-chevron-right.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-chevron-up.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-clock.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-comment-dots.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-edit.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-external-link-alt.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-file-pdf.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-info-circle.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-lock.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-map-marker.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-minus-circle.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-pencil.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-plus-circle.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-plus-square.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-search.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-times.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-trash-alt.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-unlock-alt.component.d.ts +0 -8
- package/foehn-icons/foehn-icon-user.component.d.ts +0 -8
- package/foehn-icons/foehn-icons.module.d.ts +0 -31
- package/foehn-input/foehn-input-email.component.d.ts +0 -15
- package/foehn-input/foehn-input-hidden.component.d.ts +0 -14
- package/foehn-input/foehn-input-number.component.d.ts +0 -42
- package/foehn-input/foehn-input-password.component.d.ts +0 -12
- package/foehn-input/foehn-input-phone.component.d.ts +0 -25
- package/foehn-input/foehn-input-prefixed-text.component.d.ts +0 -26
- package/foehn-input/foehn-input-string.component.d.ts +0 -9
- package/foehn-input/foehn-input-text.component.d.ts +0 -11
- package/foehn-input/foehn-input-textarea.component.d.ts +0 -22
- package/foehn-input/foehn-input.component.d.ts +0 -127
- package/foehn-input/foehn-input.module.d.ts +0 -24
- package/foehn-input/pattern.const.d.ts +0 -11
- package/foehn-input-date/foehn-input-date.component.d.ts +0 -33
- package/foehn-input-date-time/foehn-input-date-time.component.d.ts +0 -40
- package/foehn-input-time/foehn-input-time.component.d.ts +0 -19
- package/foehn-list/foehn-list.component.d.ts +0 -27
- package/foehn-list/foehn-list.module.d.ts +0 -9
- package/foehn-list/page-change-event.d.ts +0 -5
- package/foehn-menu-prestation/abstract-list-item-detail-page.component.d.ts +0 -35
- package/foehn-menu-prestation/abstract-menu-page.component.d.ts +0 -13
- package/foehn-menu-prestation/abstract-page-from-menu.component.d.ts +0 -20
- package/foehn-menu-prestation/foehn-error-pill/foehn-error-pill.component.d.ts +0 -12
- package/foehn-menu-prestation/foehn-list-summary/foehn-list-item-description.d.ts +0 -6
- package/foehn-menu-prestation/foehn-list-summary/foehn-list-item.d.ts +0 -5
- package/foehn-menu-prestation/foehn-list-summary/foehn-list-summary.component.d.ts +0 -40
- package/foehn-menu-prestation/foehn-menu-items/foehn-menu-item/foehn-menu-item.component.d.ts +0 -16
- package/foehn-menu-prestation/foehn-menu-items/foehn-menu-item-transmit/foehn-menu-item-transmit.component.d.ts +0 -23
- package/foehn-menu-prestation/foehn-menu-prestation.module.d.ts +0 -18
- package/foehn-misc/foehn-abbr.component.d.ts +0 -7
- package/foehn-misc/foehn-misc.module.d.ts +0 -7
- package/foehn-modal/foehn-modal.component.d.ts +0 -24
- package/foehn-modal/foehn-modal.module.d.ts +0 -11
- package/foehn-multiselect-autocomplete/foehn-multiselect-autocomplete.component.d.ts +0 -54
- package/foehn-multiselect-autocomplete/foehn-multiselect-autocomplete.module.d.ts +0 -13
- package/foehn-nav13/foehn-input-nav13.component.d.ts +0 -20
- package/foehn-nav13/foehn-input-nav13.module.d.ts +0 -11
- package/foehn-navigation/abstract-foehn-navigation.component.d.ts +0 -19
- package/foehn-navigation/foehn-navigation/foehn-navigation.component.d.ts +0 -22
- package/foehn-navigation/foehn-navigation.module.d.ts +0 -13
- package/foehn-navigation/foehn-navigation.service.d.ts +0 -69
- package/foehn-navigation/foehn-simple-navigation/foehn-simple-navigation.component.d.ts +0 -8
- package/foehn-notfound/foehn-notfound.component.d.ts +0 -19
- package/foehn-notfound/foehn-notfound.module.d.ts +0 -10
- package/foehn-page/foehn-page-counter.component.d.ts +0 -15
- package/foehn-page/foehn-page-expiration-timer/current-session-expiration.d.ts +0 -5
- package/foehn-page/foehn-page-expiration-timer/demande-expiration-interceptor.d.ts +0 -15
- package/foehn-page/foehn-page-expiration-timer/demande-expiration.service.d.ts +0 -16
- package/foehn-page/foehn-page-expiration-timer/foehn-page-expiration-timer.component.d.ts +0 -36
- package/foehn-page/foehn-page-expiration-timer/interval.helper.d.ts +0 -3
- package/foehn-page/foehn-page-modal.component.d.ts +0 -23
- package/foehn-page/foehn-page-modal.service.d.ts +0 -12
- package/foehn-page/foehn-page.component.d.ts +0 -80
- package/foehn-page/foehn-page.module.d.ts +0 -24
- package/foehn-page/foehn-page.service.d.ts +0 -19
- package/foehn-page/foehn-transmit-waiting-modal/demande-transmit-interceptor.d.ts +0 -16
- package/foehn-page/foehn-transmit-waiting-modal/foehn-transmit-waiting-modal.component.d.ts +0 -11
- package/foehn-page/foehn-transmit-waiting-modal/foehn-transmit-waiting-modal.service.d.ts +0 -11
- package/foehn-recap-section/foehn-recap-section.component.d.ts +0 -21
- package/foehn-recap-section/foehn-recap-section.module.d.ts +0 -10
- package/foehn-recap-section/foehn-recap-section.type.d.ts +0 -17
- package/foehn-remaining-alerts-summary/foehn-remaining-alerts-summary.component.d.ts +0 -20
- package/foehn-remaining-alerts-summary/foehn-remaining-alerts-summary.module.d.ts +0 -8
- package/foehn-status-progress-bar/foehn-status-progress-bar.component.d.ts +0 -23
- package/foehn-status-progress-bar/foehn-status-progress-bar.module.d.ts +0 -10
- package/foehn-table/foehn-table-column-configuration.d.ts +0 -14
- package/foehn-table/foehn-table-page-change-event.d.ts +0 -5
- package/foehn-table/foehn-table.component.d.ts +0 -40
- package/foehn-table/foehn-table.module.d.ts +0 -13
- package/foehn-table/row-element.type.d.ts +0 -4
- package/foehn-table/tableSort.d.ts +0 -4
- package/foehn-upload/abstract-foehn-uploader.component.d.ts +0 -68
- package/foehn-upload/document-reference.d.ts +0 -12
- package/foehn-upload/foehn-bo-multi-upload/bo-multi-upload.service.d.ts +0 -27
- package/foehn-upload/foehn-bo-multi-upload/bo-multi-upload.type.d.ts +0 -11
- package/foehn-upload/foehn-bo-multi-upload/foehn-bo-multi-upload.component.d.ts +0 -38
- package/foehn-upload/foehn-bo-multi-upload/foehn-bo-multi-upload.module.d.ts +0 -13
- package/foehn-upload/foehn-multi-upload/foehn-multi-upload.component.d.ts +0 -42
- package/foehn-upload/foehn-multi-upload/foehn-multi-upload.module.d.ts +0 -13
- package/foehn-upload/foehn-multi-upload/multi-upload.service.d.ts +0 -29
- package/foehn-upload/foehn-multi-upload/multi-upload.type.d.ts +0 -11
- package/foehn-upload/foehn-multi-upload/pending-upload.service.d.ts +0 -26
- package/foehn-upload/foehn-picture-upload/foehn-picture-upload.component.d.ts +0 -38
- package/foehn-upload/foehn-picture-upload/foehn-picture-upload.module.d.ts +0 -14
- package/foehn-upload/foehn-upload-progress-bar/foehn-upload-progress-bar.component.d.ts +0 -22
- package/foehn-upload/foehn-upload-progress-bar/foehn-upload-progress-bar.module.d.ts +0 -11
- package/foehn-upload/foehn-upload-progress-bar/upload-progress.service.d.ts +0 -19
- package/foehn-upload/foehn-upload-progress-bar/upload-progress.type.d.ts +0 -6
- package/foehn-upload/page-upload-limit.service.d.ts +0 -22
- package/foehn-upload/pending-upload.type.d.ts +0 -9
- package/foehn-upload/uploader.helper.d.ts +0 -66
- package/foehn-user-connected-as/foehn-user-connected-as.component.d.ts +0 -12
- package/foehn-user-connected-as/foehn-user-connected-as.module.d.ts +0 -9
- package/foehn-validation-alert-summary/foehn-validation-alert-summary.component.d.ts +0 -20
- package/foehn-validation-alert-summary/foehn-validation-alert-summary.module.d.ts +0 -9
- package/foehn-validation-alerts/foehn-validation-alerts.component.d.ts +0 -14
- package/foehn-validation-alerts/foehn-validation-alerts.module.d.ts +0 -8
- package/form-error.d.ts +0 -5
- package/form-post-response.d.ts +0 -19
- package/gesdem/gesdem-error-handler.service.d.ts +0 -22
- package/gesdem/gesdem-event.service.d.ts +0 -16
- package/gesdem/gesdem-handler.service.d.ts +0 -52
- package/gesdem/gesdem-loader.guard.d.ts +0 -2
- package/gesdem/gesdem-statut-utils.d.ts +0 -12
- package/gesdem-action-recovery/gesdem-action-recovery-login/gesdem-action-recovery-login.component.d.ts +0 -39
- package/gesdem-action-recovery/gesdem-action-recovery-registration/gesdem-action-recovery-registration.component.d.ts +0 -59
- package/gesdem-action-recovery/gesdem-action-recovery.module.d.ts +0 -17
- package/gesdem-action-recovery/gesdem-action-recovery.service.d.ts +0 -24
- package/gesdem-action-recovery/reprise-info.d.ts +0 -6
- package/gesdem-confirmation/gesdem-confirmation.component.d.ts +0 -65
- package/gesdem-confirmation/gesdem-confirmation.module.d.ts +0 -12
- package/gesdem-error/gesdem-error.component.d.ts +0 -34
- package/gesdem-error/gesdem-error.module.d.ts +0 -12
- package/global.const.d.ts +0 -1
- package/helpers/demande.helper.d.ts +0 -3
- package/helpers/object.helper.d.ts +0 -30
- package/i18n-form.d.ts +0 -5
- package/index.d.ts +0 -5
- package/pipes/currency.pipe.d.ts +0 -10
- package/pipes/date.pipe.d.ts +0 -12
- package/pipes/formatIde.pipe.d.ts +0 -7
- package/pipes/pipes.module.d.ts +0 -9
- package/prestations-ng-core.module.d.ts +0 -12
- package/public-api.d.ts +0 -238
- package/refinf/model/address-type-light.d.ts +0 -5
- package/refinf/model/canton.d.ts +0 -4
- package/refinf/model/district.d.ts +0 -7
- package/refinf/model/municipality.d.ts +0 -9
- package/refinf/model/place-of-origin.d.ts +0 -9
- package/refinf/model/postal-locality.d.ts +0 -11
- package/sdk-appinfo/application-info.d.ts +0 -61
- package/sdk-appinfo/application-info.service.d.ts +0 -32
- package/sdk-currency/currency.helper.d.ts +0 -9
- package/sdk-date/date.helper.d.ts +0 -20
- package/sdk-dictionary/default-dictionary.d.ts +0 -2
- package/sdk-dictionary/sdk-dictionary.module.d.ts +0 -7
- package/sdk-dictionary/sdk-dictionary.pipe.d.ts +0 -12
- package/sdk-dictionary/sdk-dictionary.service.d.ts +0 -44
- package/sdk-drafts/draft.model.d.ts +0 -5
- package/sdk-drafts/drafts-container.component.d.ts +0 -33
- package/sdk-drafts/drafts.module.d.ts +0 -14
- package/sdk-drafts/drafts.service.d.ts +0 -20
- package/sdk-epayment/model/EPaymentParameters.d.ts +0 -21
- package/sdk-epayment/pending-payment/pending-payment.component.d.ts +0 -9
- package/sdk-epayment/sdk-epayment.component.d.ts +0 -33
- package/sdk-epayment/sdk-epayment.module.d.ts +0 -11
- package/sdk-epayment/sdk-epayment.service.d.ts +0 -21
- package/sdk-events-logger/sdk-event-type.d.ts +0 -12
- package/sdk-events-logger/sdk-event.d.ts +0 -8
- package/sdk-events-logger/sdk-events-logger.service.d.ts +0 -18
- package/sdk-recaptcha/grecaptcha/grecaptcha.component.d.ts +0 -39
- package/sdk-recaptcha/recaptcha.service.d.ts +0 -44
- package/sdk-recaptcha/sdk-recaptcha.component.d.ts +0 -27
- package/sdk-recaptcha/sdk-recaptcha.module.d.ts +0 -9
- package/sdk-redirect/iam-expired-interceptor.service.d.ts +0 -12
- package/sdk-redirect/redirect.component.d.ts +0 -22
- package/sdk-redirect/sdk-redirect.module.d.ts +0 -9
- package/sdk-session-info/session-info-data.d.ts +0 -29
- package/sdk-session-info/session-info-with-application.service.d.ts +0 -20
- package/sdk-session-info/session-info.service.d.ts +0 -17
- package/sdk-statistics/sdk-statistics.service.d.ts +0 -24
- package/sdk-support-alert/support-alert-container.component.d.ts +0 -20
- package/sdk-support-alert/support-alert.component.d.ts +0 -12
- package/sdk-support-alert/support-alert.model.d.ts +0 -12
- package/sdk-support-alert/support-alert.module.d.ts +0 -10
- package/sdk-support-alert/support-alert.service.d.ts +0 -34
- package/service-locator.d.ts +0 -4
- package/supported-browser.d.ts +0 -1
- package/validation/validation-handler.service.d.ts +0 -15
package/UPGRADING_V19.md
ADDED
|
@@ -0,0 +1,1405 @@
|
|
|
1
|
+
# PRESTAKIT : Upgrading from v18 to v19
|
|
2
|
+
|
|
3
|
+
To migrate your project from `prestakit` v18 to v19, you need to migrate prestations-ng and prestations-be, as usual.
|
|
4
|
+
But to migrate to prestations-be v19, you need to migrate your project to Spring Boot 4 / Java 25.
|
|
5
|
+
|
|
6
|
+
Let's start by migrating to Spring Boot 4 / prestations-be v19.
|
|
7
|
+
|
|
8
|
+
## PRESTATIONS-BE (via parent - Spring boot 4 / java 25)
|
|
9
|
+
|
|
10
|
+
From here on, we are in the root folder of your project, for example ~/git/cybsdk/skeleton.
|
|
11
|
+
|
|
12
|
+
### Spring Boot 4
|
|
13
|
+
|
|
14
|
+
You can switch to Java 25 `jdk25` + change in IntelliJ: right-click on your project > Open Module Settings > Project > set "SDK" to `jdk25` from devtools and "Language
|
|
15
|
+
level" to `25` in "Modules"
|
|
16
|
+
|
|
17
|
+
Use the latest application-parent v15+ in your `pom.xml`.
|
|
18
|
+
|
|
19
|
+
You can use this OpenRewrite recipe to simplify the migration (run with java 25).
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
source ~/devtools/fordev.sh 25 20
|
|
23
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0 -Pnof,noft
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Fixes
|
|
27
|
+
|
|
28
|
+
Fix application.properties :
|
|
29
|
+
|
|
30
|
+
```diff
|
|
31
|
+
# Remove the following properties if it was added by the recipe
|
|
32
|
+
spring.liquibase.password=${spring.datasource.password}
|
|
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
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If the following plugin with Lombok path was added by the recipe, remove this plugin:
|
|
38
|
+
|
|
39
|
+
```xml
|
|
40
|
+
<plugin>
|
|
41
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
42
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
|
43
|
+
<configuration>
|
|
44
|
+
<annotationProcessorPaths>
|
|
45
|
+
<path>
|
|
46
|
+
<groupId>org.projectlombok</groupId>
|
|
47
|
+
<artifactId>lombok</artifactId>
|
|
48
|
+
<version>1.18.40</version>
|
|
49
|
+
</path>
|
|
50
|
+
</annotationProcessorPaths>
|
|
51
|
+
</configuration>
|
|
52
|
+
</plugin>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If the code uses `AutoConfigureMockMvc`, add:
|
|
56
|
+
|
|
57
|
+
```xml
|
|
58
|
+
<dependency>
|
|
59
|
+
<groupId>org.springframework.boot</groupId>
|
|
60
|
+
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
|
61
|
+
<scope>test</scope>
|
|
62
|
+
</dependency>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
And replace the old `AutoConfigureMockMvc` import which is not recognized anymore by the new one.
|
|
66
|
+
|
|
67
|
+
If we use in pom.xml Spring/Hibernate dependencies (like hibernate-jpamodelgen), check the Spring Boot 4 migration
|
|
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
|
+
|
|
70
|
+
### Jackson migration
|
|
71
|
+
|
|
72
|
+
With Spring Boot 4, Jackson 3 is now used instead of Jackson 2, so we need to replace the previous Jackson 2 classes.
|
|
73
|
+
Replace `com.fasterxml.jackson.databind.ObjectMapper` with `tools.jackson.databind.json.JsonMapper`.
|
|
74
|
+
|
|
75
|
+
### BO : Package renaming
|
|
76
|
+
|
|
77
|
+
- `ch.vd.cyberadminbe.jms` has been moved to `ch.vd.cyber.backofficebe.jms`
|
|
78
|
+
- `ch.vd.cyberadminbe.security` has been moved to `ch.vd.cyber.backofficebe.security`
|
|
79
|
+
- `ch.vd.cyberadminbe.editique` has been moved to `ch.vd.cyber.backofficebe.editique`
|
|
80
|
+
- `cyberadminbe.config.CyberAdminBeEsbHttpConfig` has renamed to `backofficebe.config.BoCommonEsbHttpConfig`
|
|
81
|
+
|
|
82
|
+
### BO : Brave Tracer
|
|
83
|
+
|
|
84
|
+
If you are using Brave Tracer (search `brace.Tracer` in the code, usually in backoffices), you need to replace it with
|
|
85
|
+
OpenTelemetry by adding the following dependencies (already included by `ch.vd.cyber:starter-bo-jdbc-jms` and `ch.vd.cyber:starter-prestation`):
|
|
86
|
+
|
|
87
|
+
```xml
|
|
88
|
+
<!-- Tracing -->
|
|
89
|
+
<dependency>
|
|
90
|
+
<groupId>org.springframework.boot</groupId>
|
|
91
|
+
<artifactId>spring-boot-micrometer-tracing-opentelemetry</artifactId>
|
|
92
|
+
</dependency>
|
|
93
|
+
<dependency>
|
|
94
|
+
<groupId>io.micrometer</groupId>
|
|
95
|
+
<artifactId>micrometer-tracing-bridge-otel</artifactId>
|
|
96
|
+
</dependency>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
And replace `brave.Tracer` imports by `io.micrometer.tracing.Tracer`;
|
|
100
|
+
|
|
101
|
+
#### BO : EsbMessageListenerWithSleuthIntegration
|
|
102
|
+
|
|
103
|
+
This base class has been moved from `ch.vd.cyber.sdk:cyberadmin-be` to `ch.vd.cyber.sdk:backoffice-be`
|
|
104
|
+
and renamed `EsbMessageListenerWithTracingPropagation`.
|
|
105
|
+
the constructor has also been updated :
|
|
106
|
+
|
|
107
|
+
```java
|
|
108
|
+
import ch.vd.cyberadminbe.jms.EsbMessageListenerWithSleuthIntegration;
|
|
109
|
+
import brave.Tracer;
|
|
110
|
+
|
|
111
|
+
public class MyListener extends EsbMessageListenerWithSleuthIntegration {
|
|
112
|
+
public MyListener(final EsbJmsTemplate nozipEsbTemplate,
|
|
113
|
+
final Tracer tracer) {
|
|
114
|
+
super(nozipEsbTemplate, tracer);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
should now be :
|
|
120
|
+
|
|
121
|
+
```java
|
|
122
|
+
import ch.vd.cyber.backofficebe.jms.EsbMessageListenerWithTracingPropagation;
|
|
123
|
+
import io.micrometer.tracing.propagation.Propagator;
|
|
124
|
+
import io.micrometer.tracing.Tracer;
|
|
125
|
+
|
|
126
|
+
public class MyListener extends EsbMessageListenerWithTracingPropagation {
|
|
127
|
+
public MyListener(final EsbJmsTemplate nozipEsbTemplate,
|
|
128
|
+
final Tracer tracer,
|
|
129
|
+
final Propagator propagator) {
|
|
130
|
+
super(nozipEsbTemplate, tracer, propagator);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
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
|
+
|
|
137
|
+
### BO : ESB Integration
|
|
138
|
+
|
|
139
|
+
- Check that you should always create your ListenerContainer with `ch.vd.cyber.backofficebe.jms.EsbConfigUtils.createDefaultMessageListenerContainer(...)`
|
|
140
|
+
- This simplifies the configuration and ensures that the correct `MessageListenerContainer` is used with the new tracing integration.
|
|
141
|
+
|
|
142
|
+
### Property migration
|
|
143
|
+
|
|
144
|
+
Run your application with this dependency :
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
<dependency>
|
|
148
|
+
<groupId>org.springframework.boot</groupId>
|
|
149
|
+
<artifactId>spring-boot-properties-migrator</artifactId>
|
|
150
|
+
<scope>runtime</scope>
|
|
151
|
+
</dependency>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Look for logs that indicate property you should migrate (watch for WARN logs of class PropertiesMigrationListener), update them and remove the dependency
|
|
155
|
+
|
|
156
|
+
### BO using jpa repositories
|
|
157
|
+
|
|
158
|
+
As we also have jdbc in the classpath, to avoid having dozens of log like "Spring Data JDBC - Could not safely
|
|
159
|
+
identify store assignment for repository candidate interface", add the property in your application.properties :
|
|
160
|
+
|
|
161
|
+
spring.data.jdbc.repositories.enabled=false
|
|
162
|
+
|
|
163
|
+
### Debugging tips
|
|
164
|
+
|
|
165
|
+
Spring boot 4 doesn't support calling a controller with a trailing slash, fix the url called (/api/ping != /api/ping**/**)
|
|
166
|
+
|
|
167
|
+
### Clean Sonar code smells
|
|
168
|
+
|
|
169
|
+
You can use the following OpenRewrite recipes to clean Sonar code smells. It is recommended to do it after the migration to avoid mixing the migration changes with code cleaning changes, and to make it easier to review.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.junit.JUnit6BestPractices, -Pnof,noft
|
|
173
|
+
|
|
174
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-static-analysis:RELEASE -Drewrite.activeRecipes=org.openrewrite.staticanalysis.CommonStaticAnalysis -Pnof,noft
|
|
175
|
+
|
|
176
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run --define rewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE --define rewrite.activeRecipes=org.openrewrite.java.testing.mockito.MockitoBestPractices --define rewrite.exportDatatables=true -Pnof,noft
|
|
177
|
+
|
|
178
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.activeRecipes=org.openrewrite.java.RemoveUnusedImports -Pnof,noft
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Take a look at Sonar to see other things that you can improve or ignore.
|
|
182
|
+
|
|
183
|
+
## PRESTATIONS-NG
|
|
184
|
+
|
|
185
|
+
For the commands in this guide, it is supposed that your are in the `front` folder of your project.
|
|
186
|
+
|
|
187
|
+
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.
|
|
189
|
+
|
|
190
|
+
A lot of breaking because our library has migrated to **standalone** components, **signals** and **inject function** instead of constructor injection parameters.
|
|
191
|
+
|
|
192
|
+
> 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8**
|
|
193
|
+
|
|
194
|
+
### Migrate to ESLint
|
|
195
|
+
|
|
196
|
+
(NB : you can skip this step if you already have a `front/.eslintrc.json` file, it means it is already done.)
|
|
197
|
+
|
|
198
|
+
Follow [our migration guide](ESLINT_MIGRATION_GUIDE.md) to migrate your project from TSLint to ESLint.
|
|
199
|
+
|
|
200
|
+
### Upgrade to Angular 20
|
|
201
|
+
|
|
202
|
+
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
|
+
|
|
204
|
+
**NB: Commit before continuing so your repository is clean.**
|
|
205
|
+
|
|
206
|
+
Remove your `resolutions` in `package.json` before starting : if you have `resolutions` in `package.json`, remove manually the section.
|
|
207
|
+
|
|
208
|
+
In the next commands, commit before each ng update.
|
|
209
|
+
|
|
210
|
+
Unlink `@dsivd/prestations-ng` by running `yarn unlink @dsivd/prestations-ng` in your `front` folder if you have linked it before.
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
npm install
|
|
214
|
+
npm install @angular/cli@19 -g
|
|
215
|
+
ng update @angular/core@19 @angular/cli@19
|
|
216
|
+
ng update @dsivd/prestations-ng@18
|
|
217
|
+
```
|
|
218
|
+
|
|
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
|
+
#### Switch to node 22+
|
|
247
|
+
|
|
248
|
+
##### If you are using our `slave-apps`
|
|
249
|
+
|
|
250
|
+
Be sure to update your `slave-apps` git repository and source your `.bashrc` (or whatever file you're using).
|
|
251
|
+
|
|
252
|
+
Verify your node version in your terminal by executing:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
node -v
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**NB: If version is still v20+ by default, type `node22` in your terminal to switch to node v22+**
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
node22
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
##### If you are NOT using our `slave-apps`
|
|
265
|
+
|
|
266
|
+
Be sure to use a node version 22+ in your terminal:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
node -v
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
#### In your project
|
|
273
|
+
|
|
274
|
+
Update your `package.json` file to specify the node engine:
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"engines": {
|
|
279
|
+
"node": ">=22.18.0"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### Update your jenkins files
|
|
285
|
+
|
|
286
|
+
- Change `nodeVersion: 20` to use node 22
|
|
287
|
+
|
|
288
|
+
##### UT folder
|
|
289
|
+
|
|
290
|
+
```diff
|
|
291
|
+
buildAppPipelinePodmanUT([
|
|
292
|
+
- node: 20,
|
|
293
|
+
+ node: 22,
|
|
294
|
+
])
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Upgrade to Angular 21
|
|
298
|
+
|
|
299
|
+
`prestations-ng` **v19+** now supports **Angular v21**.
|
|
300
|
+
|
|
301
|
+
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
|
+
|
|
303
|
+
**NB: Commit before continuing so your repository is clean.**
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
npm install @angular/cli@21 -g
|
|
307
|
+
ng update @dsivd/prestations-ng@latest
|
|
308
|
+
```
|
|
309
|
+
|
|
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".
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
ng update @angular/cli@21
|
|
316
|
+
```
|
|
317
|
+
|
|
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".
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
npm install @types/node@22 ts-node@10
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**NB: When using `@angular/cdk` in your project**
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
ng update @angular/cdk@21
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**NB: When using `ngx-matomo-client` in your project**
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
ng update ngx-matomo-client@9
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Quick fix
|
|
339
|
+
|
|
340
|
+
- In all custom components extending `FoehnInputComponent`, in `providers` providing `FoehnInputComponent` remove `multi: true,`.
|
|
341
|
+
|
|
342
|
+
```diff
|
|
343
|
+
{
|
|
344
|
+
provide: FoehnInputComponent,
|
|
345
|
+
useExisting: forwardRef(() => ItemListComponent),
|
|
346
|
+
- multi: true,
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
- In your `.eslintrc.json`, remove `"/src/main.ts",` from `ignorePatterns`.
|
|
351
|
+
|
|
352
|
+
- In `main.ts`, replace `platformBrowserDynamic` by `platformBrowser`.
|
|
353
|
+
|
|
354
|
+
- When using `<foehn-list-summary` component, replace `list` by `model`.
|
|
355
|
+
|
|
356
|
+
### Now fix your project before continuing
|
|
357
|
+
|
|
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.**
|
|
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".
|
|
361
|
+
|
|
362
|
+
Check every `constructor` in your project, and remove useless `constructor` parameters that are not used anymore (like `ActivatedRoute` in components extending `AbstractPageComponent`).
|
|
363
|
+
|
|
364
|
+
Run the following command until you have no more errors.
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
npm run build
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
**TIP: If your IntelliJ is still showing you errors on `@if` or `@for`, close it and re-open it to fix.**
|
|
371
|
+
|
|
372
|
+
### Migrate to inject function
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
ng generate @angular/core:inject
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
✔ Which directory do you want to migrate? **./**
|
|
379
|
+
|
|
380
|
+
✔ Do you want to migrate abstract classes? Abstract classes are not migrated by default, because their parameters aren't guaranteed to be injectable. **Yes**
|
|
381
|
+
|
|
382
|
+
✔ Do you want to clean up all constructors or keep them backwards compatible? Enabling this option will include an additional signature of `constructor(...args:
|
|
383
|
+
unknown[]);` that will avoid errors for sub-classes, but will increase the amount of generated code by the migration. **No**
|
|
384
|
+
|
|
385
|
+
✔ 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
|
+
type safety. **Yes**
|
|
387
|
+
|
|
388
|
+
Go through every file that has changed and fix what is broken.
|
|
389
|
+
|
|
390
|
+
Reorder public / private and remove unused imports so ESLINT is happy again.
|
|
391
|
+
|
|
392
|
+
For example, when extending `AbstractPageComponent`:
|
|
393
|
+
Before:
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
sessionInfoData: SessionInfoWithApplicationService;
|
|
397
|
+
|
|
398
|
+
constructor(
|
|
399
|
+
protected override activatedRoute: ActivatedRoute,
|
|
400
|
+
private readonly dictionaryService: SdkDictionaryService,
|
|
401
|
+
sessionInfoData: SessionInfoWithApplicationService
|
|
402
|
+
) {
|
|
403
|
+
super(activatedRoute);
|
|
404
|
+
this.sessionInfoData = sessionInfoData;
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
After:
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
sessionInfoData = inject(SessionInfoWithApplicationService);
|
|
412
|
+
|
|
413
|
+
private readonly dictionaryService = inject(SdkDictionaryService);
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Most of the time, you can remove `activatedRoute` because it was used as a constructor parameter for `AbstractPageComponent`.
|
|
417
|
+
|
|
418
|
+
### Migrate to self-closing tags
|
|
419
|
+
|
|
420
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
npm run build
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Fix remaining errors and warnings, then run the following command:
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
ng generate @angular/core:self-closing-tag
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
✔ Which directory do you want to migrate? **./**
|
|
433
|
+
|
|
434
|
+
### Migrate to standalone
|
|
435
|
+
|
|
436
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
437
|
+
|
|
438
|
+
**TIP: Check [Migrating from NgModules](COMPONENTS.md#migrating_from_ngmodules) for more information before running following commands.**
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
npm run build
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
Fix remaining errors and warnings, then run the following command:
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
ng generate @angular/core:standalone
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Choose **"Convert all components, directives and pipes to standalone"** then
|
|
451
|
+
|
|
452
|
+
✔ Which directory do you want to migrate? **./**
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
npm run build
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
ng generate @angular/core:standalone
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Choose **"Remove unnecessary NgModule classes"** then
|
|
463
|
+
|
|
464
|
+
✔ Which directory do you want to migrate? **./**
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
npm run build
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
ng generate @angular/core:standalone
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Choose **"Bootstrap the application using standalone APIs"** then
|
|
475
|
+
|
|
476
|
+
✔ Which directory do you want to migrate? **./**
|
|
477
|
+
|
|
478
|
+
#### Now check and fix manually the migration of your `app.component.ts` to standalone
|
|
479
|
+
|
|
480
|
+
It should look like that:
|
|
481
|
+
|
|
482
|
+
```diff
|
|
483
|
+
@Component({
|
|
484
|
+
selector: 'app-root',
|
|
485
|
+
templateUrl: './app.component.html',
|
|
486
|
+
- // eslint-disable-next-line @angular-eslint/prefer-standalone
|
|
487
|
+
- standalone: false
|
|
488
|
+
+ imports: [
|
|
489
|
+
+ RouterOutlet,
|
|
490
|
+
+ NgHttpLoaderComponent,
|
|
491
|
+
+ RedirectComponent,
|
|
492
|
+
+ ]
|
|
493
|
+
})
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Create a file under `src/app` called `app.routes.ts` with the following content:
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
export const routes: Routes = [
|
|
500
|
+
// Your routes found in app-routing.module.ts go here
|
|
501
|
+
];
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Create a file under `src/app` called `app.config.ts` with the following content:
|
|
505
|
+
|
|
506
|
+
```ts
|
|
507
|
+
export const appConfig: ApplicationConfig = {
|
|
508
|
+
providers: [
|
|
509
|
+
provideZoneChangeDetection(),
|
|
510
|
+
providePrestationsNgCore(),
|
|
511
|
+
provideRouter(routes),
|
|
512
|
+
META_SERVICE_PROVIDER,
|
|
513
|
+
provideHttpClient(
|
|
514
|
+
withInterceptors([pendingRequestsInterceptor$]),
|
|
515
|
+
withXsrfConfiguration({
|
|
516
|
+
cookieName: 'XSRF-TOKEN',
|
|
517
|
+
headerName: 'X-XSRF-TOKEN',
|
|
518
|
+
}),
|
|
519
|
+
),
|
|
520
|
+
],
|
|
521
|
+
};
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
Now replace the content of `main.ts` with the following content:
|
|
525
|
+
|
|
526
|
+
```ts
|
|
527
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
528
|
+
|
|
529
|
+
import { AppComponent } from './app/app.component';
|
|
530
|
+
import { appConfig } from './app/app.config';
|
|
531
|
+
|
|
532
|
+
bootstrapApplication(AppComponent, appConfig).catch((err) =>
|
|
533
|
+
console.error(err),
|
|
534
|
+
);
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
Clean up your project by removing `app-routing.module.ts` and `app.module.ts` files if it has not already been done.
|
|
538
|
+
|
|
539
|
+
#### Migration to lazy-loaded routes when working with large applications
|
|
540
|
+
|
|
541
|
+
You may have some other modules that are maybe lazy-loaded. Just be sure that all your components are standalone before continuing.
|
|
542
|
+
|
|
543
|
+
> 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
|
+
|
|
545
|
+
> This migration will also collect information about all the components declared in NgModules and output the list of routes that use them (including corresponding location of the file). Consider making those components standalone.
|
|
546
|
+
|
|
547
|
+
```bash
|
|
548
|
+
ng generate @angular/core:route-lazy-loading
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
Here is a example when doing it manually because schematic above does not work as intended:
|
|
552
|
+
|
|
553
|
+
Your `app.routing.ts` file should look something like this:
|
|
554
|
+
|
|
555
|
+
```ts
|
|
556
|
+
const routes: Routes = [
|
|
557
|
+
{
|
|
558
|
+
path: '',
|
|
559
|
+
component: PageWrapperComponent,
|
|
560
|
+
data: { root: true },
|
|
561
|
+
children: [
|
|
562
|
+
{
|
|
563
|
+
path: 'demandes',
|
|
564
|
+
loadChildren: () =>
|
|
565
|
+
import('./modules/demandes/demandes.module').then(
|
|
566
|
+
(m) => m.DemandesModule,
|
|
567
|
+
),
|
|
568
|
+
},
|
|
569
|
+
{ path: '404', component: FoehnNotfoundComponent },
|
|
570
|
+
{ path: '', redirectTo: 'demandes', pathMatch: 'full' },
|
|
571
|
+
{ path: '**', redirectTo: '/404', pathMatch: 'full' },
|
|
572
|
+
],
|
|
573
|
+
},
|
|
574
|
+
];
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
Now, navigate to `DemandesModule`, at the same file level as `demandes.module.ts`, you create a `demandes.routes.ts` file with the following content:
|
|
578
|
+
|
|
579
|
+
```ts
|
|
580
|
+
export const demandes_routes: Routes = [
|
|
581
|
+
// Your routes found in demandes.module.ts go here
|
|
582
|
+
];
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
Then replace `loadChildren: () => import('./modules/demandes/demandes.module').then(m => m.DemandesModule)` by `loadChildren: () => import('./modules/demandes/demandes.routes').then(m => m.demandes_routes)`.
|
|
586
|
+
|
|
587
|
+
Now you can safely delete `demandes.module.ts` as all components are `standalone` now.
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
You can `lazy-load` components as well, for example:
|
|
592
|
+
|
|
593
|
+
```diff
|
|
594
|
+
export const demandes_routes: Routes = [
|
|
595
|
+
- { path: 'list', component: DemandeListPageComponent },
|
|
596
|
+
+ { path: 'list', loadComponent: () => import('./demande-list-page/demande-list-page.component').then(m => m.DemandeListPageComponent) },
|
|
597
|
+
];
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### Migrate from NgClass to class bindings
|
|
601
|
+
|
|
602
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
603
|
+
|
|
604
|
+
```bash
|
|
605
|
+
npm run build
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
Fix remaining errors and warnings, then run the following command:
|
|
609
|
+
|
|
610
|
+
```bash
|
|
611
|
+
ng generate @angular/core:ngclass-to-class
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
✔ Which directory do you want to migrate? **./**
|
|
615
|
+
|
|
616
|
+
✔ Should the migration also migrate space-separated keys? **Yes**
|
|
617
|
+
|
|
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.
|
|
621
|
+
|
|
622
|
+
**Be aware that `[class]` replaces all element classes. When you have static classes, concatenate them with dynamic ones.**
|
|
623
|
+
|
|
624
|
+
Replacement example:
|
|
625
|
+
|
|
626
|
+
Before:
|
|
627
|
+
|
|
628
|
+
```html
|
|
629
|
+
[ngClass]="isLabelSrOnly ? 'visually-hidden' : 'vd-p'"
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
After:
|
|
633
|
+
|
|
634
|
+
```html
|
|
635
|
+
[class.visually-hidden]="isLabelSrOnly()" [class.vd-p]="!isLabelSrOnly()"
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
---
|
|
639
|
+
|
|
640
|
+
Before:
|
|
641
|
+
|
|
642
|
+
```html
|
|
643
|
+
class="modal" [ngClass]="modalSize"
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
After:
|
|
647
|
+
|
|
648
|
+
```html
|
|
649
|
+
[class]="'modal ' + modalSize()"
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
---
|
|
653
|
+
|
|
654
|
+
Before:
|
|
655
|
+
|
|
656
|
+
```html
|
|
657
|
+
class="form-label" [ngClass]="isLabelSrOnly() ? 'visually-hidden' :
|
|
658
|
+
labelStyleModifier()"
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
After:
|
|
662
|
+
|
|
663
|
+
```html
|
|
664
|
+
[class]="'form-label ' + (isLabelSrOnly() ? 'visually-hidden' :
|
|
665
|
+
(labelStyleModifier() ?? ''))"
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
### Migrate from NgStyle to style bindings
|
|
669
|
+
|
|
670
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
671
|
+
|
|
672
|
+
```bash
|
|
673
|
+
npm run build
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
Fix remaining errors and warnings, then run the following command:
|
|
677
|
+
|
|
678
|
+
```bash
|
|
679
|
+
ng generate @angular/core:ngstyle-to-style
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
✔ Which directory do you want to migrate? **./**
|
|
683
|
+
|
|
684
|
+
✔ Should the migration also migrate object references? **No**
|
|
685
|
+
|
|
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.
|
|
689
|
+
|
|
690
|
+
### Convert CommonModule usage to standalone imports
|
|
691
|
+
|
|
692
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
693
|
+
|
|
694
|
+
```bash
|
|
695
|
+
npm run build
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
Fix remaining errors and warnings, then run the following command:
|
|
699
|
+
|
|
700
|
+
```bash
|
|
701
|
+
ng generate @angular/core:common-to-standalone
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
✔ Which directory do you want to migrate? **./**
|
|
705
|
+
|
|
706
|
+
Check every file that has changed and fix what is broken.
|
|
707
|
+
|
|
708
|
+
### Migrate @HostListener
|
|
709
|
+
|
|
710
|
+
Search for `@HostListener` in your project and replace it with the `host` object in the `@Component` or `@Directive` decorator.
|
|
711
|
+
|
|
712
|
+
For example, when using `@HostListener` in a directive:
|
|
713
|
+
|
|
714
|
+
Before:
|
|
715
|
+
|
|
716
|
+
```ts
|
|
717
|
+
@Directive({
|
|
718
|
+
selector: '[numberCurrencyFormatter]',
|
|
719
|
+
})
|
|
720
|
+
export class NumberCurrencyFormatterDirective implements OnInit {
|
|
721
|
+
@HostListener('blur', ['$event.target.value'])
|
|
722
|
+
onBlur(value: string): void {
|
|
723
|
+
this.hasFocus = false;
|
|
724
|
+
this.setFormatting(value);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
After:
|
|
730
|
+
|
|
731
|
+
```ts
|
|
732
|
+
@Directive({
|
|
733
|
+
selector: '[numberCurrencyFormatter]',
|
|
734
|
+
host: {
|
|
735
|
+
'(blur)': 'onBlur($event)',
|
|
736
|
+
},
|
|
737
|
+
})
|
|
738
|
+
export class NumberCurrencyFormatterDirective implements OnInit {
|
|
739
|
+
onBlur(event: FocusEvent): void {
|
|
740
|
+
this.hasFocus = false;
|
|
741
|
+
const value = (event.target as HTMLInputElement).value;
|
|
742
|
+
this.setFormatting(value);
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
### Migrate to signal queries
|
|
748
|
+
|
|
749
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
750
|
+
|
|
751
|
+
```bash
|
|
752
|
+
npm run build
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
Fix remaining errors and warnings, then run the following command:
|
|
756
|
+
|
|
757
|
+
```bash
|
|
758
|
+
ng generate @angular/core:signal-queries-migration --insert-todos
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
✔ Which directory do you want to migrate? **./**
|
|
762
|
+
|
|
763
|
+
✔ Do you want to migrate as much as possible, even if it may break your build? **No**
|
|
764
|
+
|
|
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.
|
|
770
|
+
|
|
771
|
+
### Migrate to output functions
|
|
772
|
+
|
|
773
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
774
|
+
|
|
775
|
+
```bash
|
|
776
|
+
npm run build
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
Fix remaining errors and warnings, then run the following command:
|
|
780
|
+
|
|
781
|
+
```bash
|
|
782
|
+
ng generate @angular/core:output-migration
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
✔ Which directory do you want to migrate? **./**
|
|
786
|
+
|
|
787
|
+
Check every remaining `@Output` usage in your project and replace them with output function.
|
|
788
|
+
|
|
789
|
+
When needing to subscribe to an output, you can use `outputToObservable` from `@angular/core/rxjs-interop`.
|
|
790
|
+
|
|
791
|
+
### Migrate to input signals
|
|
792
|
+
|
|
793
|
+
Check our [Angular signals guide](ANGULAR_SIGNALS.md) for more information about signals and input signals.
|
|
794
|
+
|
|
795
|
+
**WARNING: The following command will work only when your application compiles without errors. If you have errors, fix them before continuing.**
|
|
796
|
+
|
|
797
|
+
```bash
|
|
798
|
+
npm run build
|
|
799
|
+
```
|
|
800
|
+
|
|
801
|
+
Fix remaining errors and warnings, then run the following command:
|
|
802
|
+
|
|
803
|
+
```bash
|
|
804
|
+
ng generate @angular/core:signal-input-migration --insert-todos
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
✔ Which directory do you want to migrate? **./**
|
|
808
|
+
|
|
809
|
+
✔ Do you want to migrate as much as possible, even if it may break your build? **No**
|
|
810
|
+
|
|
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.
|
|
816
|
+
|
|
817
|
+
### Migrate to vitest
|
|
818
|
+
|
|
819
|
+
[Angular migration guide: migrating to Vitest](https://angular.dev/guide/testing/migrating-to-vitest)
|
|
820
|
+
|
|
821
|
+
```bash
|
|
822
|
+
npm install --save-dev vitest jsdom
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
In your `angular.json` file, remove `"zone.js/dist/zone-error"` from `"allowedCommonJsDependencies"`
|
|
826
|
+
|
|
827
|
+
then find the `test` target for your project and change the `builder` to `@angular/build:unit-test` and add following options:
|
|
828
|
+
|
|
829
|
+
```json
|
|
830
|
+
{
|
|
831
|
+
"projects": {
|
|
832
|
+
"your-project-name": {
|
|
833
|
+
"architect": {
|
|
834
|
+
"test": {
|
|
835
|
+
"builder": "@angular/build:unit-test",
|
|
836
|
+
"options": {
|
|
837
|
+
"buildTarget": "your-project-name:build"
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
In your package.json file, add the following scripts:
|
|
847
|
+
|
|
848
|
+
```diff
|
|
849
|
+
{
|
|
850
|
+
"scripts": {
|
|
851
|
+
- "test": "ng test",
|
|
852
|
+
+ "test": "ng test --watch=false",
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
In your `tsconfig.spec.json` file, remove from `types` `jasmine` and `node` and add `vitest/globals`:
|
|
858
|
+
|
|
859
|
+
```diff
|
|
860
|
+
{
|
|
861
|
+
"compilerOptions": {
|
|
862
|
+
"types": [
|
|
863
|
+
- "jasmine",
|
|
864
|
+
- "node"
|
|
865
|
+
+ "vitest/globals"
|
|
866
|
+
]
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
In your `.gitignore` file, add the following line to ignore the `screenshot` folder:
|
|
872
|
+
|
|
873
|
+
```
|
|
874
|
+
__screenshots__
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
Now remove karma and jasmine dependencies
|
|
878
|
+
|
|
879
|
+
```bash
|
|
880
|
+
npm uninstall jasmine jasmine-core jasmine-spec-reporter
|
|
881
|
+
npm uninstall karma karma-chrome-launcher karma-coverage karma-jasmine karma-jasmine-html-reporter
|
|
882
|
+
npm uninstall puppeteer
|
|
883
|
+
npm uninstall @types/jasmine @types/jasminewd2
|
|
884
|
+
rm karma.conf.js
|
|
885
|
+
```
|
|
886
|
+
|
|
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.
|
|
889
|
+
|
|
890
|
+
Then run following command to migrate from jasmine to vitest:
|
|
891
|
+
|
|
892
|
+
```bash
|
|
893
|
+
ng g @schematics/angular:refactor-jasmine-vitest
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
Now you can run your tests with `npm test` and check that everything is up and running.
|
|
897
|
+
|
|
898
|
+
In your tests, replace `waitForAsync(() => ...)` by `async(...)` and add `await` before `TestBed.configureTestingModule`.
|
|
899
|
+
For example, replace this:
|
|
900
|
+
|
|
901
|
+
Before:
|
|
902
|
+
|
|
903
|
+
```ts
|
|
904
|
+
import {
|
|
905
|
+
provideHttpClient,
|
|
906
|
+
withInterceptorsFromDi,
|
|
907
|
+
} from '@angular/common/http';
|
|
908
|
+
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
|
909
|
+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
|
910
|
+
import { RouterModule } from '@angular/router';
|
|
911
|
+
|
|
912
|
+
import { AppComponent } from './app.component';
|
|
913
|
+
import { AppModule } from './app.module';
|
|
914
|
+
|
|
915
|
+
describe('AppComponent', () => {
|
|
916
|
+
let component: AppComponent;
|
|
917
|
+
let fixture: ComponentFixture<AppComponent>;
|
|
918
|
+
|
|
919
|
+
beforeEach(waitForAsync(() => {
|
|
920
|
+
TestBed.configureTestingModule({
|
|
921
|
+
imports: [AppModule, RouterModule.forRoot([])],
|
|
922
|
+
providers: [
|
|
923
|
+
provideHttpClient(withInterceptorsFromDi()),
|
|
924
|
+
provideHttpClientTesting(),
|
|
925
|
+
],
|
|
926
|
+
}).compileComponents();
|
|
927
|
+
}));
|
|
928
|
+
|
|
929
|
+
beforeEach(() => {
|
|
930
|
+
fixture = TestBed.createComponent(AppComponent);
|
|
931
|
+
component = fixture.componentInstance;
|
|
932
|
+
fixture.detectChanges();
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
it('should create', () => {
|
|
936
|
+
expect(component).toBeTruthy();
|
|
937
|
+
});
|
|
938
|
+
});
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
After:
|
|
942
|
+
|
|
943
|
+
```ts
|
|
944
|
+
import {
|
|
945
|
+
provideHttpClient,
|
|
946
|
+
withInterceptorsFromDi,
|
|
947
|
+
} from '@angular/common/http';
|
|
948
|
+
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
|
949
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
950
|
+
import { provideRouter } from '@angular/router';
|
|
951
|
+
|
|
952
|
+
import { AppComponent } from './app.component';
|
|
953
|
+
|
|
954
|
+
describe('AppComponent', () => {
|
|
955
|
+
let component: AppComponent;
|
|
956
|
+
let fixture: ComponentFixture<AppComponent>;
|
|
957
|
+
|
|
958
|
+
beforeEach(async () => {
|
|
959
|
+
await TestBed.configureTestingModule({
|
|
960
|
+
imports: [AppComponent],
|
|
961
|
+
providers: [
|
|
962
|
+
provideHttpClient(withInterceptorsFromDi()),
|
|
963
|
+
provideHttpClientTesting(),
|
|
964
|
+
provideRouter([]),
|
|
965
|
+
],
|
|
966
|
+
}).compileComponents();
|
|
967
|
+
|
|
968
|
+
fixture = TestBed.createComponent(AppComponent);
|
|
969
|
+
component = fixture.componentInstance;
|
|
970
|
+
await fixture.whenStable();
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
it('should create', () => {
|
|
974
|
+
expect(component).toBeTruthy();
|
|
975
|
+
});
|
|
976
|
+
});
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
### Migrate to eslint flat configuration
|
|
980
|
+
|
|
981
|
+
```bash
|
|
982
|
+
npm uninstall @angular-eslint/builder @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser
|
|
983
|
+
npm uninstall @typescript-eslint/eslint-plugin @typescript-eslint/parser @typescript-eslint/types @typescript-eslint/utils
|
|
984
|
+
npm uninstall eslint-import-resolver-typescript eslint-plugin-cypress eslint-plugin-import eslint-plugin-jasmine eslint-plugin-rxjs eslint-plugin-rxjs-angular eslint-plugin-simple-npm eslint-plugin-simple-import-sort
|
|
985
|
+
npm uninstall eslint
|
|
986
|
+
|
|
987
|
+
npm install --save-dev eslint@^9 angular-eslint@21 typescript-eslint@^8
|
|
988
|
+
npm install --save-dev @typescript-eslint/parser@8 @smarttools/eslint-plugin-rxjs@1
|
|
989
|
+
npm install --save-dev eslint-plugin-simple-import-sort@13
|
|
990
|
+
npm install --save-dev eslint-config-prettier@10
|
|
991
|
+
npm install --save-dev eslint-plugin-import-x@4
|
|
992
|
+
npm install --save-dev prettier
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
In your `front` folder, add a `.prettierrc` file with the following content:
|
|
996
|
+
|
|
997
|
+
```json
|
|
998
|
+
{
|
|
999
|
+
"printWidth": 100,
|
|
1000
|
+
"singleQuote": true,
|
|
1001
|
+
"arrowParens": "always",
|
|
1002
|
+
"trailingComma": "all",
|
|
1003
|
+
"htmlWhitespaceSensitivity": "css",
|
|
1004
|
+
"overrides": [
|
|
1005
|
+
{
|
|
1006
|
+
"files": ["*.html"],
|
|
1007
|
+
"options": {
|
|
1008
|
+
"parser": "angular"
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
Add a `.prettierignore` file with the following content:
|
|
1016
|
+
|
|
1017
|
+
```text
|
|
1018
|
+
node_modules
|
|
1019
|
+
.git
|
|
1020
|
+
target
|
|
1021
|
+
package.json
|
|
1022
|
+
package-lock.json
|
|
1023
|
+
dist
|
|
1024
|
+
coverage
|
|
1025
|
+
.angular
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
Remove your old `.eslintrc.json` file in your `front` folder:
|
|
1029
|
+
|
|
1030
|
+
```bash
|
|
1031
|
+
rm .eslintrc.json
|
|
1032
|
+
```
|
|
1033
|
+
|
|
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:
|
|
1037
|
+
|
|
1038
|
+
```ts
|
|
1039
|
+
// @ts-check
|
|
1040
|
+
import eslint from '@eslint/js';
|
|
1041
|
+
import tseslint from 'typescript-eslint';
|
|
1042
|
+
import angular from 'angular-eslint';
|
|
1043
|
+
import rxjs from '@smarttools/eslint-plugin-rxjs';
|
|
1044
|
+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
1045
|
+
import prettier from 'eslint-config-prettier';
|
|
1046
|
+
import importX from 'eslint-plugin-import-x';
|
|
1047
|
+
|
|
1048
|
+
export default tseslint.config(
|
|
1049
|
+
{
|
|
1050
|
+
ignores: ['**/coverage/**', '**/dist/**'],
|
|
1051
|
+
},
|
|
1052
|
+
|
|
1053
|
+
// ─── TypeScript ────────────────────────────────────────────────────────────
|
|
1054
|
+
{
|
|
1055
|
+
files: ['**/*.ts'],
|
|
1056
|
+
extends: [
|
|
1057
|
+
eslint.configs.recommended,
|
|
1058
|
+
...tseslint.configs.recommended, // covers: no-explicit-any, ban-ts-comment,
|
|
1059
|
+
// no-unused-expressions, no-var, no-unused-vars…
|
|
1060
|
+
...tseslint.configs.stylistic, // covers: array-type, consistent-type-assertions,
|
|
1061
|
+
// dot-notation, no-inferrable-types (default options),
|
|
1062
|
+
// no-empty-function (error), prefer-for-of,
|
|
1063
|
+
// prefer-function-type…
|
|
1064
|
+
...angular.configs.tsRecommended, // covers: prefer-inject, no-empty-lifecycle-method,
|
|
1065
|
+
// use-lifecycle-interface…
|
|
1066
|
+
],
|
|
1067
|
+
languageOptions: {
|
|
1068
|
+
parserOptions: {
|
|
1069
|
+
projectService: true,
|
|
1070
|
+
tsconfigRootDir: import.meta.dirname,
|
|
1071
|
+
},
|
|
1072
|
+
},
|
|
1073
|
+
plugins: {
|
|
1074
|
+
rxjs,
|
|
1075
|
+
'simple-import-sort': simpleImportSort,
|
|
1076
|
+
'import-x': importX,
|
|
1077
|
+
},
|
|
1078
|
+
processor: angular.processInlineTemplates,
|
|
1079
|
+
rules: {
|
|
1080
|
+
// ── @angular-eslint ──────────────────────────────────────────────
|
|
1081
|
+
'@angular-eslint/component-selector': [
|
|
1082
|
+
'error',
|
|
1083
|
+
{
|
|
1084
|
+
type: 'element',
|
|
1085
|
+
prefix: 'app',
|
|
1086
|
+
style: 'kebab-case',
|
|
1087
|
+
},
|
|
1088
|
+
],
|
|
1089
|
+
'@angular-eslint/directive-selector': [
|
|
1090
|
+
'error',
|
|
1091
|
+
{
|
|
1092
|
+
type: 'attribute',
|
|
1093
|
+
prefix: 'app',
|
|
1094
|
+
style: 'camelCase',
|
|
1095
|
+
},
|
|
1096
|
+
],
|
|
1097
|
+
|
|
1098
|
+
// ── @typescript-eslint ───────────────────────────────────────────
|
|
1099
|
+
'@typescript-eslint/explicit-function-return-type': [
|
|
1100
|
+
'error',
|
|
1101
|
+
{
|
|
1102
|
+
allowExpressions: true,
|
|
1103
|
+
allowTypedFunctionExpressions: true,
|
|
1104
|
+
allowHigherOrderFunctions: true,
|
|
1105
|
+
allowDirectConstAssertionInArrowFunctions: true,
|
|
1106
|
+
},
|
|
1107
|
+
],
|
|
1108
|
+
'@typescript-eslint/explicit-member-accessibility': [
|
|
1109
|
+
'error',
|
|
1110
|
+
{ accessibility: 'no-public' },
|
|
1111
|
+
],
|
|
1112
|
+
'@typescript-eslint/member-delimiter-style': 'error',
|
|
1113
|
+
'@typescript-eslint/member-ordering': 'error',
|
|
1114
|
+
'@typescript-eslint/no-base-to-string': 'warn',
|
|
1115
|
+
// stylistic enables no-inferrable-types with default options (ignoreParameters: false);
|
|
1116
|
+
// override here to allow typed parameters explicitly
|
|
1117
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
1118
|
+
'error',
|
|
1119
|
+
{ ignoreParameters: true },
|
|
1120
|
+
],
|
|
1121
|
+
// stylistic sets no-empty-function to error; downgrade to warn
|
|
1122
|
+
'@typescript-eslint/no-empty-function': 'warn',
|
|
1123
|
+
'@typescript-eslint/prefer-includes': 'warn',
|
|
1124
|
+
'@typescript-eslint/return-await': ['error', 'never'],
|
|
1125
|
+
'@typescript-eslint/typedef': ['error', { parameter: true }],
|
|
1126
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
1127
|
+
// off here — @typescript-eslint/no-shadow handles it correctly for TS
|
|
1128
|
+
'no-shadow': 'off',
|
|
1129
|
+
'@typescript-eslint/no-shadow': ['error', { hoist: 'all' }],
|
|
1130
|
+
'@typescript-eslint/no-unused-vars': [
|
|
1131
|
+
'error',
|
|
1132
|
+
{
|
|
1133
|
+
varsIgnorePattern: '^_',
|
|
1134
|
+
argsIgnorePattern: '^_',
|
|
1135
|
+
caughtErrorsIgnorePattern: '^_',
|
|
1136
|
+
},
|
|
1137
|
+
],
|
|
1138
|
+
|
|
1139
|
+
// ── eslint core ──────────────────────────────────────────────────
|
|
1140
|
+
'arrow-body-style': 'error',
|
|
1141
|
+
'arrow-parens': ['error', 'as-needed'],
|
|
1142
|
+
curly: 'error',
|
|
1143
|
+
eqeqeq: ['error', 'always'],
|
|
1144
|
+
'guard-for-in': 'error',
|
|
1145
|
+
'no-bitwise': 'error',
|
|
1146
|
+
'no-caller': 'error',
|
|
1147
|
+
'no-console': ['error', { allow: ['log', 'warn', 'error'] }],
|
|
1148
|
+
'no-eval': 'error',
|
|
1149
|
+
'no-extra-boolean-cast': 'off',
|
|
1150
|
+
'no-multiple-empty-lines': 'error',
|
|
1151
|
+
'no-new-wrappers': 'error',
|
|
1152
|
+
'no-restricted-imports': [
|
|
1153
|
+
'error',
|
|
1154
|
+
{ paths: ['rxjs/Rx', 'primeng/primeng', 'primeng'] },
|
|
1155
|
+
],
|
|
1156
|
+
'no-return-assign': 'error',
|
|
1157
|
+
'no-throw-literal': 'error',
|
|
1158
|
+
'no-undef-init': 'error',
|
|
1159
|
+
'no-useless-concat': 'error',
|
|
1160
|
+
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
|
|
1161
|
+
'one-var': ['error', 'never'],
|
|
1162
|
+
'prefer-arrow-callback': 'error',
|
|
1163
|
+
'prefer-template': 'error',
|
|
1164
|
+
radix: 'error',
|
|
1165
|
+
|
|
1166
|
+
// ── rxjs ─────────────────────────────────────────────────────────
|
|
1167
|
+
'rxjs/no-implicit-any-catch': ['error', { allowExplicitAny: true }],
|
|
1168
|
+
'rxjs/no-sharereplay': 'off',
|
|
1169
|
+
|
|
1170
|
+
// ── import-x ─────────────────────────────────────────────────────
|
|
1171
|
+
'import-x/no-cycle': [
|
|
1172
|
+
'warn',
|
|
1173
|
+
{ maxDepth: 3, ignoreExternal: true },
|
|
1174
|
+
],
|
|
1175
|
+
'import-x/no-deprecated': 'warn',
|
|
1176
|
+
'import-x/first': 'error',
|
|
1177
|
+
'import-x/newline-after-import': 'error',
|
|
1178
|
+
'import-x/no-duplicates': 'error',
|
|
1179
|
+
|
|
1180
|
+
// ── simple-import-sort ───────────────────────────────────────────
|
|
1181
|
+
'simple-import-sort/imports': 'error',
|
|
1182
|
+
'simple-import-sort/exports': 'error',
|
|
1183
|
+
},
|
|
1184
|
+
},
|
|
1185
|
+
|
|
1186
|
+
// ─── HTML templates ────────────────────────────────────────────────────────
|
|
1187
|
+
{
|
|
1188
|
+
files: ['**/*.html'],
|
|
1189
|
+
extends: [
|
|
1190
|
+
...angular.configs.templateRecommended,
|
|
1191
|
+
...angular.configs.templateAccessibility,
|
|
1192
|
+
],
|
|
1193
|
+
rules: {
|
|
1194
|
+
'@angular-eslint/template/no-negated-async': 'off',
|
|
1195
|
+
'@angular-eslint/template/button-has-type': 'error',
|
|
1196
|
+
},
|
|
1197
|
+
},
|
|
1198
|
+
|
|
1199
|
+
// ─── Prettier (must be last — disables formatting rules) ───────────────────
|
|
1200
|
+
prettier,
|
|
1201
|
+
);
|
|
1202
|
+
```
|
|
1203
|
+
|
|
1204
|
+
#### Delete `typing.d.ts`
|
|
1205
|
+
|
|
1206
|
+
In `front/src/`, remove the file `typing.d.ts` if it is still there.
|
|
1207
|
+
|
|
1208
|
+
#### Update your tsconfig\*.json files
|
|
1209
|
+
|
|
1210
|
+
- Replace your `tsconfig.json` content with:
|
|
1211
|
+
|
|
1212
|
+
```json
|
|
1213
|
+
{
|
|
1214
|
+
"compileOnSave": false,
|
|
1215
|
+
"compilerOptions": {
|
|
1216
|
+
"outDir": "./dist/out-tsc",
|
|
1217
|
+
"noImplicitOverride": true,
|
|
1218
|
+
"noImplicitReturns": true,
|
|
1219
|
+
"noFallthroughCasesInSwitch": true,
|
|
1220
|
+
"skipLibCheck": true,
|
|
1221
|
+
"esModuleInterop": true,
|
|
1222
|
+
"sourceMap": true,
|
|
1223
|
+
"declaration": false,
|
|
1224
|
+
"experimentalDecorators": true,
|
|
1225
|
+
"useDefineForClassFields": false,
|
|
1226
|
+
"moduleResolution": "bundler",
|
|
1227
|
+
"importHelpers": true,
|
|
1228
|
+
"isolatedModules": true,
|
|
1229
|
+
"target": "ES2022",
|
|
1230
|
+
"module": "ES2022",
|
|
1231
|
+
"paths": {
|
|
1232
|
+
"@dsivd/prestations-ng": ["./node_modules/@dsivd/prestations-ng"]
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1235
|
+
"angularCompilerOptions": {
|
|
1236
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
1237
|
+
"strictInjectionParameters": true,
|
|
1238
|
+
"strictInputAccessModifiers": true,
|
|
1239
|
+
"strictTemplates": true,
|
|
1240
|
+
"strictStandalone": true
|
|
1241
|
+
},
|
|
1242
|
+
"files": [],
|
|
1243
|
+
"references": [
|
|
1244
|
+
{
|
|
1245
|
+
"path": "./tsconfig.app.json"
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
"path": "./tsconfig.spec.json"
|
|
1249
|
+
}
|
|
1250
|
+
]
|
|
1251
|
+
}
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
- Replace your `tsconfig.app.json` content with:
|
|
1255
|
+
|
|
1256
|
+
```json
|
|
1257
|
+
{
|
|
1258
|
+
"extends": "./tsconfig.json",
|
|
1259
|
+
"compilerOptions": {
|
|
1260
|
+
"outDir": "../out-tsc/app",
|
|
1261
|
+
"types": []
|
|
1262
|
+
},
|
|
1263
|
+
"include": ["src/**/*.ts"],
|
|
1264
|
+
"exclude": ["src/**/*.spec.ts"]
|
|
1265
|
+
}
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
- Update your package.json, add the following script to run eslint:
|
|
1269
|
+
|
|
1270
|
+
```diff
|
|
1271
|
+
"scripts": {
|
|
1272
|
+
- "lint": "ng lint",
|
|
1273
|
+
+ "lint": "ng lint --fix=true",
|
|
1274
|
+
+ "format:prettier": "prettier --config ./.prettierrc --write \"{,!(.scannerwork|target|coverage|node_modules|.angular)/**/}*{.ts,.js,.jsx,.json,.css,.scss,.md,.html}\"",
|
|
1275
|
+
}
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
### Husky pre-commit hook
|
|
1279
|
+
|
|
1280
|
+
```bash
|
|
1281
|
+
npm install --save-dev husky lint-staged
|
|
1282
|
+
npx husky init
|
|
1283
|
+
echo "cd front" > .husky/pre-commit
|
|
1284
|
+
echo "npx lint-staged" >> .husky/pre-commit
|
|
1285
|
+
chmod +x .husky/pre-commit
|
|
1286
|
+
mv ./.husky ../.husky
|
|
1287
|
+
git add -A
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
- You can manually run formating commands as well:
|
|
1291
|
+
|
|
1292
|
+
```bash
|
|
1293
|
+
npm run format:prettier
|
|
1294
|
+
npm run lint
|
|
1295
|
+
```
|
|
1296
|
+
|
|
1297
|
+
Fix your `meta.service.ts` but replacing:
|
|
1298
|
+
|
|
1299
|
+
Before:
|
|
1300
|
+
|
|
1301
|
+
```ts
|
|
1302
|
+
export const metaServiceFactory =
|
|
1303
|
+
(metaService: MetaService): Function =>
|
|
1304
|
+
() =>
|
|
1305
|
+
lastValueFrom(metaService.load());
|
|
1306
|
+
|
|
1307
|
+
export const META_SERVICE_PROVIDER = provideAppInitializer(() => {
|
|
1308
|
+
const initializerFn = metaServiceFactory(inject(MetaService));
|
|
1309
|
+
return initializerFn();
|
|
1310
|
+
});
|
|
1311
|
+
```
|
|
1312
|
+
|
|
1313
|
+
After:
|
|
1314
|
+
|
|
1315
|
+
```ts
|
|
1316
|
+
export const META_SERVICE_PROVIDER = provideAppInitializer(() => {
|
|
1317
|
+
const metaService = inject(MetaService);
|
|
1318
|
+
return lastValueFrom(metaService.load());
|
|
1319
|
+
});
|
|
1320
|
+
```
|
|
1321
|
+
|
|
1322
|
+
Run again until no more errors:
|
|
1323
|
+
|
|
1324
|
+
```bash
|
|
1325
|
+
npm run lint
|
|
1326
|
+
```
|
|
1327
|
+
|
|
1328
|
+
Then:
|
|
1329
|
+
|
|
1330
|
+
```bash
|
|
1331
|
+
npm run format:prettier
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
### Browsers list update
|
|
1335
|
+
|
|
1336
|
+
Run update schematic:
|
|
1337
|
+
|
|
1338
|
+
```bash
|
|
1339
|
+
ng g @dsivd/prestations-ng:replace-browsers-list
|
|
1340
|
+
```
|
|
1341
|
+
|
|
1342
|
+
### Remove deprecated packages
|
|
1343
|
+
|
|
1344
|
+
```bash
|
|
1345
|
+
npm uninstall @angular/platform-browser-dynamic
|
|
1346
|
+
npm uninstall @angular/animations
|
|
1347
|
+
```
|
|
1348
|
+
|
|
1349
|
+
### Configure IntelliJ IDEA to use ESLint and Prettier on save
|
|
1350
|
+
|
|
1351
|
+
- To configure ESLint automatically in the current project, open "_File -> Settings..._" (`Ctrl+Alt+S`) and either:
|
|
1352
|
+
- Search for `ESLint` and check radio box "_Automatic ESLint configuration_" and check checkbox "_Run eslint --fix on save_"
|
|
1353
|
+
- Search for `Prettier` and check radio box "_Automatic Prettier configuration_" and check checkbox "_Run on save_"
|
|
1354
|
+
|
|
1355
|
+
### Language deprecations
|
|
1356
|
+
|
|
1357
|
+
When using `IntelliJ`, you can run code inspection on your project to fix deprecations manually. Two ways:
|
|
1358
|
+
|
|
1359
|
+
- IntelliJ window menu, go to: `Code > Analyze code > Run inspection by name...` (or **Ctrl+Alt+Maj+i**) and type `Deprecated symbol used`.
|
|
1360
|
+
- 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`.
|
|
1361
|
+
|
|
1362
|
+
### Last but not least, check if your application is working!!!
|
|
1363
|
+
|
|
1364
|
+
#### Be sure your application gets a fresh start
|
|
1365
|
+
|
|
1366
|
+
```bash
|
|
1367
|
+
rm -rf .angular/
|
|
1368
|
+
rm -rf node_modules/
|
|
1369
|
+
npm install
|
|
1370
|
+
```
|
|
1371
|
+
|
|
1372
|
+
#### Build and launch your application
|
|
1373
|
+
|
|
1374
|
+
**NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
|
|
1375
|
+
|
|
1376
|
+
```bash
|
|
1377
|
+
npm run build
|
|
1378
|
+
npm start
|
|
1379
|
+
```
|
|
1380
|
+
|
|
1381
|
+
You're good if no errors are remaining!
|
|
1382
|
+
Finally check if your tests run well :
|
|
1383
|
+
|
|
1384
|
+
```bash
|
|
1385
|
+
npm run test
|
|
1386
|
+
```
|
|
1387
|
+
|
|
1388
|
+
> 🚨 **Read carefully following [PITFALLS](ANGULAR_SIGNALS.md#common_pitfalls), especially points 4, 6 & 8 and check again your application**
|
|
1389
|
+
|
|
1390
|
+
### Release your application using `jenkins-libs`
|
|
1391
|
+
|
|
1392
|
+
When your code has been merged/rebased onto `master`, you need to update your application in `jenkins-libs` to use node 22 instead of node 20.
|
|
1393
|
+
|
|
1394
|
+
See [getImtPortailApplications](https://dsigit.etat-de-vaud.ch/outils/git/projects/PEE/repos/jenkins-libs/browse/vars/getImtPortailApplications.groovy)
|
|
1395
|
+
|
|
1396
|
+
```diff
|
|
1397
|
+
[
|
|
1398
|
+
'project': 'cybersdk',
|
|
1399
|
+
'name' : 'skeleton',
|
|
1400
|
+
'gitUrl' : 'ssh://git@bitbucket.etat-de-vaud.ch/cybsdk/skeleton.git',
|
|
1401
|
+
'jdk' : '21',
|
|
1402
|
+
- 'node' : '20'
|
|
1403
|
+
+ 'node' : '22'
|
|
1404
|
+
],
|
|
1405
|
+
```
|