mirror of
https://github.com/discourse/discourse.git
synced 2025-04-14 08:40:48 +08:00

From dependabot PR: <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/ember-cli/ember-cli-deprecation-workflow/releases">ember-cli-deprecation-workflow's releases</a>.</em></p> <blockquote> <h2>v3.0.1-ember-cli-deprecation-workflow</h2> <h2>Release (2024-07-11)</h2> <p>ember-cli-deprecation-workflow 3.0.1 (patch)</p> <h4>🏠 Internal</h4> <ul> <li><code>ember-cli-deprecation-workflow</code> <ul> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/192">#192</a> fix repository link in package.json (<a href="https://github.com/mansona"><code>@mansona</code></a>)</li> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/191">#191</a> update release plan workflow (<a href="https://github.com/mansona"><code>@mansona</code></a>)</li> </ul> </li> </ul> <h4>Committers: 1</h4> <ul> <li>Chris Manson (<a href="https://github.com/mansona"><code>@mansona</code></a>)</li> </ul> <h2>v3.0.0</h2> <h2>Release (2024-06-25)</h2> <p>ember-cli-deprecation-workflow 3.0.0 (major)</p> <h4>💥 Breaking Change</h4> <ul> <li><code>ember-cli-deprecation-workflow</code> <ul> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/159">#159</a> [BREAKING] Convert to a module. Drops support for Ember < 3.28, requires manual initialization (<a href="https://github.com/lolmaus"><code>@lolmaus</code></a>)</li> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/175">#175</a> Node 16 is the minimum supported version (<a href="https://github.com/mixonic"><code>@mixonic</code></a>)</li> </ul> </li> </ul> <h4>🐛 Bug Fix</h4> <ul> <li><code>ember-cli-deprecation-workflow</code> <ul> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/181">#181</a> Remove unused broccoli magic (<a href="https://github.com/simonihmig"><code>@simonihmig</code></a>)</li> </ul> </li> </ul> <h4>📝 Documentation</h4> <ul> <li><code>ember-cli-deprecation-workflow</code> <ul> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/184">#184</a> Update configuration paths in documentation (<a href="https://github.com/backspace"><code>@backspace</code></a>)</li> </ul> </li> </ul> <h4>🏠 Internal</h4> <ul> <li><code>ember-cli-deprecation-workflow</code> <ul> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/189">#189</a> start using release-plan (<a href="https://github.com/mansona"><code>@mansona</code></a>)</li> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/188">#188</a> start using pnpm (<a href="https://github.com/mansona"><code>@mansona</code></a>)</li> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/178">#178</a> Upgrade Ember CLI to 5.4 (<a href="https://github.com/lolmaus"><code>@lolmaus</code></a>)</li> <li><a href="https://redirect.github.com/ember-cli/ember-cli-deprecation-workflow/pull/170">#170</a> Bump Node, swap to npm, update CI pipeline (<a href="https://github.com/mixonic"><code>@mixonic</code></a>)</li> </ul> </li> </ul> <h4>Committers: 5</h4> <ul> <li>Andrey Mikhaylov (lolmaus) (<a href="https://github.com/lolmaus"><code>@lolmaus</code></a>)</li> <li>Buck Doyle (<a href="https://github.com/backspace"><code>@backspace</code></a>)</li> <li>Chris Manson (<a href="https://github.com/mansona"><code>@mansona</code></a>)</li> <li>Matthew Beale (<a href="https://github.com/mixonic"><code>@mixonic</code></a>)</li> <li>Simon Ihmig (<a href="https://github.com/simonihmig"><code>@simonihmig</code></a>)</li> </ul> </blockquote> </details>
52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
import { registerDeprecationHandler } from "@ember/debug";
|
|
import QUnit from "qunit";
|
|
import DEPRECATION_WORKFLOW from "discourse-common/deprecation-workflow";
|
|
import { registerDeprecationHandler as registerDiscourseDeprecationHandler } from "discourse-common/lib/deprecated";
|
|
|
|
let disabled = false;
|
|
|
|
export function configureRaiseOnDeprecation() {
|
|
if (window.EmberENV.RAISE_ON_DEPRECATION !== undefined) {
|
|
return;
|
|
}
|
|
|
|
registerDeprecationHandler((message, options, next) => {
|
|
if (
|
|
disabled ||
|
|
DEPRECATION_WORKFLOW.find((w) => w.matchId === options.id)
|
|
) {
|
|
return next(message, options);
|
|
}
|
|
raiseDeprecationError(message, options);
|
|
});
|
|
|
|
registerDiscourseDeprecationHandler((message, options) => {
|
|
if (
|
|
disabled ||
|
|
DEPRECATION_WORKFLOW.find((w) => w.matchId === options?.id)
|
|
) {
|
|
return;
|
|
}
|
|
raiseDeprecationError(message, options);
|
|
});
|
|
}
|
|
|
|
function raiseDeprecationError(message, options) {
|
|
message = `DEPRECATION IN CORE TEST: ${message} (deprecation id: ${options.id})\n\nCore test runs must be deprecation-free. Use ember-deprecation-workflow to silence unresolved deprecations.`;
|
|
if (QUnit.config.current) {
|
|
QUnit.assert.pushResult({
|
|
result: false,
|
|
message,
|
|
});
|
|
}
|
|
throw new Error(message);
|
|
}
|
|
|
|
export function disableRaiseOnDeprecation() {
|
|
disabled = true;
|
|
}
|
|
|
|
export function enableRaiseOnDeprecation() {
|
|
disabled = false;
|
|
}
|