-
Notifications
You must be signed in to change notification settings - Fork 1
Implement full .hbs -> .gjs codemod #8
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
base: main
Are you sure you want to change the base?
Conversation
|
0c1ef12 to
4a3c8d2
Compare
Hardcoded a bunch of thins to make it work with Discourse – the chat plugin to be specific. We have a bunch of custom resolver rules that needs to be ported over to make this work. The overall strategry should be generalizable. We have a bunch of custom resolver logic that needs to be ported over, the average app can probably try to share code with the Embroider resolver – or use the Resolver from `@embroider/core` directly with `.resolver.json`. See discourse/discourse#24260 for how this code was used in context.
4a3c8d2 to
47c0ecf
Compare
| } | ||
|
|
||
| if (converted.length) { | ||
| console.log('Successfully converted %d files:\n', converted.length); |
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.
Love the console stats, definitely something that's missing currently.
|
|
||
| import type { Options } from '../types/index.js'; | ||
|
|
||
| export default function finalize(options: Options): void { |
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 don't think most codemods do this step automatically as everyone tends to have their own setup. But nice to see it worked for your use case 😄
| module: string; | ||
| } | ||
|
|
||
| class Resolver { |
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.
Okay, this is super nice!
I do wonder what it would take to also support third party addon imports. I suppose crawling node_modules would be one way.
|
Nice to see it already covered a bunch of conversions for Discourse! |
This is not so much a PR intended to be merged, but rather just sharing the quick and dirty code I wrote for a specific task, and perhaps the code here can be useful to others as a starting point. (Thanks @IgnaceMaes for getting it started!)
Hardcoded a bunch of things to make it work with Discourse – the chat plugin to be specific.
We have a bunch of custom resolver rules that needs to be ported over to make this work.
The overall strategry should be generalizable. We have a bunch of custom resolver logic that needs to be ported over, the average app can probably try to share code with the Embroider resolver – or use the Resolver from
@embroider/coredirectly with.resolver.json.See discourse/discourse#24260 for how this code was used in context.