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

Initial working version #1

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Initial working version #1

wants to merge 9 commits into from

Conversation

mansona
Copy link
Member

@mansona mansona commented Jan 1, 2025

This is essentially extracted directly from ember-cli https://github.com/ember-cli/ember-cli/blob/fb5ecc800a9ebd1dafbb6b475e3bdab72df276f6/lib/debug/deprecate.js along with its tests

@bertdeblock
Copy link
Member

Cool, I was looking into doing the same thing.
Making a separate library for showing / handling (+ workflow) deprecations.
Though, personally, I would take the opportunity to e.g. update the API of deprecate.

type Deprecation = {
    for: string;
    id: string;
    message: string;
    since: { available: string; enabled?: string };
    until: string;
    url?: string;
};

function deprecate(deprecation: Deprecation): void

I think a deprecation should just be a single object, so including message with the rest of the information, so everything is grouped together. You can still override it when needed.

The message that is actually displayed should probably also be available somewhere. This would prevent issues like this.

Also, removing the condition argument. This has always been confusing for a lot of people. Having developers conditionally call deprecate is better I feel.

if (isUsingOldAPI) {
  deprecate(DEPRECATIONS.OLD_API);
}

Happy to help out if desired!

@mansona
Copy link
Member Author

mansona commented Jan 6, 2025

yea I'm happy to take this opportunity to change the API now, but I had a plan for this work 🤔 firstly I need it for embroider and it makes sense to split out the library, but I also don't like splitting out the library without also bringing the place you split it out from along for the ride: ember-cli/ember-cli#10610

now as I see it we have a few options:

  • simplify the API for a nice library that can be used in multiple places and then wrap the use of it in ember-cli
  • simplify the API and update all uses of it in ember-cli
  • ship it as is for a 1.0 version and then simplify the library for a 2.0 (maybe even using semver-deprecate to manage itself 😂)
  • something else

any preference or thoughts on the above?

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