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

[OSCI][CLEAN] Audit unused dependencies in OUI #1135

Merged
merged 23 commits into from
Jan 18, 2024

Conversation

BigSamu
Copy link
Contributor

@BigSamu BigSamu commented Nov 1, 2023

Description

Research was done to clean dependencies not used in OUI. Review finished with actions detailed below, but further work has to be done after resolving issue #594

Actions Performed

  1. Following runtime dependencies or devDependencies were removed:
"@types/resize-observer-browser": "^0.1.7",
"rehype-raw": "^5.0.0",
"rehype-stringify": "^8.0.0"
"moment-timezone": "^0.5.41",
"eslint-plugin-jest": "^24.1.0",
  1. Following dependencies below were found deprecated and issue [OSCI] Plugin Babel Dependencies Deprecated (Proposal-Class-Properties and Proposal-Object-Rest-Spread) #1130 was created to address this.
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
  1. Following dependencies below, were reclassified as devDependencies instead of runtime dependencies
"@types/chroma-js": "^2.4.0",
"@types/lodash": "4.14.192",
"@types/numeral": "^2.0.2",
"@types/react-beautiful-dnd": "^13.1.3",
"@types/react-input-autosize": "^2.2.1",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/refractor": "^3.0.0",

Issues Resolved

Issue #595

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • All tests pass
    • yarn lint
    • yarn test-unit
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@BigSamu BigSamu changed the title [CLEAN] Audit unused dependencies in OUI [OSCI][CLEAN] Audit unused dependencies in OUI Nov 1, 2023
Copy link
Contributor

@BSFishy BSFishy left a comment

Choose a reason for hiding this comment

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

I want to hold off on approving this until we have integration testing with OSD, just to be as safe as possible

CHANGELOG.md Outdated Show resolved Hide resolved
@BSFishy BSFishy added the OSCI label Nov 2, 2023
Copy link
Contributor

@JohnathonBowers JohnathonBowers left a comment

Choose a reason for hiding this comment

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

I checked out this PR on my local machine. I was able to get the OUI site to run without issue. Also, I ran yarn build, yarn build-docs, and yarn test, and everything ran successfully. The suggested changes look good to me, although I know that, as @BSFishy said, we still need to wait for the integration tests to be functional.

Co-authored-by: Matt Provost <[email protected]>
Signed-off-by: Samuel Valdes Gutierrez <[email protected]>
@BigSamu
Copy link
Contributor Author

BigSamu commented Nov 4, 2023

I want to hold off on approving this until we have integration testing with OSD, just to be as safe as possible

Yeah, sure @BSFishy. Make sense!

@willie-hung
Copy link
Contributor

I want to hold off on approving this until we have integration testing with OSD, just to be as safe as possible

Yeah I agree!

@BigSamu
Copy link
Contributor Author

BigSamu commented Jan 1, 2024

Hi @BSFishy, @joshuarrrr

Can we retake this Pull Request? What else is required for the merge? I recently updated it to align with the main branch.

@BSFishy
Copy link
Contributor

BSFishy commented Jan 2, 2024

Can we retake this Pull Request? What else is required for the merge? I recently updated it to align with the main branch.

It looks like integration with OSD is failing: https://github.com/opensearch-project/oui/actions/runs/7378461865/job/20073761573?pr=1135#step:9:207

We would want to fix that before merging.

@BigSamu
Copy link
Contributor Author

BigSamu commented Jan 2, 2024

Can we retake this Pull Request? What else is required for the merge? I recently updated it to align with the main branch.

It looks like integration with OSD is failing: https://github.com/opensearch-project/oui/actions/runs/7378461865/job/20073761573?pr=1135#step:9:207

We would want to fix that before merging.

Yeah, I saw that. But is this failure related to something other than our PR? I understand those checks with integration tests to OSD were an issue on your side, didn't it?

… upgraded in this PR

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>
@BigSamu
Copy link
Contributor Author

BigSamu commented Jan 3, 2024

Can we retake this Pull Request? What else is required for the merge? I recently updated it to align with the main branch.

It looks like integration with OSD is failing: https://github.com/opensearch-project/oui/actions/runs/7378461865/job/20073761573?pr=1135#step:9:207
We would want to fix that before merging.

Yeah, I saw that. But is this failure related to something other than our PR? I understand those checks with integration tests to OSD were an issue on your side, didn't it?

@BSFishy,

At last, I found the problem. The typescript dependencies listed below through an error in the OSD integration tests when they are installed as devDependenceis

"@types/chroma-js": "^2.4.0",
"@types/react-beautiful-dnd": "^13.1.3",
"@types/react-input-autosize": "^2.2.1",
"@types/react-window": "^1.8.5",

This is weird. Should not these dependencies only be used in development? Why are they required on runtime? Maybe there is a problem with the build process during the OSD integration tests.

@BSFishy
Copy link
Contributor

BSFishy commented Jan 4, 2024

This is weird. Should not these dependencies only be used in development? Why are they required on runtime? Maybe there is a problem with the build process during the OSD integration tests.

Yeah this is super weird to me too. I know OSD has some non-standard bootstrap procedures which may be causing these issues. I think @AMoo-Miki might have some more insights into how OSD bootstrap works and why this may be an issue

@BigSamu
Copy link
Contributor Author

BigSamu commented Jan 4, 2024

This is weird. Should not these dependencies only be used in development? Why are they required on runtime? Maybe there is a problem with the build process during the OSD integration tests.

Yeah this is super weird to me too. I know OSD has some non-standard bootstrap procedures which may be causing these issues. I think @AMoo-Miki might have some more insights into how OSD bootstrap works and why this may be an issue

So, as you said, @BSFishy, @AMoo-Miki reply to this inquiry in our internal chats. I added his response below to update everyone. So I think we are good to go now, or not?

From Miki:

"OSD and plugins don’t ONLY use OUI’s disted artifacts and hence, OSD type-checks OUI during build. If OUI doesn’t have its own deps installed when placed in OSD, the type-check and build will fail. So, either OUI will have to redist those types in its own d-ts, or it has to rely on the defs it finds. They chose to use the defs it finds and to avoid conflicts with any types that OSD might have, they just added these as regular deps"

Copy link
Contributor

@BSFishy BSFishy left a comment

Choose a reason for hiding this comment

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

It may be possible to move these @types/ dependencies into dev dependencies, but this PR fulfills its goals.

If I'm not mistaken, the issue is that OUI exposes types from these dependencies in its own public API. This means that OSD will need to be able to reference these types as well. So if we're able to trick Typescript into inlining these types in the .d.ts file, we could presumably get rid of these dependencies. This could be taken up in a followup issue

package.json Outdated
@@ -212,7 +209,6 @@
"jest": "^24.1.0",
"jest-cli": "^24.1.0",
"moment": "^2.29.4",
"moment-timezone": "^0.5.41",
Copy link
Collaborator

Choose a reason for hiding this comment

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

moment-timezone enriches moment and needs to stay.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AMoo-Miki dependency added back!

Copy link
Member

Choose a reason for hiding this comment

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

I'd keep the ^ that was there before

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

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

It looks like this branch has some of the flex related changes from another PR.

package.json Outdated
@@ -212,7 +209,6 @@
"jest": "^24.1.0",
"jest-cli": "^24.1.0",
"moment": "^2.29.4",
"moment-timezone": "^0.5.41",
Copy link
Member

Choose a reason for hiding this comment

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

I'd keep the ^ that was there before

Copy link
Member

Choose a reason for hiding this comment

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

@BigSamu It looks like this PR branch got mixed up with the flex changes from another branch. This PR should just have 3 files, right (package.json, yarn.lock, and CHANGELOG.md)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ouuuu, you're right!!! My god. Just fixed! Thanks for the heads up @joshuarrrr

@BigSamu BigSamu force-pushed the clean/unused-packages branch 2 times, most recently from fcc6fa9 to 7c08704 Compare January 13, 2024 13:23
@BigSamu BigSamu requested a review from joshuarrrr January 13, 2024 15:11
@joshuarrrr joshuarrrr merged commit 335ca98 into opensearch-project:main Jan 18, 2024
15 checks passed
@BigSamu BigSamu deleted the clean/unused-packages branch January 18, 2024 18:04
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 8, 2024
* removing/reassigning unused/wrong-classified runtime dependencies

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* Remove moment-timezone dependency

Signed-off-by: Johnathon Bowers <[email protected]>

* Remove dependency: eslint-plugin-jest

Signed-off-by: Willie Hung <[email protected]>

* updating CHANELOG.md with PR 1135

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* Update CHANGELOG.md typo

Co-authored-by: Matt Provost <[email protected]>
Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* updating yarn.lock with last changes coming from main (other updates in oui)

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* udpating yarn.lock file

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* downgrading @types/react-window v1.8.7 to v1.8.5

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* downgrade version of some typescript dependencies that shouldn't been upgraded in this PR

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* adding dev dependency moment-timezone adn update yarn.lock file

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

* moving dev dependencies to running dependencies

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>

---------

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>
Signed-off-by: Johnathon Bowers <[email protected]>
Signed-off-by: Willie Hung <[email protected]>
Co-authored-by: Johnathon Bowers <[email protected]>
Co-authored-by: Willie Hung <[email protected]>
Co-authored-by: Matt Provost <[email protected]>
Co-authored-by: Josh Romero <[email protected]>
(cherry picked from commit 335ca98)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AMoo-Miki added a commit that referenced this pull request Jul 12, 2024
* removing/reassigning unused/wrong-classified runtime dependencies



* Remove moment-timezone dependency



* Remove dependency: eslint-plugin-jest



* updating CHANELOG.md with PR 1135



* Update CHANGELOG.md typo




* updating yarn.lock with last changes coming from main (other updates in oui)



* udpating yarn.lock file



* downgrading @types/react-window v1.8.7 to v1.8.5



* downgrade version of some typescript dependencies that shouldn't been upgraded in this PR



* adding dev dependency moment-timezone adn update yarn.lock file



* moving dev dependencies to running dependencies



---------








(cherry picked from commit 335ca98)

Signed-off-by: Samuel Valdes Gutierrez <[email protected]>
Signed-off-by: Johnathon Bowers <[email protected]>
Signed-off-by: Willie Hung <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Johnathon Bowers <[email protected]>
Co-authored-by: Willie Hung <[email protected]>
Co-authored-by: Matt Provost <[email protected]>
Co-authored-by: Josh Romero <[email protected]>
Co-authored-by: Miki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants