Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work when enabling Embroider's new staticEmberSource option #156

Open
bertdeblock opened this issue Aug 7, 2023 · 5 comments
Open

Comments

@bertdeblock
Copy link

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

@bertdeblock
Copy link
Author

bertdeblock commented Sep 20, 2023

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.

@jrjohnson
Copy link

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

@NullVoxPopuli
Copy link

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

@jrjohnson
Copy link

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

NullVoxPopuli added a commit to universal-ember/reactiveweb that referenced this issue Jan 9, 2024
* Do not allow deprecations to exist

* We don't need deprecation-workflow (the package). See: ember-cli/ember-cli-deprecation-workflow#156

* Fix a deprecation

* Fix deprecations
@elwayman02
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants