mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Print version info to console on boot (#24444)
Discourse already includes version information in a `<meta` tag on the page. This commit surfaces it to the console on boot for easier access, and also adds the Ember version (which will be particularly useful as we start rolling out the upgrade to Ember 5)
This commit is contained in:
parent
c803cc7067
commit
9d8abcbdfe
@ -10,6 +10,7 @@ import { registerDiscourseImplicitInjections } from "discourse/lib/implicit-inje
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import { isTesting } from "discourse-common/config/environment";
|
||||
import { buildResolver } from "discourse-common/resolver";
|
||||
import { VERSION } from "@ember/version";
|
||||
|
||||
const _pluginCallbacks = [];
|
||||
let _unhandledThemeErrors = [];
|
||||
@ -27,6 +28,8 @@ const Discourse = Application.extend({
|
||||
|
||||
// Start up the Discourse application by running all the initializers we've defined.
|
||||
start() {
|
||||
printDebugInfo();
|
||||
|
||||
document.querySelector("noscript")?.remove();
|
||||
|
||||
// Rewire event handling to eliminate event delegation for better compat
|
||||
@ -211,4 +214,28 @@ function resolveDiscourseInitializer(moduleName, themeId) {
|
||||
return initializer;
|
||||
}
|
||||
|
||||
let printedDebugInfo = false;
|
||||
function printDebugInfo() {
|
||||
if (printedDebugInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
let str = "ℹ️ ";
|
||||
|
||||
const generator = document.querySelector("meta[name=generator]")?.content;
|
||||
const parts = generator?.split(" ");
|
||||
if (parts) {
|
||||
const discourseVersion = parts[1];
|
||||
const gitVersion = parts[5]?.substr(0, 10);
|
||||
str += `Discourse v${discourseVersion} — https://github.com/discourse/discourse/commits/${gitVersion} — `;
|
||||
}
|
||||
|
||||
str += `Ember v${VERSION}`;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(str);
|
||||
|
||||
printedDebugInfo = true;
|
||||
}
|
||||
|
||||
export default Discourse;
|
||||
|
Loading…
Reference in New Issue
Block a user