DEV: Add top level `<div>` when using Ember CLI (#12878)

DEV: Add top level <div> when using Ember CLI (#12878)

Eventually we’d like to remove this but it makes our Ember CLI build consistent with the non-ember version.

diff --git a/app/assets/javascripts/discourse/app/components/discourse-root.js b/app/assets/javascripts/discourse/app/components/discourse-root.js
new file mode 100644
index 0000000..49a5fe6
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/discourse-root.js
@@ -0,0 +1,10 @@
+import Component from "@ember/component";
+
+let componentArgs = { tagName: "div" };
+
+// TODO: Once we've moved to Ember CLI completely we can remove this.
+if (!Ember.FEATURES.EMBER_GLIMMER_SET_COMPONENT_TEMPLATE) {
+  componentArgs = { tagName: "" };
+}
+
+export default Component.extend(componentArgs);
diff --git a/app/assets/javascripts/discourse/app/templates/application.hbs b/app/assets/javascripts/discourse/app/templates/application.hbs
index 0d304c5..8b3ecd7 100644
--- a/app/assets/javascripts/discourse/app/templates/application.hbs
+++ b/app/assets/javascripts/discourse/app/templates/application.hbs
@@ -1,42 +1,44 @@
-{{d-document}}
-{{plugin-outlet name="above-site-header" tagName=""}}
-{{site-header canSignUp=canSignUp
-              showCreateAccount=(route-action "showCreateAccount")
-              showLogin=(route-action "showLogin")
-              showKeyboard=(route-action "showKeyboardShortcutsHelp")
-              toggleMobileView=(route-action "toggleMobileView")
-              toggleAnonymous=(route-action "toggleAnonymous")
-              logout=(route-action "logout")}}
-{{software-update-prompt id="software-update-prompt"}}
+{{#discourse-root}}
+  {{d-document}}
+  {{plugin-outlet name="above-site-header" tagName=""}}
+  {{site-header canSignUp=canSignUp
+                showCreateAccount=(route-action "showCreateAccount")
+                showLogin=(route-action "showLogin")
+                showKeyboard=(route-action "showKeyboardShortcutsHelp")
+                toggleMobileView=(route-action "toggleMobileView")
+                toggleAnonymous=(route-action "toggleAnonymous")
+                logout=(route-action "logout")}}
+  {{software-update-prompt id="software-update-prompt"}}
 
-{{plugin-outlet name="below-site-header" tagName="" args=(hash currentPath=router._router.currentPath)}}
+  {{plugin-outlet name="below-site-header" tagName="" args=(hash currentPath=router._router.currentPath)}}
 
-<div id="main-outlet" class="wrap" role="main">
-  {{plugin-outlet name="above-main-container" tagName=""}}
-  <div class="container">
-    {{#if showTop}}
-      {{custom-html name="top"}}
-    {{/if}}
-    {{notification-consent-banner}}
-    {{pwa-install-banner}}
-    {{global-notice}}
-    {{create-topics-notice}}
-    {{plugin-outlet name="top-notices" tagName="" args=(hash currentPath=router._router.currentPath)}}
+  <div id="main-outlet" class="wrap" role="main">
+    {{plugin-outlet name="above-main-container" tagName=""}}
+    <div class="container">
+      {{#if showTop}}
+        {{custom-html name="top"}}
+      {{/if}}
+      {{notification-consent-banner}}
+      {{pwa-install-banner}}
+      {{global-notice}}
+      {{create-topics-notice}}
+      {{plugin-outlet name="top-notices" tagName="" args=(hash currentPath=router._router.currentPath)}}
+    </div>
+    {{outlet}}
+    {{outlet "user-card"}}
   </div>
-  {{outlet}}
-  {{outlet "user-card"}}
-</div>
 
-{{plugin-outlet name="above-footer" tagName="" args=(hash showFooter=showFooter)}}
-{{#if showFooter}}
-  {{custom-html name="footer" triggerAppEvent="true"}}
-{{/if}}
-{{plugin-outlet name="below-footer" tagName="" args=(hash showFooter=showFooter)}}
+  {{plugin-outlet name="above-footer" tagName="" args=(hash showFooter=showFooter)}}
+  {{#if showFooter}}
+    {{custom-html name="footer" triggerAppEvent="true"}}
+  {{/if}}
+  {{plugin-outlet name="below-footer" tagName="" args=(hash showFooter=showFooter)}}
 
-{{outlet "modal"}}
-{{topic-entrance}}
-{{outlet "composer"}}
+  {{outlet "modal"}}
+  {{topic-entrance}}
+  {{outlet "composer"}}
 
-{{#if showFooterNav}}
-  {{footer-nav}}
-{{/if}}
+  {{#if showFooterNav}}
+    {{footer-nav}}
+  {{/if}}
+{{/discourse-root}}

GitHub sha: bd23e793

This commit appears in #12878 which was approved by markvanlan. It was merged by eviltrout.