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

Reducing dependency bloat #3411

Merged
merged 1 commit into from
Nov 30, 2024
Merged

Reducing dependency bloat #3411

merged 1 commit into from
Nov 30, 2024

Conversation

Defi-Moses
Copy link
Collaborator

@Defi-Moses Defi-Moses commented Nov 27, 2024

Moves certain dependencies to devDependencies so that the packages weigh less.

Summary by CodeRabbit

  • New Features

    • Added ethers and viem dependencies to enhance functionality in the @synapsecns/synapse-constants package.
  • Chores

    • Updated dependency organization in @synapsecns/sdk-router and @synapsecns/synapse-constants packages for better clarity and maintenance.

Copy link
Contributor

coderabbitai bot commented Nov 27, 2024

Walkthrough

The pull request includes modifications to the package.json files of two packages: @synapsecns/sdk-router and @synapsecns/synapse-constants. Changes involve reorganizing dependencies, specifically moving certain packages between dependencies and devDependencies. In sdk-router, three packages were added to devDependencies, while one package was removed from dependencies. In synapse-constants, two packages were added to dependencies, and one package was moved to devDependencies, with corresponding removals from devDependencies.

Changes

File Change Summary
packages/sdk-router/package.json - Added @babel/core, @babel/plugin-transform-modules-commonjs, babel-jest to devDependencies
- Removed @babel/core, @babel/plugin-transform-modules-commonjs, babel-jest, jest from dependencies
- Added jest to devDependencies with version ^29.7.0
packages/synapse-constants/package.json - Moved @codecov/rollup-plugin to devDependencies
- Added ethers and viem to dependencies
- Removed ethers and viem from devDependencies

Possibly related PRs

  • Widget Config Change [SLT-399] #3343: The changes in this PR involve moving the @codecov/rollup-plugin from dependencies to devDependencies, which is similar to the main PR's focus on reorganizing dependencies in the package.json file.

Suggested labels

M-deps, size/s

Suggested reviewers

  • abtestingalpha
  • trajan0x
  • bigboydiamonds

🐰 In the garden, changes bloom,
Dependencies shift, making room.
From dev to main, they find their place,
A tidy package, a cleaner space.
Hops of joy for code so neat,
In the world of packages, we can't be beat! 🌼


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.

@Defi-Moses Defi-Moses linked an issue Nov 27, 2024 that may be closed by this pull request
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: 1

🧹 Outside diff range and nitpick comments (1)
packages/synapse-constants/package.json (1)

37-38: Standardize version constraints

The dependencies use inconsistent version constraints:

  • ethers uses fixed version 5.7.2
  • viem uses caret range ^2.21.6

Consider adopting a consistent versioning strategy across dependencies to make updates more predictable.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 91dee92 and a6a6527.

📒 Files selected for processing (2)
  • packages/sdk-router/package.json (1 hunks)
  • packages/synapse-constants/package.json (1 hunks)
🔇 Additional comments (3)
packages/synapse-constants/package.json (1)

41-41: LGTM: Correctly moved build tool to devDependencies

Moving @codecov/rollup-plugin to devDependencies is correct as it's only needed during development/testing, not in production. This change aligns with the PR objective of reducing dependency bloat.

packages/sdk-router/package.json (2)

48-49: LGTM! Correct categorization of build and test dependencies.

The movement of @babel/core, @babel/plugin-transform-modules-commonjs, babel-jest, and jest to devDependencies is appropriate as these are build-time and test-time dependencies not required at runtime.

Also applies to: 54-54, 58-58


48-49: Verify build and test processes still work as expected.

Since build-related dependencies have been moved, let's verify that the build and test processes continue to function correctly.

Also applies to: 54-54, 58-58

✅ Verification successful

Build dependencies are properly configured and should work as expected

The package uses tsdx as its build tool, which internally manages Babel configuration. The necessary Babel dependencies are correctly defined:

  • @babel/core and @babel/plugin-transform-modules-commonjs for transpilation
  • babel-jest for test file processing

The build and test infrastructure is well-established with:

  • Comprehensive test suite (25 test files)
  • Proper TypeScript configuration
  • Jest configuration with necessary module resolution
  • Build scripts using tsdx for both development and production
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the package defines all necessary build and test dependencies
# by checking for any missing peer dependencies or version conflicts.

# Check if all babel dependencies are properly defined
rg -A 1 "babel" package.json

# Check if there are any peer dependency warnings in package-lock.json
if [ -f package-lock.json ]; then
  rg "requires a peer" package-lock.json
fi

# Check if jest config exists and references babel
if [ -f jest.config.js ]; then
  rg "babel" jest.config.js
fi

Length of output: 204


Script:

#!/bin/bash
# Let's check for babel configuration and usage in the codebase
# Check for babel config files
fd "babel.config.js|.babelrc"

# Check for babel usage in package scripts
rg "babel" packages/sdk-router/package.json

# Check for any test files that might be using babel
fd ".test.js|.spec.js" packages/sdk-router/

# Check for build scripts that might use babel
rg "build.*script" packages/sdk-router/package.json

Length of output: 367


Script:

#!/bin/bash
# Let's check the package.json scripts section and build configuration
cat packages/sdk-router/package.json

# Check if there are any test files in the src directory
fd ".js" packages/sdk-router/src/

# Look for build or test related configuration files
fd "jest.config|tsconfig|rollup.config" packages/sdk-router/

Length of output: 3087


Script:

#!/bin/bash
# Let's check the build tool (tsdx) and test configurations
cat packages/sdk-router/jest.config.js

# Check if there are any TypeScript test files
fd ".test.ts|.spec.ts" packages/sdk-router/src/

# Check the content of tsconfig.json for babel configuration
cat packages/sdk-router/tsconfig.json

Length of output: 3364

Comment on lines +37 to +38
"ethers": "5.7.2",
"viem": "^2.21.6"
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider removing redundant ethers sub-packages

The package includes both the full ethers package and individual @ethersproject/* packages. This could lead to duplicate installations and increased bundle size.

Consider removing the individual packages if they're not specifically needed:

  "dependencies": {
-   "@ethersproject/address": "5.7.0",
-   "@ethersproject/bignumber": "5.7.0",
    "ethers": "5.7.2",
    "viem": "^2.21.6"
  }

Committable suggestion skipped: line range outside the PR's diff.

Copy link

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: a6a6527
Status: ✅  Deploy successful!
Preview URL: https://b59861cf.sanguine-fe.pages.dev
Branch Preview URL: https://packages-packages-cleanup.sanguine-fe.pages.dev

View logs

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 34.90814%. Comparing base (79a40b5) to head (a6a6527).
Report is 18 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                 @@
##             master       #3411          +/-   ##
===================================================
+ Coverage   3.10368%   34.90814%   +31.80446%     
===================================================
  Files            44          78          +34     
  Lines          2932        2667         -265     
  Branches          0          82          +82     
===================================================
+ Hits             91         931         +840     
+ Misses         2838        1733        -1105     
  Partials          3           3                  
Flag Coverage Δ
packages 90.44834% <ø> (?)
promexporter ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@trajan0x trajan0x merged commit 8069977 into master Nov 30, 2024
38 checks passed
@trajan0x trajan0x deleted the packages/packages-cleanup branch November 30, 2024 17:14
Copy link

codecov bot commented Nov 30, 2024

Bundle Report

Changes will increase total bundle size by 358.3kB (1.12%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
widget-esm-cjs 276.08kB 2.78kB (1.02%) ⬆️
@synapsecns/synapse-constants-cjs-esm 177.53kB 177.53kB (100%) ⬆️
@synapsecns/synapse-constants-esm-cjs 177.99kB 177.99kB (100%) ⬆️

trajan0x added a commit that referenced this pull request Nov 30, 2024
trajan0x added a commit that referenced this pull request Nov 30, 2024
trajan0x added a commit that referenced this pull request Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[sdk-router] Move Jest to dev dependencies
2 participants