-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[FEATURE] Add template tag component blueprints via --strict flag as per RFC #779 #20511
base: main
Are you sure you want to change the base?
Conversation
very excited for this! |
@IgnaceMaes What is the status here? |
@kategengler This should be good to go, functionality wise. But I could use some guidance on how to move this ahead. This MR depended on ember-cli/ember-cli#10332 which got merged and released in |
0081fc9
to
5d1c505
Compare
Does it work without the |
blueprints-js/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.gjs
Outdated
Show resolved
Hide resolved
it('component-test x-foo --strict', function () { | ||
return emberGenerateDestroy(['component-test', 'x-foo', '--strict'], (_file) => { | ||
expect(_file('tests/integration/components/x-foo-test.gjs')).to.equal( | ||
fixture('component-test/rfc232.gjs') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails when running the TypeScript blueprint tests:
1) Blueprint: component-test
in app
with default setup
component-test x-foo --strict:
AssertionError: expected "tests/integration/components/x-foo-test.gjs" to exist
parent path "tests/integration/components" exists and contains:
- x-foo-test.gts
at /.../ember.js/node-tests/blueprints/component-test-test.js:44:75
at /.../ember.js/node_modules/.pnpm/[email protected]/node_modules/ember-cli-blueprint-test-helpers/lib/ember-generate-destroy.js:34:17
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
I'm not sure what the next step is here. The other tests don't check on TypeScript-specific files. Is the expect assumed to automatically work for TS too, but it doesn't here?
Welcoming any input 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validating the path dynamically would work:
const filePath = fs.existsSync('tests/integration/components/x-foo-test.gts')
? 'tests/integration/components/x-foo-test.gts'
: 'tests/integration/components/x-foo-test.gjs';
But that seems like logic which shouldn't be in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're getting TypeScript output when the TypeScript blueprints should be converted to JS by the blueprint system (unless it is a typescript project).
I believe this https://github.com/ember-polyfills/ember-cli-typescript-blueprint-polyfill/blob/main/src/utils.js#L13-L15 needs to include gts, but there may be other changes needed for the blueprint system to convert gts to gjs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @IgnaceMaes on ^
I'd love for this to land in 5.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try to find some time to push this over the finish line as well 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be much appreciated. Realistically, I won't have time to look into this in the near future :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that was confusing.. 😄
I updated the polyfill and used the branch here, but that still didn't work because the polyfill disables itself if it thinks it's no longer needed. It seems we are depending on ember-cli 4.10 which does support .ts -> .js in the blueprints, but not .gts -> .gjs (which was released in 5.5 I think). Once I bump the version to 5.12 the test no longer seems to fail.
What was extra confusing is that there are no tests that verify the .ts version of the blueprints: #20362
It does! So I suppose this is fine then. |
<template> | ||
{{yield}} | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can TO types already: https://typed-ember.gitbook.io/glint/environments/ember/template-only-components
In Octane the component-class defaults to Since this is a new flag, and the RFC doesn't specify it, would it make sense to generate a class based .gts file by default, and a TO version if the In any case, even if we stick with the "TO" by default, we should probably still generate a class based version if a class is provided (and throw an error if it's not glimmer)? |
I think we can do: <template>
...
</template> satisfies TOC<...> |
Linting for gjs/gts has landed in ember-cli |
Implements step one of the blueprint work as per RFC #779
Allows e.g.:
Prior syntax is still enabled by default, or by passing the loose flag: