Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add a new method to handle deprecated configs #1408

Merged
merged 8 commits into from
Sep 22, 2023

Conversation

pelord
Copy link
Member

@pelord pelord commented Sep 21, 2023

Please check if the PR fulfills these requirements

What is the current behavior? (You can also link to an open issue here)
The is no method to warn user ou super user of deprecated configs.

What is the new behavior?
Add a way to infor user, inside the console, as a warn or an error, based on a deprecation date.
If there is an alternate key, the key will be suggested.
image

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications:

Other information:

const currentDate = new Date();
const deprecatedConfig = this.deprecatedConfigs.find(
(dc) => dc.key === key
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On jase, est-ce qu'on pourrait faire l'inverse, NewConfig qui définirait via un dictionnaire la nouvelle clé et les options de dépréciation.

const newKeyConfig = new Map([
  [
    "menu.button.show",
    {
      deprecatedKey: "showMenuButton",
      deprecationDate: new Date("2024-06-06"),
    },
  ],
]);

const allDeprecatedKey = Array.from(newKeyConfig.entries()).map(
  ([_newKey, value]) => value.deprecatedKey
);

Chaque fois qu'on serait en présence d'une valeur undefined, on vérifierait si c'était pour une nouvelle config. Lorsque se serait le cas, on tenterait d'aller chercher la valeur de la clé déprécié...?

Cela nous permettrait de simplifier nos application d'assemblage en supportant uniquement l'utilisation des nouvelles clé de config:

const showMenuConfig = this.configService.getConfig('menu.button.show');

On pourrait s'en parler de vive voix demain au besoin

@pelord pelord merged commit 8019300 into release/16.0.0 Sep 22, 2023
1 check passed
@pelord pelord deleted the handle-deprecated-config branch September 22, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants