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

Switch from an initializer to manual extendResolver usage #186

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

mkszepp
Copy link
Contributor

@mkszepp mkszepp commented Sep 19, 2024

ember-resolver v13 is now a native class instead of a EmberObject.

With EmberObject there was possible to reopen the class for making changes to pluralizedTypes.
This isn't anymore working with native classes. For this reason we need to provide users a short instructions like they can configure ember-can inside there app.

fix #185, close #184
implement logic from comment #184 (comment)

The app.js / .ts looks at end like:

import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from 'my-app/config/environment';
import { extendResolver } from 'ember-can';

export default class App extends Application {
  modulePrefix = config.modulePrefix;
  podModulePrefix = config.podModulePrefix;
  Resolver = extendResolver(Resolver);
}

loadInitializers(App, config.modulePrefix);

Why import { extendResolver } from 'ember-can'; instead of import Resolver from 'ember-can';?
The advantage is, that when an app has already extended the Resolver he can pass his extended resolver and the extending order is not relevant.

PR changes:

  • Add function for app
  • Add tests for ember-resolver < 12 with current latest ember-source LTS
  • Add instructions for users in install documentation

Copy link

@wozny1989 wozny1989 left a comment

Choose a reason for hiding this comment

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

Nice @mkszepp, looks very nice! 👍

@RobbieTheWagner RobbieTheWagner added the breaking Breaking Change label Sep 23, 2024
Copy link
Collaborator

@RobbieTheWagner RobbieTheWagner left a comment

Choose a reason for hiding this comment

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

This is awesome. Great work @mkszepp, thank you!

@RobbieTheWagner RobbieTheWagner changed the title Add support for ember-resolver v13 Switch from an initializer to manual extendResolver usage Sep 23, 2024
@RobbieTheWagner RobbieTheWagner merged commit 8feb0c2 into minutebase:master Sep 23, 2024
14 checks passed
@mkszepp mkszepp deleted the support-ember-resolver-v13 branch September 23, 2024 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking Change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatibility with ember-resolver v13.x
3 participants