ember-cli-deprecation-workflow
ember-cli-deprecation-workflow copied to clipboard
Doesn't work when enabling Embroider's new `staticEmberSource` option
The inline if on this LOC evaluates to false, after which an error is thrown, because the Ember
global is no longer available.
At the moment, we ditched ember-cli-deprecation-workflow
in favour of a custom / smaller / more vanilla setup:
// app/app.js
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';
if (macroCondition(isDevelopingApp())) {
importSync('module-prefix/deprecation-workflow');
}
// app/deprecation-workflow.js
import { registerDeprecationHandler } from '@ember/debug';
import config from 'module-prefix/config/environment';
const SHOULD_THROW = config.environment !== 'production';
const SILENCED_DEPRECATIONS = [
// Add ids of deprecations you temporarily want to silence here.
];
registerDeprecationHandler((message, options, next) => {
if (SILENCED_DEPRECATIONS.includes(options.id)) {
return;
} else if (SHOULD_THROW) {
throw new Error(message);
}
next(message, options);
});
I think this is a direction ember-cli-deprecation-workflow
could go in as well.
THANK YOU @bertdeblock, I was exploring something with an initializer, but this is a way more complete solution.
favour of a custom / smaller / more vanilla setup:
should we make this default in ember and not bother with another dep? it's so few lines
That makes a lot of sense to me @NullVoxPopuli. I can't imagine using an ember app without this functionality.
It would be great to get a release of ember-cli-deprecation-workflow that supports this, as a short-term bridge to @NullVoxPopuli's suggestion of supporting it more formally in Ember.
This has been fixed in https://github.com/ember-cli/ember-cli-deprecation-workflow/releases/tag/v3.0.0-ember-cli-deprecation-workflow 🎉