-
Notifications
You must be signed in to change notification settings - Fork 98
refactor: convert addon build code to native class syntax #857
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
refactor: convert addon build code to native class syntax #857
Conversation
| } | ||
|
|
||
| // https://github.com/ember-cli/ember-cli/blob/cf55d3c36118e6a04ace1cf183951f310cfca9cd/lib/cli/lookup-command.js#L18 | ||
| CleanCommend.prototype.name = 'ts:clean'; |
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.
Might wanna use a fancy @proto decorator instead. 😄
|
Thanks for the PR, @buschtoens! So far we've intentionally avoided subclassing entities directly from If IIRC I had a conversation with someone about this a while back (maybe @pzuraq?) — what we'd really need for this to be safe would be a way to ensure that the base class we're importing is actually the one for the running CLI instance. I could imagine hacking a best-effort version of that with something like this: function requireLocal(modulePath) {
try {
return require(resolve.sync(modulePath, { basedir: process.cwd() }));
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
return require(modulePath);
} else {
throw e;
}
}
}
export const Addon = requireLocal('ember-cli/lib/models/addon');There's also Neither option seems super appealing to me, but I imagine community desire for using 'real' syntax for these things is only going to grow (particularly if developing build-time code in TS becomes more common), so maybe there's an approach to solving this upstream. |
|
Thanks for the detailed explanation! That is indeed a problem and very annoying limitation; not unique to
Definitely. I feel uncomfortable writing pure JS by now. Unfortunately, the |
|
I'd add that I at least want to get the heck away from |
|
@buschtoens any chance you can make the suggested tweaks here? |
|
@chriskrycho Happy to do so, I just wasn't sure whether Dropping |
|
We chatted about this, and we still super appreciate the work (three years later 😂) but are going to close it:
Net, we want to minimize further direct investment in ember-cli-typescript internals. Thanks again, @buschtoens! |
As per my message on Discord it seems that native class syntax is actually properly supported by
CoreObjectandember-cli.