Repository: ember-cli/ember-cli
Pull request #10685 (2025-04-04 19:48:52)

Add configuration to ember-cli-build to opt new projects out of the deprecated behavior of the Store class extending EmberObject
Fixes https://github.com/ember-cli/ember-cli/issues/10680


Patch:
diff --git a/blueprints/app/files/ember-cli-build.js b/blueprints/app/files/ember-cli-build.js
index 00131bf19..4680730da 100644
--- a/blueprints/app/files/ember-cli-build.js
+++ b/blueprints/app/files/ember-cli-build.js
@@ -4,7 +4,16 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
   const app = new EmberApp(defaults, {
-    <% if (typescript) {%>'ember-cli-babel': { enableTypeScriptTransform: true },
+    <% if (emberData) {%>emberData: {
+      deprecations: {
+        // New projects can safely leave this deprecation disabled.
+        // If upgrading, to opt-into the deprecated behavior, set this to true and then follow:
+        // https://deprecations.emberjs.com/id/ember-data-deprecate-store-extends-ember-object
+        // before upgrading to Ember Data 6.0
+        DEPRECATE_STORE_EXTENDS_EMBER_OBJECT: false,
+      },
+    },
+    <% } %><% if (typescript) {%>'ember-cli-babel': { enableTypeScriptTransform: true },
 
     <% } %>// Add options here
   });


Test patch:
diff --git a/tests/acceptance/new-test.js b/tests/acceptance/new-test.js
index 80b187a6e..68585994a 100644
--- a/tests/acceptance/new-test.js
+++ b/tests/acceptance/new-test.js
@@ -91,7 +91,7 @@ describe('Acceptance: ember new', function () {
     confirmBlueprintedForDir('blueprints/app', 'bar');
   });
 
-  it('ember new @foo/bar, when parent directory heirarchy contains `foo`', async function () {
+  it('ember new @foo/bar, when parent directory hierarchy contains `foo`', async function () {
     let scopedDirectoryPath = path.join(process.cwd(), 'foo', 'packages');
     fs.mkdirsSync(scopedDirectoryPath);
     process.chdir(scopedDirectoryPath);
@@ -723,6 +723,7 @@ describe('Acceptance: ember new', function () {
 
       checkFileWithJSONReplacement(fixturePath, 'config/ember-cli-update.json', 'packages[0].version', currentVersion);
       checkFileWithJSONReplacement(fixturePath, 'package.json', 'devDependencies.ember-cli', `~${currentVersion}`);
+      checkEmberCLIBuild(fixturePath, 'ember-cli-build.js');
     });
 
     it('app + typescript + no-ember-data', async function () {
@@ -738,6 +739,7 @@ describe('Acceptance: ember new', function () {
       checkFile('tsconfig.json', path.join(__dirname, '../fixtures', fixturePath, 'tsconfig.json'));
       checkFileWithJSONReplacement(fixturePath, 'config/ember-cli-update.json', 'packages[0].version', currentVersion);
       checkFileWithJSONReplacement(fixturePath, 'package.json', 'devDependencies.ember-cli', `~${currentVersion}`);
+      checkEmberCLIBuild(fixturePath, 'ember-cli-build.js');
     });
   });
 
diff --git a/tests/fixtures/app/defaults/ember-cli-build.js b/tests/fixtures/app/defaults/ember-cli-build.js
index ed991bd98..0582fad75 100644
--- a/tests/fixtures/app/defaults/ember-cli-build.js
+++ b/tests/fixtures/app/defaults/ember-cli-build.js
@@ -4,6 +4,15 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
   const app = new EmberApp(defaults, {
+    emberData: {
+      deprecations: {
+        // New projects can safely leave this deprecation disabled.
+        // If upgrading, to opt-into the deprecated behavior, set this to true and then follow:
+        // https://deprecations.emberjs.com/id/ember-data-deprecate-store-extends-ember-object
+        // before upgrading to Ember Data 6.0
+        DEPRECATE_STORE_EXTENDS_EMBER_OBJECT: false,
+      },
+    },
     // Add options here
   });
 
diff --git a/tests/fixtures/app/embroider-no-ember-data/ember-cli-build.js b/tests/fixtures/app/embroider-no-ember-data/ember-cli-build.js
new file mode 100644
index 000000000..f7f127db3
--- /dev/null
+++ b/tests/fixtures/app/embroider-no-ember-data/ember-cli-build.js
@@ -0,0 +1,22 @@
+'use strict';
+
+const EmberApp = require('ember-cli/lib/broccoli/ember-app');
+
+module.exports = function (defaults) {
+  const app = new EmberApp(defaults, {
+    // Add options here
+  });
+
+  const { Webpack } = require('@embroider/webpack');
+  return require('@embroider/compat').compatBuild(app, Webpack, {
+    staticAddonTestSupportTrees: true,
+    staticAddonTrees: true,
+    staticEmberSource: true,
+    staticInvokables: true,
+    skipBabel: [
+      {
+        package: 'qunit',
+      },
+    ],
+  });
+};
diff --git a/tests/fixtures/app/embroider/ember-cli-build.js b/tests/fixtures/app/embroider/ember-cli-build.js
index f7f127db3..3c70314ae 100644
--- a/tests/fixtures/app/embroider/ember-cli-build.js
+++ b/tests/fixtures/app/embroider/ember-cli-build.js
@@ -4,6 +4,15 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
   const app = new EmberApp(defaults, {
+    emberData: {
+      deprecations: {
+        // New projects can safely leave this deprecation disabled.
+        // If upgrading, to opt-into the deprecated behavior, set this to true and then follow:
+        // https://deprecations.emberjs.com/id/ember-data-deprecate-store-extends-ember-object
+        // before upgrading to Ember Data 6.0
+        DEPRECATE_STORE_EXTENDS_EMBER_OBJECT: false,
+      },
+    },
     // Add options here
   });
 
diff --git a/tests/fixtures/app/no-ember-data/ember-cli-build.js b/tests/fixtures/app/no-ember-data/ember-cli-build.js
new file mode 100644
index 000000000..ed991bd98
--- /dev/null
+++ b/tests/fixtures/app/no-ember-data/ember-cli-build.js
@@ -0,0 +1,11 @@
+'use strict';
+
+const EmberApp = require('ember-cli/lib/broccoli/ember-app');
+
+module.exports = function (defaults) {
+  const app = new EmberApp(defaults, {
+    // Add options here
+  });
+
+  return app.toTree();
+};
diff --git a/tests/fixtures/app/typescript-embroider-no-ember-data/ember-cli-build.js b/tests/fixtures/app/typescript-embroider-no-ember-data/ember-cli-build.js
new file mode 100644
index 000000000..ec43ac11a
--- /dev/null
+++ b/tests/fixtures/app/typescript-embroider-no-ember-data/ember-cli-build.js
@@ -0,0 +1,24 @@
+'use strict';
+
+const EmberApp = require('ember-cli/lib/broccoli/ember-app');
+
+module.exports = function (defaults) {
+  const app = new EmberApp(defaults, {
+    'ember-cli-babel': { enableTypeScriptTransform: true },
+
+    // Add options here
+  });
+
+  const { Webpack } = require('@embroider/webpack');
+  return require('@embroider/compat').compatBuild(app, Webpack, {
+    staticAddonTestSupportTrees: true,
+    staticAddonTrees: true,
+    staticEmberSource: true,
+    staticInvokables: true,
+    skipBabel: [
+      {
+        package: 'qunit',
+      },
+    ],
+  });
+};
diff --git a/tests/fixtures/app/typescript-embroider/ember-cli-build.js b/tests/fixtures/app/typescript-embroider/ember-cli-build.js
index ec43ac11a..21f49d2f1 100644
--- a/tests/fixtures/app/typescript-embroider/ember-cli-build.js
+++ b/tests/fixtures/app/typescript-embroider/ember-cli-build.js
@@ -4,6 +4,15 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
   const app = new EmberApp(defaults, {
+    emberData: {
+      deprecations: {
+        // New projects can safely leave this deprecation disabled.
+        // If upgrading, to opt-into the deprecated behavior, set this to true and then follow:
+        // https://deprecations.emberjs.com/id/ember-data-deprecate-store-extends-ember-object
+        // before upgrading to Ember Data 6.0
+        DEPRECATE_STORE_EXTENDS_EMBER_OBJECT: false,
+      },
+    },
     'ember-cli-babel': { enableTypeScriptTransform: true },
 
     // Add options here
diff --git a/tests/fixtures/app/typescript-no-ember-data/ember-cli-build.js b/tests/fixtures/app/typescript-no-ember-data/ember-cli-build.js
new file mode 100644
index 000000000..12f8dea58
--- /dev/null
+++ b/tests/fixtures/app/typescript-no-ember-data/ember-cli-build.js
@@ -0,0 +1,13 @@
+'use strict';
+
+const EmberApp = require('ember-cli/lib/broccoli/ember-app');
+
+module.exports = function (defaults) {
+  const app = new EmberApp(defaults, {
+    'ember-cli-babel': { enableTypeScriptTransform: true },
+
+    // Add options here
+  });
+
+  return app.toTree();
+};
diff --git a/tests/fixtures/app/typescript/ember-cli-build.js b/tests/fixtures/app/typescript/ember-cli-build.js
index 12f8dea58..d05950bb4 100644
--- a/tests/fixtures/app/typescript/ember-cli-build.js
+++ b/tests/fixtures/app/typescript/ember-cli-build.js
@@ -4,6 +4,15 @@ const EmberApp = require('ember-cli/lib/broccoli/ember-app');
 
 module.exports = function (defaults) {
   const app = new EmberApp(defaults, {
+    emberData: {
+      deprecations: {
+        // New projects can safely leave this deprecation disabled.
+        // If upgrading, to opt-into the deprecated behavior, set this to true and then follow:
+        // https://deprecations.emberjs.com/id/ember-data-deprecate-store-extends-ember-object
+        // before upgrading to Ember Data 6.0
+        DEPRECATE_STORE_EXTENDS_EMBER_OBJECT: false,
+      },
+    },
     'ember-cli-babel': { enableTypeScriptTransform: true },
 
     // Add options here