ember-cli / ember-cli-deprecation-workflow

MIT License
165 stars 43 forks source link

flushDeprecations output no longer formatted #103

Open elwayman02 opened 3 years ago

elwayman02 commented 3 years ago

The output of flushDeprecations() no longer formats in a way that can be copied and pasted into the config file. We now get the raw string, which indicates this is likely a behavior change in Chrome DevTools/console.

Example:

"self.deprecationWorkflow = self.deprecationWorkflow || {};\nself.deprecationWorkflow.config = {\n  workflow: [\n    { handler: \"silence\", matchId: \"this-property-fallback\" },\n    { handler: \"silence\", matchId: \"manager-capabilities.modifiers-3-13\" }\n  ]\n};"

DevTools_-_localhost_4200_components_navigation-list_

kategengler commented 3 years ago

Switching to a console.log here restores formatting in Chrome.

As a workaround, in the console:

console.log(deprecationWorkflow.flushDeprecations())
elwayman02 commented 3 years ago

@mixonic is this an acceptable fix?

mixonic commented 3 years ago

@elwayman02 is a fix needed? flushDeprecations is supposed to give you a string of new contents for the deprecation config file. From your screenshot it seems like it is still doing that.

You can console.log( to print the string with formatting, or even copy(deprecationWorkflow.flushDeprecations()) to get the string into your OS pastebuffer.

elwayman02 commented 3 years ago

Well, prior to recent changes in behavior at the browser level, it printed with the correct formatting automatically. I always felt that one of the benefits of how this addon worked was that you could copy-paste the output of flushDeprecations into the file as part of onboarding. As someone who has had to update deprecations for ~50 addons over the last 2 months, I can say that it's a lot more time-consuming now, and while wrapping in console.log is an ok short-term workaround, I don't think it's an ideal developer experience to essentially force users of this addon to know that workaround instead of just having the output be formatted correctly when they call the documented method.