Skip to content

GAUD-10267: add transform to fix wca#7219

Open
dlockhart wants to merge 1 commit into
mainfrom
GAUD-10267/fix-wca
Open

GAUD-10267: add transform to fix wca#7219
dlockhart wants to merge 1 commit into
mainfrom
GAUD-10267/fix-wca

Conversation

@dlockhart

@dlockhart dlockhart commented Jul 14, 2026

Copy link
Copy Markdown
Member

When the properties were switched from static getters, the web component analyzer stopped recognizing them as "attributes", which ultimately lead to the Daylight Site losing all the documentation for the properties.

Disclaimer: the script was mostly AI-generated

This introduces a script that:

  • Copies all our components (and mixins) into a temporary directory
  • Switches static properties = { ... }; back to static get properties() { return { ... }; }
  • Runs the web component analyzer
  • Fixes the paths in the custom-elements.json since they'll now have the temp directory in them
  • Deletes the temp directory

Currently this issue only impacts core (Labs and lms-core don't use wca), but if we wanted to reuse this elsewhere we could bundle it as a binary with core.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-7219/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

Comment thread cli/wca.js
let mode = 'code';
let quote;

for (let index = start; index < content.length; index++) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yay, a lexer!

@@ -2,74 +2,72 @@ import { FocusMixin } from '../../mixins/focus/focus-mixin.js';

export const ButtonMixin = superclass => class extends FocusMixin(superclass) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I had previously left these static getters in because our validate-wca.js script was complaining that they were missing descriptions... which should have set off alarms about the issue.

The good news is that we can now switch these to use the non-getter version.

Comment thread cli/wca.js

await runWca(join(temporaryDirectory, '**/*.js'));

await restoreCustomElementsPaths(temporaryDirectory);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've done a side-by-side diff of custom-elements.json from before the static props stuff merged against this. Everything's identical with the exception of a few things now correctly being documented where we were already using static props (like <d2l-page-*> stuff).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Committing custom-elements.json doesn't make sense and will just be too noisy right? The smoke tests in the docs site did their job, and we've been fine up to this point, but also feels easy to miss a problem.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It would be very noisy, and I think we'd need to build an action similar to the translation formatter / vdiff that would PR into your PR with the changes? Otherwise we're relying on devs running build and committing it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That could all live in the docs site instead, rather than committing it here. But yeah, it would probably require a dev review almost every day 😬. Can't decide if that's worth it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So I don't think we can fully move it to the docs site because component-usage-metrics also uses it.

@dlockhart
dlockhart marked this pull request as ready for review July 14, 2026 20:17
@dlockhart
dlockhart requested a review from a team as a code owner July 14, 2026 20:17
@dbatiste

Copy link
Copy Markdown
Contributor

Idk, I feel like the change to the getters just wasn't worth adding this extra complexity.

@dlockhart

dlockhart commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

I feel like the change to the getters just wasn't worth adding this extra complexity

It's not great, but also this uncovered the fact that we'd been using the new getter format in various places and it was broken and we just didn't know yet. Also static get properties = { ... }; is in the Lit documentation as THE recommended way to do this, so I don't think we can reasonably expect ourselves and others to do it some other way?

The issue is more with wca and the fact that it's abandoned and hasn't been updated to work with modern syntaxes, and our reliance on it for the Daylight site.

Comment thread cli/wca.js
if (mode === 'block-comment') {
if (character === '*' && nextCharacter === '/') {
mode = 'code';
index++;

@EdwinACL831 EdwinACL831 Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why here you increment the index and not only do the continue;?
Oh nvm, it is because the next character is the known / which we want to skip I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants