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

feat: remove ember-prism in favour of ember-shiki #112

Merged
merged 15 commits into from
Sep 1, 2023

Conversation

IgnaceMaes
Copy link
Member

No description provided.

Copy link
Member

@ijlee2 ijlee2 left a comment

Choose a reason for hiding this comment

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

The failing test can be fixed by ignoring the rule (a false positive imo, one that happens easily):

await a11yAudit({
  rules: {
    'scrollable-region-focusable': {
      enabled: false,
    },
  },
});

package.json Outdated Show resolved Hide resolved
@IgnaceMaes
Copy link
Member Author

[critical]: Buttons must have discernible text

Should be fixed in ember-shiki itself I presume. It would be good to set up an automated a11y test like here.

@ijlee2
Copy link
Member

ijlee2 commented Aug 28, 2023

@IgnaceMaes I wasn't able to run the app locally. Could you check what happened?

App is being served by FastBoot
ReferenceError: fetch is not defined
    at buildSandboxGlobals (/ember-octane-vs-classic-cheat-sheet/config/fastboot.js:7:16)
    at EmberApp.buildSandbox (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:120:19)
    at EmberApp.buildApp (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:152:24)
    at /ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:139:22
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async EmberApp.getNewApplicationInstance (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:209:17)
    at async EmberApp._visit (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:240:9)
    at async EmberApp.visit (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:325:7)
    at async FastBoot.visit (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/index.js:86:18)
    at async /ember-octane-vs-classic-cheat-sheet/node_modules/fastboot-express-middleware/src/index.js:33:20

Is FastBoot somehow a dependency of ember-shiki? If the setup for local development needs to be updated somehow, I'd ask that you document the changes in the README or CONTRIBUTING.

@IgnaceMaes
Copy link
Member Author

@IgnaceMaes I wasn't able to run the app locally. Could you check what happened?

App is being served by FastBoot
ReferenceError: fetch is not defined
    at buildSandboxGlobals (/ember-octane-vs-classic-cheat-sheet/config/fastboot.js:7:16)
    at EmberApp.buildSandbox (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:120:19)
    at EmberApp.buildApp (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:152:24)
    at /ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:139:22
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async EmberApp.getNewApplicationInstance (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:209:17)
    at async EmberApp._visit (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:240:9)
    at async EmberApp.visit (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/ember-app.js:325:7)
    at async FastBoot.visit (/ember-octane-vs-classic-cheat-sheet/node_modules/fastboot/src/index.js:86:18)
    at async /ember-octane-vs-classic-cheat-sheet/node_modules/fastboot-express-middleware/src/index.js:33:20
Is FastBoot somehow a dependency of `ember-shiki`? If the setup for local development needs to be updated somehow, I'd ask that you document the changes in the `README` or `CONTRIBUTING`.

It's because the fastboot implementation uses fetch, but fetch was only introduced as a global in Node 18. (ref)

I've reverted to Node 16 and installed node-fetch as an alternative to not have to bump those requirements for now.

@IgnaceMaes IgnaceMaes changed the title feat: use ember-shiki in favour of ember-prism feat: remove ember-prism in favour of ember-shiki Aug 28, 2023
ijlee2
ijlee2 previously approved these changes Aug 28, 2023
Copy link
Member

@ijlee2 ijlee2 left a comment

Choose a reason for hiding this comment

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

Sweet!

@jenweber
Copy link
Collaborator

Thank you! Here's a followup issue for tracking implementing the TS examples for the user experience: #113

Copy link
Collaborator

@jenweber jenweber left a comment

Choose a reason for hiding this comment

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

I like this step towards showing TS examples! I found one blocking issue. Can we try using a different color scheme? Previously, this app had 100% Lighthouse accessibility score, but there are 2 issues:

  • copy button lacks an accessible name. Do we have a way to fix that button name, maybe upstream?
  • the color contrast for this theme is too low, looks like specifically the light blue is a problem. Is there another theme we can use that will pass? Or maybe drop the syntax highlighting by file type in cases where the light blue shows up (like cli commands)

This brings the score down to 87%. Across our apps, we strive for meeting AA level accessibility criteria.

To re-run these tests, go to Chrome developer tools, choose "Lighthouse" and select the Accessibility option. Then click "Analyze page load." Sorry this isn't represented in CI tests! Let me know if you need any help.

Screenshot 2023-08-28 at 11 56 53 AM

@IgnaceMaes
Copy link
Member Author

Thanks for the review @jenweber.

  1. The button label has been added upstream in ember-shiki. Also set up a11y-testing to make sure it stays compliant 😄
  2. Switched to dark-plus theme (the VS Code default) which meets AA accessibility. I'm personally less of a fan of it on the web, but hey if it meets the a11y requirements it does the job!

I haven't checked support of other themes so if anyone wants to try a different one, please go ahead!

image

@IgnaceMaes IgnaceMaes requested a review from jenweber August 28, 2023 18:58
Copy link
Collaborator

@jenweber jenweber left a comment

Choose a reason for hiding this comment

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

Awesome, thank you for the a11y fixes!

@jenweber jenweber merged commit 9f04032 into ember-learn:main Sep 1, 2023
3 checks passed
@ijlee2
Copy link
Member

ijlee2 commented Sep 1, 2023

@IgnaceMaes @jenweber The deployment of the app seems to have failed because fetch is missing. I'm not sure if switching to npm in #114 would help. Could you take a look at it some time?

https://github.com/ember-learn/ember-octane-vs-classic-cheat-sheet/actions/runs/6050042815/job/16418543130

@jenweber
Copy link
Collaborator

jenweber commented Sep 1, 2023

Oops, taking a look.

@IgnaceMaes
Copy link
Member Author

Found the issue. It's because Prember only started loading the fastboot.js config since v2: https://github.com/ef4/prember/releases/tag/v2.0.0.

I'll open a PR to upgrade the dependency in a sec.

@jenweber
Copy link
Collaborator

jenweber commented Sep 1, 2023

Edit - as I was typing, @IgnaceMaes opened a PR! Thank you!

Just in case it's still useful somehow...

I'm a little surprised to see this error, since both ember-fetch and node-fetch are present.

Debugging:

  • npx ember build production does not surface this issue locally.
  • I can see in the CI deploy logs that we are using node 16
  • While running this app locally on node 16, I do not see any issues
  • I think updating npm is unlikely to help, but going to node 18 could

@jenweber
Copy link
Collaborator

jenweber commented Sep 1, 2023

After merging #115 the deploy succeeded. Thanks again @IgnaceMaes

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.

3 participants