mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 14:42:46 +08:00
DEV: Silence 3.x deprecations
This prevents a storm of deprecation messages in the developer console. We'll be working through and enabling these one-by-one over the coming weeks/months. A dummy `discourse-ensure-deprecation-order` package is introduced to ensure that deprecation-workflow is loaded before `@ember/jquery`. This ensures that the `@ember/jquery`-triggered deprecation warnings can be silenced correctly This also introduces a system for silencing CLI warnings.
This commit is contained in:
parent
0ac90abcfa
commit
20fd81c2dc
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
name: require("./package").name,
|
||||
};
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "discourse-ensure-deprecation-order",
|
||||
"version": "1.0.0",
|
||||
"description": "A dummy addon which ensures ember-cli-deprecation-workflow is loaded before @ember/jquery",
|
||||
"author": "Discourse",
|
||||
"license": "GPL-2.0-only",
|
||||
"keywords": [
|
||||
"ember-addon"
|
||||
],
|
||||
"ember-addon": {
|
||||
"before": "@ember/jquery",
|
||||
"after": "ember-cli-deprecation-workflow"
|
||||
}
|
||||
}
|
|
@ -2,5 +2,26 @@ globalThis.deprecationWorkflow = globalThis.deprecationWorkflow || {};
|
|||
globalThis.deprecationWorkflow.config = {
|
||||
// We're using RAISE_ON_DEPRECATION in environment.js instead of
|
||||
// `throwOnUnhandled` here since it is easier to toggle.
|
||||
workflow: [],
|
||||
workflow: [
|
||||
{ handler: "silence", matchId: "ember-global" },
|
||||
{ handler: "silence", matchId: "ember-string.prototype-extensions" },
|
||||
{ handler: "silence", matchId: "ember.built-in-components.reopen" },
|
||||
{ handler: "silence", matchId: "ember.built-in-components.import" },
|
||||
{ handler: "silence", matchId: "implicit-injections" },
|
||||
{ handler: "silence", matchId: "route-render-template" },
|
||||
{ handler: "silence", matchId: "routing.transition-methods" },
|
||||
{ handler: "silence", matchId: "route-disconnect-outlet" },
|
||||
{ handler: "silence", matchId: "setting-on-hash" },
|
||||
{ handler: "silence", matchId: "this-property-fallback" },
|
||||
{ handler: "silence", matchId: "ember.globals-resolver" },
|
||||
{ handler: "silence", matchId: "globals-resolver" },
|
||||
{
|
||||
handler: "silence",
|
||||
matchId: "deprecated-run-loop-and-computed-dot-access",
|
||||
},
|
||||
{
|
||||
handler: "silence",
|
||||
matchId: "ember.built-in-components.legacy-arguments",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -10,10 +10,25 @@ const discourseScss = require("./lib/discourse-scss");
|
|||
const generateScriptsTree = require("./lib/scripts");
|
||||
const funnel = require("broccoli-funnel");
|
||||
|
||||
const SILENCED_WARN_PREFIXES = [
|
||||
"Setting the `jquery-integration` optional feature flag",
|
||||
"The Ember Classic edition has been deprecated",
|
||||
"Setting the `template-only-glimmer-components` optional feature flag to `false`",
|
||||
];
|
||||
|
||||
module.exports = function (defaults) {
|
||||
let discourseRoot = resolve("../../../..");
|
||||
let vendorJs = discourseRoot + "/vendor/assets/javascripts/";
|
||||
|
||||
// Silence the warnings listed in SILENCED_WARN_PREFIXES
|
||||
const ui = defaults.project.ui;
|
||||
const oldWriteWarning = ui.writeWarnLine.bind(ui);
|
||||
ui.writeWarnLine = (message, ...args) => {
|
||||
if (!SILENCED_WARN_PREFIXES.some((prefix) => message.startsWith(prefix))) {
|
||||
return oldWriteWarning(message, ...args);
|
||||
}
|
||||
};
|
||||
|
||||
const isProduction = EmberApp.env().includes("production");
|
||||
const isTest = EmberApp.env().includes("test");
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
"broccoli-asset-rev": "^3.0.0",
|
||||
"deepmerge": "^4.2.2",
|
||||
"discourse-common": "^1.0.0",
|
||||
"discourse-ensure-deprecation-order": "^1.0.0",
|
||||
"discourse-hbr": "^1.0.0",
|
||||
"discourse-widget-hbs": "^1.0.0",
|
||||
"ember-auto-import": "^2.4.2",
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"discourse",
|
||||
"admin",
|
||||
"discourse-common",
|
||||
"discourse-ensure-deprecation-order",
|
||||
"discourse-hbr",
|
||||
"discourse-widget-hbs",
|
||||
"pretty-text",
|
||||
|
|
Loading…
Reference in New Issue
Block a user