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

Reduce bundle size #7246

Merged
merged 14 commits into from
Dec 20, 2023
Merged

Reduce bundle size #7246

merged 14 commits into from
Dec 20, 2023

Conversation

ozyx
Copy link
Contributor

@ozyx ozyx commented Nov 18, 2023

Closes #7286

Describe your changes:

  • Use minified plotly
  • Use ESM imports for the d3 libraries
  • Use ESM imports for printj

Brings unpacked bundle size from 26.3MB - 24.3MB

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Command line build passes?
  • Has this been smoke tested?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?
  • Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
  • Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)

Copy link

deploysentinel bot commented Nov 18, 2023

Current Playwright Test Results Summary

✅ 15 Passing - ⚠️ 1 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 12/20/2023 05:52:15pm UTC)

Run Details

Running Workflow e2e-couchdb on Github Actions

Commit: 0fc7ad4

Started: 12/20/2023 05:48:07pm UTC

⚠️ Flakes

📄   functional/couchdb.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
CouchDB Status Indicator with mocked responses @couchdb Shows red if not connected
Retry 1Initial Attempt
0% (0) 0 / 38 runs
failed over last 7 days
13.16% (5) 5 / 38 runs
flaked over last 7 days

View Detailed Build Results


Current Playwright Test Results Summary

✅ 166 Passing - ⚠️ 2 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 12/20/2023 05:52:15pm UTC)

Run Details

Running Job e2e-stable on CircleCI

Commit: 0fc7ad4

Started: 12/20/2023 05:46:54pm UTC

⚠️ Flakes

📄   functional/plugins/telemetryTable/telemetryTable.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Telemetry Table unpauses and filters data when paused by button and user changes bounds
Retry 2Retry 1Initial Attempt
2.33% (2) 2 / 86 runs
failed over last 7 days
24.42% (21) 21 / 86 runs
flaked over last 7 days

📄   functional/plugins/notebook/restrictedNotebook.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Restricted Notebook with a page locked and with an embed @addinit Disallows embeds to be deleted if page locked @addinit
Retry 1Initial Attempt
2.25% (2) 2 / 89 runs
failed over last 7 days
39.33% (35) 35 / 89 runs
flaked over last 7 days

View Detailed Build Results


Copy link

codecov bot commented Nov 18, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (0d97675) 56.03% compared to head (0fc7ad4) 55.97%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7246      +/-   ##
==========================================
- Coverage   56.03%   55.97%   -0.07%     
==========================================
  Files         658      658              
  Lines       26364    26361       -3     
  Branches     2546     2546              
==========================================
- Hits        14774    14755      -19     
- Misses      10889    10896       +7     
- Partials      701      710       +9     
Flag Coverage Δ
e2e-full 41.67% <ø> (-0.07%) ⬇️
e2e-stable 58.69% <77.77%> (+0.03%) ⬆️
unit 49.04% <75.00%> (-0.12%) ⬇️
Files Coverage Δ
src/plugins/timeConductor/ConductorAxis.vue 25.71% <100.00%> (ø)
src/ui/components/TimeSystemAxis.vue 70.00% <100.00%> (ø)
src/plugins/displayLayout/CustomStringFormatter.js 68.75% <0.00%> (ø)
src/api/telemetry/TelemetryValueFormatter.js 71.18% <82.35%> (-1.40%) ⬇️

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d97675...0fc7ad4. Read the comment docs.

@davetsay
Copy link
Contributor

👍 for issue name and reducing the bundle size

@ozyx ozyx changed the title Honey i shrunk the bundle Minimize bundle size via TerserPlugin Dec 11, 2023
@unlikelyzero unlikelyzero added the type:maintenance tests, chores, or project maintenance label Dec 14, 2023
@ozyx ozyx changed the title Minimize bundle size via TerserPlugin Lessen bundle size Dec 15, 2023
@ozyx ozyx added this to the Target:3.3.0 milestone Dec 15, 2023
@ozyx ozyx marked this pull request as ready for review December 15, 2023 00:10
@scottbell
Copy link
Contributor

@ozyx what's the best way to test this?

@ozyx
Copy link
Contributor Author

ozyx commented Dec 17, 2023

@ozyx what's the best way to test this?

Something like:

  1. Clone a fresh copy of openmct
  2. git checkout master
  3. npm i; npm pack
  4. Move the generated *.tgz archive to another folder (outside of openmct repo)
  5. Repeat the same but on this branch
  6. compare packed / unpacked space
  7. Manual smoke test of basic usage

I thought we could compress even smaller but I think best we can do is a few MB, without removing e2e or source files/maps (which I don't think we want to do). As a whole our package size has been on a downward trend since 1.8 which is good!

@ozyx ozyx changed the title Lessen bundle size Reduce bundle size Dec 19, 2023
Copy link
Contributor

@scottbell scottbell left a comment

Choose a reason for hiding this comment

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

I think changing TelemetryValueFormatter to an es6 class would be cool, but not necessary for this PR.

File size was reduced:

-rw-r--r--@  1 scott  staff   5.4M Dec 19 12:11 openmct-3.3.0-honey.tgz
-rw-r--r--@  1 scott  staff   5.9M Dec 19 12:07 openmct-3.3.0-master.tgz

nice job! Smoke test of functionality went well.

src/api/telemetry/TelemetryValueFormatter.js Outdated Show resolved Hide resolved
@scottbell scottbell added the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 20, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Dec 20, 2023
@ozyx ozyx merged commit 715a448 into master Dec 20, 2023
31 of 39 checks passed
@ozyx ozyx deleted the honey-i-shrunk-the-bundle branch December 20, 2023 19:23
@unlikelyzero unlikelyzero modified the milestones: Target:3.3.0, Target:4.0.0 Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:maintenance tests, chores, or project maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build Open MCT with Terser plugin to reduce library size.
5 participants