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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ember-welcome-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:types": "tsc --noEmit",
"lint:types": "glint",
"prepack": "rollup --config",
"start": "rollup --config --watch",
"test": "echo \"A v2 addon does not have tests, run tests in test-app\""
Expand All @@ -54,6 +54,9 @@
"@babel/plugin-proposal-decorators": "^7.20.5",
"@babel/preset-typescript": "^7.18.6",
"@embroider/addon-dev": "^3.0.0",
"@glint/core": "^1.0.0-beta.2",
"@glint/environment-ember-loose": "^1.0.0-beta.2",
"@glint/template": "^1.0.0-beta.2",
Comment on lines +57 to +59
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

"@tsconfig/ember": "^1.1.0",
"@types/ember__application": "^4.0.5",
"@typescript-eslint/eslint-plugin": "^5.47.0",
Expand Down
5 changes: 4 additions & 1 deletion ember-welcome-page/src/components/welcome-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ function isLatestVersion(): boolean {
return !stableRegex.test(VERSION as string);
}

export default class WelcomePageComponent extends Component {
/* eslint-disable-next-line @typescript-eslint/no-empty-interface */
interface WelcomePageComponentSignature {}

export default class WelcomePageComponent extends Component<WelcomePageComponentSignature> {
get rootURL(): string {
const config = getOwner(this).factoryFor('config:environment');

Expand Down
6 changes: 6 additions & 0 deletions ember-welcome-page/src/template-registry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type WelcomePageComponent from './components/welcome-page';

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.

}
8 changes: 7 additions & 1 deletion ember-welcome-page/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{
"extends": "@tsconfig/ember/tsconfig.json",
"include": ["src/**/*"]
"include": [
"src/**/*",
"unpublished-development-types/**/*"
],
Comment on lines +3 to +6
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.

"glint": {
"environment": "ember-loose"
}
}
13 changes: 13 additions & 0 deletions ember-welcome-page/unpublished-development-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
}
}
Comment on lines +1 to +13
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.

59 changes: 59 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,30 @@
dependencies:
babel-plugin-debug-macros "^0.3.4"

"@glint/core@^1.0.0-beta.2":
version "1.0.0-beta.2"
resolved "https://registry.yarnpkg.com/@glint/core/-/core-1.0.0-beta.2.tgz#68682d4663e2ae3eebfd0682b9f9505e4a33bb6f"
integrity sha512-LmQ7I0BXGzL5FhtaXXUCNUfGnqK6s+WKbcT0VcL3vxfMYW4btCzcWMOrBOhczI1+yYbPdVe++Rb+l0ovWURPzQ==
dependencies:
"@glimmer/syntax" "^0.84.2"
escape-string-regexp "^4.0.0"
silent-error "^1.1.1"
uuid "^8.3.2"
vscode-languageserver "^8.0.1"
vscode-languageserver-textdocument "^1.0.5"
vscode-uri "^3.0.2"
yargs "^17.5.1"

"@glint/environment-ember-loose@^1.0.0-beta.2":
version "1.0.0-beta.2"
resolved "https://registry.yarnpkg.com/@glint/environment-ember-loose/-/environment-ember-loose-1.0.0-beta.2.tgz#a189f7454a8404b5a5062c3bef554cf1043bfeff"
integrity sha512-WIsccams5kKvv8ECXQgrT1iySYYXWa+k5B4+1HFowr51ojkizFYrG5skAjIKX/7+ChuqpSLCAPquEOAp24Zhhw==

"@glint/template@^1.0.0-beta.2":
version "1.0.0-beta.2"
resolved "https://registry.yarnpkg.com/@glint/template/-/template-1.0.0-beta.2.tgz#ed13ca4f0e6c616579d9eb9c6b11eac49899c742"
integrity sha512-gaWiWAjvmgOTmHUqXt+fACINMSnOxKcPYEwb6A6DNYpCaKWxhxqIjIrQLdrumULLK9+MbxMrIa3Od05FcIDQFQ==

"@handlebars/parser@~2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@handlebars/parser/-/parser-2.0.0.tgz#5e8b7298f31ff8f7b260e6b7363c7e9ceed7d9c5"
Expand Down Expand Up @@ -12122,6 +12146,41 @@ vm2@^3.9.8:
acorn "^8.7.0"
acorn-walk "^8.2.0"

vscode-jsonrpc@8.0.2:
version "8.0.2"
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-8.0.2.tgz#f239ed2cd6004021b6550af9fd9d3e47eee3cac9"
integrity sha512-RY7HwI/ydoC1Wwg4gJ3y6LpU9FJRZAUnTYMXthqhFXXu77ErDd/xkREpGuk4MyYkk4a+XDWAMqe0S3KkelYQEQ==

vscode-languageserver-protocol@3.17.2:
version "3.17.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.2.tgz#beaa46aea06ed061576586c5e11368a9afc1d378"
integrity sha512-8kYisQ3z/SQ2kyjlNeQxbkkTNmVFoQCqkmGrzLH6A9ecPlgTbp3wDTnUNqaUxYr4vlAcloxx8zwy7G5WdguYNg==
dependencies:
vscode-jsonrpc "8.0.2"
vscode-languageserver-types "3.17.2"

vscode-languageserver-textdocument@^1.0.5:
version "1.0.8"
resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz#9eae94509cbd945ea44bca8dcfe4bb0c15bb3ac0"
integrity sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==

vscode-languageserver-types@3.17.2:
version "3.17.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.17.2.tgz#b2c2e7de405ad3d73a883e91989b850170ffc4f2"
integrity sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA==

vscode-languageserver@^8.0.1:
version "8.0.2"
resolved "https://registry.yarnpkg.com/vscode-languageserver/-/vscode-languageserver-8.0.2.tgz#cfe2f0996d9dfd40d3854e786b2821604dfec06d"
integrity sha512-bpEt2ggPxKzsAOZlXmCJ50bV7VrxwCS5BI4+egUmure/oI/t4OlFzi/YNtVvY24A2UDOZAgwFGgnZPwqSJubkA==
dependencies:
vscode-languageserver-protocol "3.17.2"

vscode-uri@^3.0.2:
version "3.0.7"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.7.tgz#6d19fef387ee6b46c479e5fb00870e15e58c1eb8"
integrity sha512-eOpPHogvorZRobNqJGhapa0JdwaxpjVvyBp0QIUMRMSf8ZAlqOdEquKuRmw9Qwu0qXtJIWqFtMkmvJjUZmMjVA==

w3c-hr-time@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"
Expand Down