DEV: Update jsconfig, add glint config, add basic check in CI (#28667)

This switches us back to the 'unstable' version of Glint, which is 'Volar' under the covers. While it's still a work-in-progress, it already works much better for us than the 'stable' version of Glint.

The CI check makes sure that we don't re-introduce any ts/glint-incompatible changes in future (e.g. object literal property decorators).
This commit is contained in:
David Taylor 2024-10-29 16:55:31 +00:00 committed by GitHub
parent e5ac69fd65
commit 5cc531ed75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 395 additions and 900 deletions

View File

@ -88,3 +88,7 @@ jobs:
- name: English locale lint (core plugins)
if: ${{ !cancelled() }}
run: bundle exec ruby script/i18n_lint.rb "plugins/**/locales/{client,server}.en.yml"
- name: Glint
if: ${{ !cancelled() }}
run: pnpm glint -p jsconfig.json

View File

@ -33,6 +33,10 @@
"dialog-holder/*": [
"./app/assets/javascripts/dialog-holder/addon/*"
],
"discourse/plugins/automation/*": [
"./plugins/automation/assets/javascripts/*",
"./plugins/automation/test/javascripts/*"
],
"discourse/plugins/chat/*": [
"./plugins/chat/assets/javascripts/*",
"./plugins/chat/test/javascripts/*"
@ -61,10 +65,18 @@
"./plugins/discourse-presence/assets/javascripts/*",
"./plugins/discourse-presence/test/javascripts/*"
],
"discourse/plugins/footnote/*": [
"./plugins/footnote/assets/javascripts/*",
"./plugins/footnote/test/javascripts/*"
],
"discourse/plugins/poll/*": [
"./plugins/poll/assets/javascripts/*",
"./plugins/poll/test/javascripts/*"
],
"discourse/plugins/spoiler-alert/*": [
"./plugins/spoiler-alert/assets/javascripts/*",
"./plugins/spoiler-alert/test/javascripts/*"
],
"discourse/plugins/styleguide/*": [
"./plugins/styleguide/assets/javascripts/*",
"./plugins/styleguide/test/javascripts/*"
@ -81,6 +93,8 @@
"./app/assets/javascripts/float-kit/addon",
"./app/assets/javascripts/truth-helpers/addon",
"./app/assets/javascripts/dialog-holder/addon",
"./plugins/automation/assets/javascripts",
"./plugins/automation/test/javascripts",
"./plugins/chat/assets/javascripts",
"./plugins/chat/test/javascripts",
"./plugins/checklist/assets/javascripts",
@ -95,9 +109,24 @@
"./plugins/discourse-narrative-bot/test/javascripts",
"./plugins/discourse-presence/assets/javascripts",
"./plugins/discourse-presence/test/javascripts",
"./plugins/footnote/assets/javascripts",
"./plugins/footnote/test/javascripts",
"./plugins/poll/assets/javascripts",
"./plugins/poll/test/javascripts",
"./plugins/spoiler-alert/assets/javascripts",
"./plugins/spoiler-alert/test/javascripts",
"./plugins/styleguide/assets/javascripts",
"./plugins/styleguide/test/javascripts"
]
],
"exclude": [
"**/*.hbs",
"app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js",
"app/assets/javascripts/discourse/tests/integration/component-templates-test.gjs",
],
"glint": {
"environment": [
"ember-loose",
"ember-template-imports"
]
}
}

View File

@ -9,10 +9,10 @@
"@discourse/lint-configs": "^1.4.2",
"@discourse/moment-timezone-names-translations": "^1.0.0",
"@fortawesome/fontawesome-free": "6.6.0",
"@glint/core": "^1.5.0",
"@glint/environment-ember-loose": "^1.4.1-unstable.01b8deb",
"@glint/environment-ember-template-imports": "^1.4.1-unstable.01b8deb",
"@glint/template": "^1.4.1-unstable.01b8deb",
"@glint/core": "^1.4.1-unstable.e45fffc",
"@glint/environment-ember-loose": "^1.4.1-unstable.e45fffc",
"@glint/environment-ember-template-imports": "^1.4.1-unstable.e45fffc",
"@glint/template": "^1.4.1-unstable.e45fffc",
"@mixer/parallel-prettier": "^2.0.3",
"@swc/core": "^1.7.40",
"chart.js": "3.5.1",

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,6 @@ CORE_NAMESPACES = {
"discourse/tests/*" => ["app/assets/javascripts/discourse/tests"],
"discourse-common/*" => ["app/assets/javascripts/discourse-common/addon"],
"admin/*" => ["app/assets/javascripts/admin/addon"],
"wizard/*" => ["app/assets/javascripts/wizard/addon"],
"pretty-text/*" => ["app/assets/javascripts/pretty-text/addon"],
"select-kit/*" => ["app/assets/javascripts/select-kit/addon"],
"float-kit/*" => ["app/assets/javascripts/float-kit/addon"],
@ -40,6 +39,14 @@ def write_config(package_dir, extras: {})
},
},
"include" => namespaces.flat_map { |ns, paths| paths.map { |p| relative(package_dir, p) } },
"exclude" => [
"**/*.hbs",
"app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js", # Native class decorators - unsupported by ts/glint
"app/assets/javascripts/discourse/tests/integration/component-templates-test.gjs", # hbs`` tagged templates - https://github.com/typed-ember/glint/issues/705
],
"glint" => {
"environment" => %w[ember-loose ember-template-imports],
},
}
output = <<~JSON