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

Fix the template-tag codemod #2091

Conversation

NullVoxPopuli
Copy link
Collaborator

On main

  • it wasn't running
  • it errors when it does run

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Aug 31, 2024
import QUnit from 'qunit';
import { join } from 'path';

const { module: Qmodule, test } = QUnit;

appScenarios
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appScenarios no longer includes release

.only('release')
.map('template-tag-codemod', project => {
project.mergeFiles({
app: {
components: {
'face.hbs': `<h1> this is a gjs file</h1>`,
'daft.hbs': `<button {{on 'click' @onClick}}>click me</button>`,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a file that we'd expect to generate an import

if (ember_template_compiler.type === 'not_found') {
throw 'This will not ever be true';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message was too confident, so I changed it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was correct for the previous version :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if someone always remembered to have ember-source installed.

An error message should at least say what went wrong :p

I've seen many errors logged that the original author thought could never happen.

There are no absolute truths.

(including this statement?)

😉

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember putting that in soley to satisfy TS, there is no case where that will be false and you'd use the template tag codemod.
because a build happens before, you'd never even reach this step if it was the case, but TS is bad to know that. so the statement stands to being always true in the 3.x context

Copy link
Collaborator Author

@NullVoxPopuli NullVoxPopuli Aug 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soley to satisfy TS

TS knows what it's talking about -- because I ran in to this error, and it ended up being a helpful debugging tip. Type errors aren't abount knowing the "current state of your runtime", they help you with migrations, updates, etc -- provide more meaningful information, and give you a chance to provide more context in the failure cases (such as what happened here when I tried to run the codemod in main).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's an argument to be made that the code mod code should never really make it to main, my whole point was to get that to help people on stable and part of the upgrade to main would be run the code mod if you haven't already. so intent stays true to that should never be true

@mansona
Copy link
Member

mansona commented Sep 11, 2024

Closing this since #2101 opted to not include the codemod in main (since it was only ever written to work in main)

@mansona mansona closed this Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants