emberjs / ember-cli-babel

Ember CLI plugin for Babel
MIT License
153 stars 119 forks source link

Clarify how to set `enableTypeScriptTransform` in Ember apps, addons and engines #467

Closed ijlee2 closed 1 year ago

ijlee2 commented 1 year ago

Description

Currently, the README explains how to set enableTypeScriptTransform for Ember apps only.

It wasn't clear to me what to do for Ember addons and engines (to be precise, engines created as an addon). The setup for engines turned out to be tricky, because I wasn't supposed to embed the 'ember-cli-babel' key inside of an options hash (the pattern suggested by apps and addons).

I'd like to update the section Enabling TypeScript Transpilation so that:

ijlee2 commented 1 year ago

@chriskrycho When ember-cli-typescript is installed in a v1 addon, two scripts get added to package.json:

{
  "scripts": {
    "prepack": "ember ts:precompile",
    "postpack": "ember ts:clean"
  }
}

When we use enableTypeScriptTransform and uninstall ember-cli-typescript, is it okay to remove these two scripts (i.e. the addon and its types will be published without an issue)?

If so, I wonder if this is worth mentioning in ember-cli-babel's README. I can also see the perspective that it may fit better in a migration guide in the ember-cli-typescript repo.

chriskrycho commented 1 year ago

Nope, nothing will generate types out of the box for you in that mode. For that reason, addons which want to publish types should generally do one of two things:

Probably worth documenting that explicitly here (feel free to steal that prose and tweak/improve it!).

backspace commented 1 year ago

Thanks for writing this up, it helped me when I was having build problems with an addon. I think it would be great to have merged so it’s easier to find 😀

ijlee2 commented 1 year ago

@bertdeblock Could we merge this pull request some time soon? (I forget where we had left off, if there had been additional feedback that I needed to address.)