Skip to content

feat(legacy-html): don't minify assets, add assets to c8 exclude #323

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

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

avivkeller
Copy link
Member

@avivkeller avivkeller commented Jun 26, 2025

By not having terser minifyCSS or minifyJS, we save ~7 seconds on generation. See also #320. After this, Shiki is the hottest code path, followed by parseApiDoc.


Also, while I'm changing the assets, I've added them to the coverage exclude, since we aren't planning to test them, they are browser-based. This PR crosses the coverage threshold of 70%, so that was also changed.

@Copilot Copilot AI review requested due to automatic review settings June 26, 2025 00:06
@avivkeller avivkeller requested a review from a team as a code owner June 26, 2025 00:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the legacy HTML generator to improve performance by moving inline CSS/JS into external files and by simplifying the HTML minification process.

  • Removed inline dark-mode CSS from the HTML template and moved it to an external stylesheet.
  • Removed JS/CSS minification options in favor of simpler HTML minification in both legacy-html generators.
  • Refactored assets/api.js to modernize functions with arrow syntax and improve event handling, and updated ESLint config for newer ECMAScript features.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/generators/legacy-html/template.html Removed inline style block for dark mode styling
src/generators/legacy-html/index.mjs Removed JS/CSS minification options to speed up HTML generation
src/generators/legacy-html/assets/style.css Added dark-mode CSS styling rules to external stylesheet
src/generators/legacy-html/assets/api.js Refactored functions with modern syntax and improved event handling
src/generators/legacy-html-all/index.mjs Removed JS/CSS minification options for the combined legacy HTML generation
eslint.config.mjs Updated ESLint configuration to use the latest ECMAScript version
Comments suppressed due to low confidence (1)

eslint.config.mjs:79

  • [nitpick] Consider adding a note in the project documentation about the required ECMAScript/Node version to support 'latest' language features configured here.
    languageOptions: { globals: { ...globals.browser }, ecmaVersion: 'latest' },

Copy link

codecov bot commented Jun 26, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 71.25%. Comparing base (e44f080) to head (78214e3).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/generators/legacy-html/index.mjs 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #323      +/-   ##
==========================================
+ Coverage   66.57%   71.25%   +4.67%     
==========================================
  Files          81      117      +36     
  Lines        6956     9650    +2694     
  Branches      339      585     +246     
==========================================
+ Hits         4631     6876    +2245     
- Misses       2322     2771     +449     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

What if we use esbuild to minify ?

@avivkeller
Copy link
Member Author

I don't think ESBuild minifies HtML

@AugustinMauroy
Copy link
Member

Hum sad 😔

@avivkeller avivkeller changed the title feat(perf): put css/js in external files for legacy-html feat(legacy-html): don't minify assets, add assets to c8 exclude Jun 26, 2025
Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

Sugar

@avivkeller avivkeller merged commit 385f0c3 into main Jun 27, 2025
9 of 10 checks passed
@avivkeller avivkeller deleted the perf/minify-speed branch June 27, 2025 18:10
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