ember-cli / ember-welcome-page

Welcome page for Ember CLI applications
MIT License
12 stars 23 forks source link

Introduced TypeScript to ember-welcome-page #393

Closed ijlee2 closed 1 year ago

ijlee2 commented 1 year ago

Description

In #392, we introduced workspaces to ember-welcome-page. This lets us (any contributor who hasn't had to introduce the v2 addon format before) confidently introduce TypeScript by referring to:

This pull request completes the minimum requirements for #387. However, before we release a new version (a major version release will be needed due to #388), I'd like to make 2-3 additional pull requests to increase test coverage and ease future maintenance.

For review, please check commits 3 and 5, which form the core of the work.

Testing

In addition to checking that CI passes, I ran yarn build locally at the root directory. This command now creates ember-welcome-page/dist/components/welcome-page.d.ts (and the corresponding .d.ts.map file):

import Component from '@glimmer/component';
declare class WelcomePageComponent extends Component {
    get rootURL(): string;
    get urlForEmberGuides(): string;
}
export { WelcomePageComponent as default };
//# sourceMappingURL=components/welcome-page.d.ts.map

Another way to test is to run yarn start at the root directory. When you visit http://localhost:4200, you should be able to see the <WelcomePage> component render without an error.

References

In addition to the TypeScript project that embroider-build/addon-blueprint generates, I looked at what Ember blueprint currently generates for a TypeScript project. The latter helps with maintaining files such as .eslintrc.js.

https://github.com/ember-cli/ember-cli/blob/v4.9.2/blueprints/app/files/.eslintrc.js

ijlee2 commented 1 year ago

I'll go ahead with merging this pull request so that I can open 2 additional ones.

We can review the project as a whole later, then create a pull request to fix bugs and revert changes when needed.