Skip to content

chore(web): migrate-to-vite #55

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
Sep 9, 2024
Merged

chore(web): migrate-to-vite #55

merged 1 commit into from
Sep 9, 2024

Conversation

tractorss
Copy link
Contributor

@tractorss tractorss commented Sep 1, 2024

PR-Codex overview

This PR updates the project from Parcel to Vite, replaces environment variables access, and refactors imports for better tool compatibility.

Detailed summary

  • Replaced Parcel with Vite for build tool
  • Updated environment variable access to import.meta.env
  • Refactored imports for compatibility with Vite
  • Updated tsconfig paths for Vite
  • Adjusted file imports for better tool compatibility

The following files were skipped due to too many changes: yarn.lock

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Transitioned the project build tool from Parcel to Vite, enhancing build performance and development experience.
    • Introduced a new vite.config.js file for Vite configuration, including plugins for SVG handling and TypeScript path mappings.
  • Bug Fixes

    • Improved logic for determining previous routes in the Policy component, ensuring accurate navigation.
  • Documentation

    • Updated environment variable access throughout the project to align with modern JavaScript practices using import.meta.env.

Copy link
Contributor

coderabbitai bot commented Sep 1, 2024

Walkthrough

The project has undergone significant changes, primarily transitioning from Parcel to Vite as the build tool. This includes updates to configuration files, import statements, and the handling of environment variables. The modifications enhance compatibility with modern JavaScript practices, particularly through the adoption of ES modules and streamlined import paths for assets.

Changes

File(s) Change Summary
.gitignore, contracts/.gitignore, web/.gitignore Removed entries related to Parcel bundler cache, indicating a shift to Vite.
web/netlify.toml Removed the [dev] section specifying Parcel as the framework for development.
web/package.json Added "type": "module", replaced Parcel scripts with Vite, and updated dependencies accordingly.
web/scripts/gitInfo.js Transitioned from CommonJS to ES module syntax for imports.
web/src/components/HeroImage.tsx, web/src/components/InfoCard.tsx Modified SVG import paths by removing the "tsx:" prefix.
web/src/consts/index.ts, web/src/context/Web3Provider.tsx, web/src/utils/getGraphqlUrl.ts, web/src/utils/sentry.ts Switched from process.env to import.meta.env for accessing environment variables.
web/vite.config.js Introduced a new Vite configuration file for the project, specifying plugins and settings.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WebApp
    participant Vite
    User->>WebApp: Start Development
    WebApp->>Vite: Build Project
    Vite->>WebApp: Serve Files
    WebApp->>User: Display Application
Loading

🐰 "Oh, what a hop, what a skip,
From Parcel's grip, we now flip!
With Vite in tow, we dance and play,
Building our dreams in a brighter way!
Hooray for the change, let’s cheer and sing,
For a faster build, oh what joy it brings!" 🌼


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

netlify bot commented Sep 1, 2024

Deploy Preview for curate-v2 ready!

Name Link
🔨 Latest commit a2e0556
🔍 Latest deploy log https://app.netlify.com/sites/curate-v2/deploys/66d4684bfcc49f00080978eb
😎 Deploy Preview https://deploy-preview-55--curate-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aac4077 and a2e0556.

Files ignored due to path filters (3)
  • web/src/assets/svgs/icons/book.svg is excluded by !**/*.svg
  • web/src/assets/svgs/icons/pile-coins.svg is excluded by !**/*.svg
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (14)
  • .gitignore (1 hunks)
  • contracts/.gitignore (1 hunks)
  • web/.gitignore (1 hunks)
  • web/netlify.toml (1 hunks)
  • web/package.json (4 hunks)
  • web/scripts/gitInfo.js (1 hunks)
  • web/src/components/HeroImage.tsx (1 hunks)
  • web/src/components/InfoCard.tsx (1 hunks)
  • web/src/consts/index.ts (2 hunks)
  • web/src/context/Web3Provider.tsx (1 hunks)
  • web/src/pages/SubmitItem/Policy/index.tsx (1 hunks)
  • web/src/utils/getGraphqlUrl.ts (1 hunks)
  • web/src/utils/sentry.ts (1 hunks)
  • web/vite.config.js (1 hunks)
Files not reviewed due to server errors (3)
  • web/src/utils/sentry.ts
  • web/src/context/Web3Provider.tsx
  • web/package.json
Files skipped from review due to trivial changes (5)
  • .gitignore
  • contracts/.gitignore
  • web/netlify.toml
  • web/src/components/HeroImage.tsx
  • web/src/components/InfoCard.tsx
Additional comments not posted (7)
web/src/utils/getGraphqlUrl.ts (1)

5-6: LGTM!

The changes are consistent with the migration to Vite. The switch to import.meta.env is the correct way to access environment variables in a Vite project.

web/.gitignore (1)

9-12: LGTM!

The changes are consistent with the migration to Vite. The removed entries are Parcel-specific, and the added entries are Vite-specific. The changes ensure that the correct directories are ignored in the Vite project.

web/src/pages/SubmitItem/Policy/index.tsx (1)

24-27: LGTM!

The change improves the clarity and correctness of the route calculation. The ternary operator is more appropriate in this case, as it ensures that the previous route is accurately determined based on the actual length of fieldProps.

web/vite.config.js (1)

1-32: LGTM!

The Vite configuration looks good and follows best practices. The use of plugins enhances the development experience and provides additional functionality. The envPrefix property ensures that only specific environment variables are exposed to the application. The suppression of certain rollup warnings in the onwarn function is justified to avoid unnecessary warnings.

web/scripts/gitInfo.js (1)

2-6: LGTM!

The changes to the import statements align the code with modern JavaScript practices and ES module syntax. The JSON type assertion for packageJson import enhances the explicit handling of JSON imports. These changes improve the clarity and maintainability of the code.

web/src/consts/index.ts (2)

5-5: LGTM!

The change to use import.meta.env.REACT_APP_IPFS_GATEWAY for the IPFS_GATEWAY constant reflects a shift towards using the ES module syntax for accessing environment variables. This change improves compatibility with module-based environments. The fallback value ensures a default value is used if the environment variable is not set.


23-23: LGTM!

The change to use import.meta.env.COURT_SITE for the COURT_SITE constant reflects a shift towards using the ES module syntax for accessing environment variables. This change improves compatibility with module-based environments. The nullish coalescing operator (??) ensures a default value is used if the environment variable is not set or is undefined.

@kemuru kemuru self-requested a review September 6, 2024 12:12
@tractorss tractorss merged commit d8f9d60 into master Sep 9, 2024
6 checks passed
@tractorss tractorss deleted the chore/migrate-to-vite branch September 9, 2024 06:24
@coderabbitai coderabbitai bot mentioned this pull request Sep 9, 2024
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