REFACTOR: Sync up master with changes for Ember-CLI (#11671)

REFACTOR: Sync up master with changes for Ember-CLI (#11671)

The more parallel the branches, the easier the transition will be.

diff --git a/app/assets/javascripts/admin/package.json b/app/assets/javascripts/admin/package.json
index 71f324c..991e04a 100644
--- a/app/assets/javascripts/admin/package.json
+++ b/app/assets/javascripts/admin/package.json
@@ -48,6 +48,6 @@
     "node": "8.* || >= 10.*"
   },
   "ember": {
-    "edition": "octane"
+    "edition": "default"
   }
 }
diff --git a/app/assets/javascripts/app-boot.js b/app/assets/javascripts/app-boot.js
index 95ec3c3..8989827 100644
--- a/app/assets/javascripts/app-boot.js
+++ b/app/assets/javascripts/app-boot.js
@@ -4,6 +4,7 @@
   if (window.unsupportedBrowser) {
     throw "Unsupported browser detected";
   }
+
   let Discourse = requirejs("discourse/app").default.create();
 
   // required for our template compiler
@@ -11,7 +12,7 @@
     "discourse-common/lib/raw-templates"
   ).__DISCOURSE_RAW_TEMPLATES;
 
-  // required for select kit to work without Ember CLI
+  // required for addons to work without Ember CLI
   Object.keys(Ember.TEMPLATES).forEach((k) => {
     if (k.indexOf("select-kit") === 0) {
       let template = Ember.TEMPLATES[k];
diff --git a/app/assets/javascripts/discourse-common/addon/config/environment.js b/app/assets/javascripts/discourse-common/addon/config/environment.js
index b580231..409b6af 100644
--- a/app/assets/javascripts/discourse-common/addon/config/environment.js
+++ b/app/assets/javascripts/discourse-common/addon/config/environment.js
@@ -11,7 +11,7 @@ export function setEnvironment(e) {
 }
 
 export function isTesting() {
-  return Ember.testing;
+  return Ember.testing || environment === "testing";
 }
 
 export function isDevelopment() {
diff --git a/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js b/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js
index 6f6a386..37bb2c9 100644
--- a/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js
+++ b/app/assets/javascripts/discourse-common/addon/lib/raw-handlebars-helpers.js
@@ -40,8 +40,8 @@ export function registerRawHelpers(hbs, handlebarsClass) {
     }
     var list = get(this, contextName);
     var output = [];
-    var innerContext = Object.create(this);
     for (var i = 0; i < list.length; i++) {
+      let innerContext = {};
       innerContext[localName] = list[i];
       output.push(options.fn(innerContext));
     }
diff --git a/app/assets/javascripts/discourse-hbr/addon/.gitkeep b/app/assets/javascripts/discourse-hbr/addon/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/assets/javascripts/discourse-hbr/addon/.gitkeep
diff --git a/app/assets/javascripts/discourse-hbr/app/.gitkeep b/app/assets/javascripts/discourse-hbr/app/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/app/assets/javascripts/discourse-hbr/app/.gitkeep
diff --git a/app/assets/javascripts/discourse-hbr/config/ember-try.js b/app/assets/javascripts/discourse-hbr/config/ember-try.js
new file mode 100644
index 0000000..454a1ce
--- /dev/null
+++ b/app/assets/javascripts/discourse-hbr/config/ember-try.js
@@ -0,0 +1,89 @@
+"use strict";
+
+const getChannelURL = require("ember-source-channel-url");
+
+module.exports = async function () {
+  return {
+    useYarn: true,
+    scenarios: [
+      {
+        name: "ember-lts-3.8",
+        npm: {
+          devDependencies: {
+            "ember-source": "~3.8.0",
+          },
+        },
+      },
+      {
+        name: "ember-lts-3.12",
+        npm: {
+          devDependencies: {
+            "ember-source": "~3.12.0",
+          },
+        },
+      },
+      {
+        name: "ember-release",
+        npm: {
+          devDependencies: {
+            "ember-source": await getChannelURL("release"),
+          },
+        },
+      },
+      {
+        name: "ember-beta",
+        npm: {
+          devDependencies: {
+            "ember-source": await getChannelURL("beta"),
+          },
+        },
+      },
+      {
+        name: "ember-canary",
+        npm: {
+          devDependencies: {
+            "ember-source": await getChannelURL("canary"),
+          },
+        },
+      },
+      // The default `.travis.yml` runs this scenario via `yarn test`,
+      // not via `ember try`. It's still included here so that running
+      // `ember try:each` manually or from a customized CI config will run it
+      // along with all the other scenarios.
+      {
+        name: "ember-default",
+        npm: {
+          devDependencies: {},
+        },
+      },
+      {
+        name: "ember-default-with-jquery",
+        env: {
+          EMBER_OPTIONAL_FEATURES: JSON.stringify({
+            "jquery-integration": true,
+          }),
+        },
+        npm: {
+          devDependencies: {
+            "@ember/jquery": "^0.5.1",
+          },
+        },
+      },
+      {
+        name: "ember-classic",
+        env: {
+          EMBER_OPTIONAL_FEATURES: JSON.stringify({
+            "application-template-wrapper": true,
+            "default-async-observers": false,
+            "template-only-glimmer-components": false,
+          }),
+        },
+        npm: {
+          ember: {
+            edition: "classic",
+          },
+        },
+      },
+    ],
+  };
+};
diff --git a/app/assets/javascripts/discourse-hbr/config/environment.js b/app/assets/javascripts/discourse-hbr/config/environment.js
new file mode 100644
index 0000000..b723858
--- /dev/null
+++ b/app/assets/javascripts/discourse-hbr/config/environment.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = function (/* environment, appConfig */) {
+  return {};
+};
diff --git a/app/assets/javascripts/discourse-hbr/index.js b/app/assets/javascripts/discourse-hbr/index.js
new file mode 100644
index 0000000..6747915
--- /dev/null
+++ b/app/assets/javascripts/discourse-hbr/index.js
@@ -0,0 +1,11 @@
+"use strict";
+
+const rawHandlebarsCompiler = require("./raw-handlebars-compiler");
+
+module.exports = {
+  name: require("./package").name,
+
+  treeForApp() {
+    return rawHandlebarsCompiler(this.app.trees.app);
+  },
+};
diff --git a/app/assets/javascripts/discourse-hbr/package.json b/app/assets/javascripts/discourse-hbr/package.json
new file mode 100644
index 0000000..38037e8
--- /dev/null
+++ b/app/assets/javascripts/discourse-hbr/package.json
@@ -0,0 +1,54 @@
+{
+  "name": "discourse-hbr",
+  "version": "1.0.0",
+  "description": "Support for Discourse's raw Handlebars templates (hbr)",
+  "author": "Discourse",
+  "license": "GPL-2.0-only",
+  "keywords": [
+    "ember-addon"
+  ],
+  "repository": "",
+  "scripts": {
+    "build": "ember build",
+    "lint:hbs": "ember-template-lint .",
+    "lint:js": "eslint .",
+    "start": "ember serve"
+  },
+  "dependencies": {
+    "ember-auto-import": "^1.5.3",
+    "ember-cli-babel": "^7.13.0",
+    "ember-cli-htmlbars": "^4.2.0"
+  },
+  "devDependencies": {
+    "@ember/optional-features": "^1.1.0",
+    "@glimmer/component": "^1.0.0",
+    "babel-eslint": "^10.0.3",
+    "broccoli-asset-rev": "^3.0.0",
+    "broccoli-stew": "^3.0.0",
+    "ember-cli": "~3.15.2",
+    "ember-cli-dependency-checker": "^3.2.0",
+    "ember-cli-eslint": "^5.1.0",
+    "ember-cli-inject-live-reload": "^2.0.1",
+    "ember-cli-sri": "^2.1.1",
+    "ember-cli-template-lint": "^1.0.0-beta.3",
+    "ember-cli-uglify": "^3.0.0",
+    "ember-disable-prototype-extensions": "^1.1.3",
+    "ember-export-application-global": "^2.0.1",
+    "ember-load-initializers": "^2.1.1",
+    "ember-maybe-import-regenerator": "^0.1.6",
+    "ember-resolver": "^7.0.0",
+    "ember-source": "~3.15.0",
+    "ember-source-channel-url": "^2.0.1",
+    "ember-try": "^1.4.0",
+    "eslint-plugin-ember": "^7.7.1",
+    "eslint-plugin-node": "^10.0.0",
+    "handlebars": "^4.7.6",
+    "loader.js": "^4.7.0"
+  },
+  "engines": {
+    "node": "8.* || >= 10.*"
+  },
+  "ember": {
+    "edition": "octane"
+  }
+}

[... diff too long, it was truncated ...]

GitHub sha: e80332a2

This commit appears in #11671 which was approved by CvX. It was merged by eviltrout.