Convert Template function to class#2148
Conversation
tlylt
left a comment
There was a problem hiding this comment.
Interesting changes proposed!
Curious if there are opportunities here to improve the code further. For example, I wonder whether template.js really needs to be in this folder, or perhaps it is more suited in the Site folder. What do you think?
On one hand, I think keeping But on the other hand, I also see the benefit in moving it over to the Yes, I think moving it over may make more sense than keeping it where it currently is. |
|
Update in 931271a:
As the template files reside in another directory outside |
tlylt
left a comment
There was a problem hiding this comment.
I am wondering if it would be a good idea to additionally move all the template files into the
packages/core/src/Sitefolder to make it more direct, or if it would make more sense to keep the template in a separate folder as is currently being done. I would appreciate thoughts on this matter as I am uncertain if this makes sense 👍
I think leaving them there is fine, because of how they are used and also that in the future, that folder can potentially grow further in the event that we increase the number of templates supported.
As for the shift of template.js I was wondering if that causes any cyclic dependency, which doesn't seem to be the case so we should be good.
Lastly, I don't like how we have a "pass-through" method initSite that simply calls new Template().init, which feels like a red flag in the class design. Might need further refactoring in the future.
LGTM.
What is the purpose of this pull request?
Overview of changes:
Resolves #2147.
Converts the
Templatefunction insidepackages/core/template/template.jsinto a class.This also simplifies the migration process for
template.jsinto TypeScript in #2143.Anything you'd like to highlight/discuss:
Testing instructions:
Proposed commit message: (wrap lines at 72 characters)
Convert Template function to class
Checklist: ☑️