Skip to content
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

Introduced Glint to ember-welcome-page #395

Merged
merged 3 commits into from
Dec 20, 2022
Merged

Introduced Glint to ember-welcome-page #395

merged 3 commits into from
Dec 20, 2022

Conversation

ijlee2
Copy link
Contributor

@ijlee2 ijlee2 commented Dec 20, 2022

Description

The last pull request out of a series of PRs that I will make for #387.

I hope that the series of pull requests can show others, introducing v2 addon format, TypeScript, and Glint can be easy when done in small steps. 🧡

Notes

After a new version of ember-welcome-page is released, we may want to update the Glint documentation. Currently, the documentation uses ember-welcome-page as an example to illustrate what an end-user of Glint could do when an addon doesn't provide its template registry.

References

@ijlee2 ijlee2 marked this pull request as ready for review December 20, 2022 12:12
@ijlee2 ijlee2 linked an issue Dec 20, 2022 that may be closed by this pull request

export default interface EmberWelcomePageRegistry {
WelcomePage: typeof WelcomePageComponent;
'welcome-page': typeof WelcomePageComponent;
Copy link
Contributor Author

@ijlee2 ijlee2 Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The welcome-page is needed if we want to allow developers to invoke the component with either of these syntaxes:

{{! With the component helper }}
{{component "welcome-page"}}

{{! Curly-brace syntax }}
{{welcome-page}}

If we want to allow only the angle bracket syntax <WelcomePage />, then we can delete this line.

Comment on lines +3 to +6
"include": [
"src/**/*",
"unpublished-development-types/**/*"
],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-pasted from the TypeScript project that embroider-build/addon-blueprint generates.

Comment on lines +1 to +13
// Add any types here that you need for local development only.
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!

import '@glint/environment-ember-loose';

declare module '@glint/environment-ember-loose/registry' {
// Remove this once entries have been added! 👇
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export default interface Registry {
// Add any registry entries from other addons here that your addon itself uses (in non-strict mode templates)
// See https://typed-ember.gitbook.io/glint/using-glint/ember/using-addons
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-pasted from the TypeScript project that embroider-build/addon-blueprint generates.

Comment on lines +57 to +59
"@glint/core": "^1.0.0-beta.2",
"@glint/environment-ember-loose": "^1.0.0-beta.2",
"@glint/template": "^1.0.0-beta.2",
Copy link
Contributor Author

@ijlee2 ijlee2 Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, a Glint user must install @glimmer/component with version 1.1.2 or higher. Fortunately, the latest version of ember-cli already installs v1.1.2.

The version requirement does not affect non-Glint users.

Copy link
Contributor Author

@ijlee2 ijlee2 Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional notes since we want to support Ember 3.28 LTS: ember-cli@v3.28.6 lists "@glimmer/component": "^1.0.4" in its package.json.

https://github.com/ember-cli/ember-cli/blob/v3.28.6/blueprints/app/files/package.json#L31

@ijlee2 ijlee2 merged commit 774b89c into ember-cli:main Dec 20, 2022
@ijlee2 ijlee2 deleted the PR-08 branch December 20, 2022 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert to TS or supply ambient type definitions
1 participant