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

Updated vite and removed CRA files #2278

Merged
merged 3 commits into from
Sep 23, 2024

Conversation

adithyanotfound
Copy link

@adithyanotfound adithyanotfound commented Sep 18, 2024

Issue Number:

Follow up PR for PR #2268

Did you add tests for your changes?

Not required

If relevant, did you update the documentation?

Not required

Summary

  1. Updated Vite to latest version
  2. Deleted CRA files which were no longer required

Does this PR introduce a breaking change?

No.

Have you read the contributing guide?

Yes

Summary by CodeRabbit

  • New Features

    • Enhanced testing setup with new SVG file mocking in Jest.
    • Introduced a mock file for testing SVG imports.
  • Updates

    • Upgraded key dependencies including Vite and TypeScript JSX support.
    • Updated SVG handling in various components for improved import efficiency.
  • Bug Fixes

    • Improved compatibility and performance in SVG rendering across multiple components.
  • Chores

    • Removed outdated custom build and start scripts to streamline the build process.
    • Deleted unnecessary configuration files to simplify project structure.

Copy link

coderabbitai bot commented Sep 18, 2024

Walkthrough

The pull request introduces several changes primarily focused on improving the handling of SVG files within a React application. It updates the Jest configuration to mock SVG imports, modifies how SVGs are imported across multiple components, and upgrades various dependencies in the package.json file. Additionally, it removes several custom build and configuration scripts that were previously used for managing the build process.

Changes

File(s) Change Summary
jest.config.js Added mappings for SVG files to use a mock file during testing.
package.json Updated versions of vite, tsx, and vite-plugin-svgr to their latest versions.
scripts/__mocks__/fileMock.js Introduced a new mock file that exports a placeholder string for file imports.
scripts/config-overrides/* Removed several custom build and start scripts that managed the application’s build process.
src/components/* Changed SVG imports from using ReactComponent syntax to a new method with a query parameter.
src/screens/* Updated SVG imports similarly to the components, changing the import syntax for several icons.

Possibly related PRs

Suggested labels

no-pr-activity

🐇 In the land of code, where changes bloom,
SVGs now dance, dispelling the gloom.
With mocks in place, and imports refined,
A cleaner path for our icons we find.
Dependencies updated, the build scripts are gone,
A brighter future for our app to spawn! 🌟


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ff70b67 and e454061.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (1)
  • package.json (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • package.json

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.54%. Comparing base (c79aadc) to head (e454061).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2278   +/-   ##
========================================
  Coverage    97.54%   97.54%           
========================================
  Files          241      241           
  Lines         6887     6887           
  Branches      2005     2016   +11     
========================================
  Hits          6718     6718           
  Misses         157      157           
  Partials        12       12           

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 01ef5c6 and ccaec59.

Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (21)
  • jest.config.js (1 hunks)
  • package.json (2 hunks)
  • scripts/mocks/fileMock.js (1 hunks)
  • scripts/config-overrides/custom_build.js (0 hunks)
  • scripts/config-overrides/custom_start.js (0 hunks)
  • scripts/config-overrides/index.js (0 hunks)
  • scripts/config-overrides/package.json (0 hunks)
  • scripts/test.js (0 hunks)
  • src/components/IconComponent/IconComponent.tsx (1 hunks)
  • src/components/LeftDrawer/LeftDrawer.tsx (1 hunks)
  • src/components/LeftDrawerOrg/LeftDrawerOrg.tsx (1 hunks)
  • src/components/OrgListCard/OrgListCard.tsx (1 hunks)
  • src/components/OrganizationDashCards/CardItem.tsx (1 hunks)
  • src/components/UserPortal/UserSidebar/UserSidebar.tsx (1 hunks)
  • src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.tsx (1 hunks)
  • src/components/Venues/VenueCard.tsx (1 hunks)
  • src/screens/EventManagement/EventManagement.tsx (1 hunks)
  • src/screens/ForgotPassword/ForgotPassword.tsx (1 hunks)
  • src/screens/LoginPage/LoginPage.tsx (1 hunks)
  • src/screens/OrganizationDashboard/OrganizationDashboard.tsx (1 hunks)
  • src/screens/UserPortal/Chat/Chat.tsx (1 hunks)
Files not reviewed due to no reviewable changes (5)
  • scripts/config-overrides/custom_build.js
  • scripts/config-overrides/custom_start.js
  • scripts/config-overrides/index.js
  • scripts/config-overrides/package.json
  • scripts/test.js
Files skipped from review due to trivial changes (6)
  • scripts/mocks/fileMock.js
  • src/components/LeftDrawerOrg/LeftDrawerOrg.tsx
  • src/screens/EventManagement/EventManagement.tsx
  • src/screens/ForgotPassword/ForgotPassword.tsx
  • src/screens/LoginPage/LoginPage.tsx
  • src/screens/OrganizationDashboard/OrganizationDashboard.tsx
Additional comments not posted (36)
jest.config.js (2)

30-30: LGTM!

The new mapping for SVG files with query parameters (\\.svg\\?react$) to the mock file is a good addition to enhance the testing setup. It should help prevent issues related to importing SVGs directly in a testing environment.


31-31: Looks good!

The new mapping for standard SVG files (\\.svg$) to the mock file is a consistent addition to enhance the testing setup, similar to the previous mapping for SVG files with query parameters. It should help prevent issues related to importing SVGs directly in a testing environment.

src/components/OrganizationDashCards/CardItem.tsx (5)

2-6: Verify the SVG import configuration.

The changes to the SVG import syntax using ?react are consistent across the file. This suggests the use of a custom loader or configuration to handle SVGs as React components.

Please ensure that the custom loader or configuration is properly set up and tested to handle SVGs as React components. Verify that the SVGs are correctly rendered and optimized within the application.


Line range hint 35-38: LGTM!

The conditional rendering of SVG icons based on the type prop is implemented correctly. The logic is sound, and the syntax is valid.


Line range hint 54-59: LGTM!

The rendering of the creator information is implemented correctly. The logic is sound, and the syntax is valid.


Line range hint 71-78: LGTM!

The rendering of the location information is implemented correctly. The logic is sound, and the syntax is valid.


Line range hint 79-97: LGTM!

The conditional rendering of event dates or post time is implemented correctly. The logic is sound, and the syntax is valid. The use of the dayjs library for date formatting is appropriate.

src/components/Venues/VenueCard.tsx (1)

4-4: LGTM!

The change to the PeopleIcon import statement is a valid optimization related to the Vite update. By using the ?react query parameter, the SVG will be imported as a React component, which can improve performance and bundle size.

This change should not affect the functionality of the VenueCard component.

src/components/IconComponent/IconComponent.tsx (16)

6-6: LGTM!

The import statement change for ActionItemIcon looks good. Using the ?react query parameter is a valid way to import SVG files as React components in Vite.


7-7: LGTM!

The import statement change for BlockUserIcon looks good.


8-8: LGTM!

The import statement change for CheckInRegistrantsIcon looks good.


9-9: LGTM!

The import statement change for DashboardIcon looks good.


10-10: LGTM!

The import statement change for EventsIcon looks good.


11-11: LGTM!

The import statement change for FundsIcon looks good.


12-12: LGTM!

The import statement change for ListEventRegistrantsIcon looks good.


13-13: LGTM!

The import statement change for OrganizationsIcon looks good.


14-14: LGTM!

The import statement change for PeopleIcon looks good.


15-15: LGTM!

The import statement change for TagsIcon looks good.


16-16: LGTM!

The import statement change for TagIcon looks good.


17-17: LGTM!

The import statement change for PluginsIcon looks good.


18-18: LGTM!

The import statement change for PostsIcon looks good.


19-19: LGTM!

The import statement change for SettingsIcon looks good.


20-20: LGTM!

The import statement change for VenueIcon looks good.


21-21: LGTM!

The import statement change for RequestsIcon looks good.

src/components/OrgListCard/OrgListCard.tsx (1)

2-2: LGTM!

The updated import statement for FlaskIcon using the ?react suffix is a valid syntax supported by the latest version of Vite for importing SVGs as React components. This change aligns with the PR objective of updating the Vite package and should not affect the functionality of the OrgListCard component.

src/components/UserPortal/UserSidebar/UserSidebar.tsx (4)

5-5: LGTM!

The change in import syntax for OrganizationsIcon to include the ?react query parameter is a valid optimization. This change should improve the compatibility and performance of SVG rendering within the React application without affecting the functionality of the UserSidebar component.


6-6: LGTM!

The change in import syntax for SettingsIcon to include the ?react query parameter is a valid optimization. This change should improve the compatibility and performance of SVG rendering within the React application without affecting the functionality of the UserSidebar component.


7-7: LGTM!

The change in import syntax for ChatIcon to include the ?react query parameter is a valid optimization. This change should improve the compatibility and performance of SVG rendering within the React application without affecting the functionality of the UserSidebar component.


8-8: LGTM!

The change in import syntax for TalawaLogo to include the ?react query parameter is a valid optimization. This change should improve the compatibility and performance of SVG rendering within the React application without affecting the functionality of the UserSidebar component.

src/components/LeftDrawer/LeftDrawer.tsx (1)

5-5: LGTM!

The change in the import statement for OrganizationsIcon is consistent with the other SVG imports in the file. This suggests that the SVG is being imported directly as a React component, which should not affect the functionality of the component as long as the build tool or configuration supports this syntax.

package.json (3)

61-61: Verify the Vite upgrade and update documentation if needed.

The upgrade to Vite 5.x is a significant change that could potentially introduce breaking changes. Please ensure that the development and build processes are thoroughly tested with this new version to catch any issues early.

Also, if there are any relevant changes to the development or build processes due to this upgrade, make sure to update the project's documentation accordingly.


143-143: LGTM!

The minor version update to tsx should be backwards compatible, but please make sure to test the project with this new version to confirm that there are no unexpected issues.


144-144: Verify the vite-plugin-svgr upgrade and update documentation if needed.

The upgrade to vite-plugin-svgr 4.x is a significant change that could potentially introduce breaking changes. Please ensure that SVG handling and rendering are thoroughly tested with this new version to catch any issues early.

Also, if there are any relevant changes to SVG handling or rendering due to this upgrade, make sure to update the project's documentation accordingly.

src/components/UserPortal/UserSidebarOrg/UserSidebarOrg.tsx (2)

12-12: LGTM!

The change in import syntax for AngleRightIcon looks good. The ?react suffix is a feature often used by build tools like Vite or Webpack to optimize the import and rendering of SVG assets within React components. This aligns with the PR objective of updating the Vite package.


13-13: Looks good!

Similar to the previous import change, the updated syntax for importing TalawaLogo is a valid modification related to the Vite package update. Refer to the comment above for more context on the ?react suffix.

src/screens/UserPortal/Chat/Chat.tsx (1)

11-11: LGTM!

The change in the import statement for the NewChat component looks good. The transformation of the SVG file into a React component using a loader or plugin should improve the performance and maintainability of the codebase.

src/components/LeftDrawer/LeftDrawer.tsx Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 18, 2024
@palisadoes palisadoes merged commit 77ce887 into PalisadoesFoundation:develop Sep 23, 2024
11 of 12 checks passed
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.

2 participants