ember-cli-deprecation-workflow icon indicating copy to clipboard operation
ember-cli-deprecation-workflow copied to clipboard

Doesn't work when enabling Embroider's new `staticEmberSource` option

Open bertdeblock opened this issue 1 year ago • 4 comments

The inline if on this LOC evaluates to false, after which an error is thrown, because the Ember global is no longer available.

bertdeblock avatar Aug 07 '23 12:08 bertdeblock

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.

bertdeblock avatar Sep 20 '23 08:09 bertdeblock

THANK YOU @bertdeblock, I was exploring something with an initializer, but this is a way more complete solution.

jrjohnson avatar Sep 20 '23 16:09 jrjohnson

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

NullVoxPopuli avatar Jan 09 '24 19:01 NullVoxPopuli

That makes a lot of sense to me @NullVoxPopuli. I can't imagine using an ember app without this functionality.

jrjohnson avatar Jan 09 '24 19:01 jrjohnson

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.

elwayman02 avatar Apr 29 '24 19:04 elwayman02

This has been fixed in https://github.com/ember-cli/ember-cli-deprecation-workflow/releases/tag/v3.0.0-ember-cli-deprecation-workflow 🎉

mansona avatar Jul 11 '24 09:07 mansona