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

fix: attempt traversal to find project #9500

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/-ember-data/addon-main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ if (pkg['ember-addon'].version === 1) {
delete addon.treeForApp;
}

function findApp(addon) {
let current = addon;
let app;

// Keep iterating upward until we don't have a grandparent.
// Has to do this grandparent check because at some point we hit the project.
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));

return app;
}

const included = addon.included;
addon.included = function includedIntercept() {
// we access this as a side-effect to ember-cli will give us a super call
Expand All @@ -16,7 +29,7 @@ addon.included = function includedIntercept() {
return included?.apply(this, arguments);
}
this.hasBeenCalled = true;
const app = this.app;
const app = findApp(this);
const dirname = app.project.root;
const { setConfig } = require('@warp-drive/build-config/cjs-set-config.cjs');
setConfig(app, dirname, Object.assign({}, app.options?.emberData, { ___legacy_support: true }));
Expand Down
Loading