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

feat: mv urllib to peerDependencies #174

Merged
merged 2 commits into from
Dec 7, 2024
Merged

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Dec 5, 2024

Summary by CodeRabbit

  • Chores
    • Restructured the urllib dependency, moving it to peerDependencies and adding it to devDependencies with a specific version.

@fengmk2 fengmk2 requested a review from killagu December 5, 2024 18:26
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

Walkthrough

The changes in this pull request involve modifications to the package.json file for the egg-mock project, specifically focusing on the handling of the urllib dependency. The urllib dependency has been removed from the dependencies section, added to the peerDependencies section with a version constraint of either 3 or 4, and included in the devDependencies section with a specified version of 3. Other dependencies remain unchanged.

Changes

File Change Summary
package.json - Removed urllib from dependencies
- Added urllib to peerDependencies with `^3
- Added urllib to devDependencies with 3

Poem

In the garden where bunnies hop,
Dependencies shift and never stop.
urllib moves, a dance so grand,
To peer and dev, it takes a stand.
With every change, we cheer and play,
Hopping along, come what may! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 720a98a and 81804e5.

📒 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.

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

pkg-pr-new bot commented Dec 5, 2024

Open in Stackblitz

npm i https://pkg.pr.new/eggjs/egg-mock@174

commit: 81804e5

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

🧹 Outside diff range and nitpick comments (2)
package.json (2)

68-69: Ensure devDependencies version aligns with CI/testing needs

The specific version ^4.6.3 in devDependencies is appropriate for testing against the latest major version while the peerDependencies remain flexible.

However, consider adding a test matrix to verify compatibility with both urllib v3 and v4.

Would you like me to propose a CI configuration that tests against both urllib versions?


Breaking Change: urllib peer dependency requires documentation updates

  • Add a note in README.md about the urllib peer dependency requirement
  • Update CHANGELOG.md to document this breaking change in the next major version
  • Bump major version from 5.x.x to 6.0.0 since this is a breaking change

Note: The verification confirms that:

  1. README.md has no mention of the urllib peer dependency requirement
  2. CHANGELOG.md shows recent changes but none documenting the urllib peer dependency change
  3. The current version is 5.12.5 and continues to follow semver versioning
  4. The package.json shows urllib as a peer dependency "urllib": "^3 || ^4" but this requirement isn't documented
🔗 Analysis chain

Line range hint 1-89: Breaking Change: Document the urllib peer dependency requirement

This change requires consumers to explicitly install urllib. Consider:

  1. Adding a note in the README about the urllib peer dependency requirement
  2. Updating the CHANGELOG to mark this as a breaking change
  3. Following semver by bumping the major version

Let's check the documentation:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if documentation mentions the urllib requirement

# Check README for urllib mentions
rg -i 'urllib' README.md || echo "No urllib mention in README.md"

# Check CHANGELOG for breaking changes
rg '^#+ \[?[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md -A 5 || echo "No CHANGELOG.md found"

Length of output: 8599

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 110cb8a and 720a98a.

📒 Files selected for processing (1)
  • package.json (2 hunks)
🔇 Additional comments (2)
package.json (2)

44-44: LGTM: Dependencies cleanup

The removal of urllib from dependencies is correct as it's being moved to peerDependencies.


48-49: Verify the version range compatibility with existing consumers

The version range ^3 || ^4 in peerDependencies is appropriate as it:

  1. Maintains compatibility with existing urllib v3 consumers
  2. Allows adoption of newer urllib v4 features
  3. Follows semver conventions

However, this change requires consumers to explicitly install urllib.

Let's verify the impact on existing consumers:

✅ Verification successful

Based on the search results, I can now provide a final response:

The urllib version range is appropriate and safe

The version range ^3 || ^4 in peerDependencies is well-justified because:

  1. The codebase itself uses urllib v4 ("urllib": "^4.6.3" in devDependencies) showing compatibility with v4
  2. No version-specific code or breaking changes between v3 and v4 were found in the implementation
  3. The range allows existing consumers on v3 to continue working while enabling adoption of v4
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for projects depending on egg-mock and their urllib versions

# Search for package.json files that depend on egg-mock
rg -l '"egg-mock":\s*"[^"]*"' -g 'package.json'

# Check urllib major version usage patterns in the codebase
rg 'urllib\.request\(' -A 5

Length of output: 77


Script:

#!/bin/bash
# Let's try a different approach to analyze urllib usage and version compatibility

# Check how urllib is used in the codebase
rg "require\(['\"](urllib|urllib-sync)" -B 1 -A 3

# Look for any urllib-related test cases or examples
rg "urllib" -g "test/**/*.{js,ts}"

# Check package.json history for urllib version changes
git log -p package.json | rg "urllib"

# Look for any urllib configuration or setup
rg "urllib" -g "*.{js,ts,json}" -v "test/" -v "package.json"

Length of output: 90977


Script:

#!/bin/bash
# Let's check for urllib version usage and compatibility patterns

# Check for urllib version requirements in dependencies
rg '"urllib":' -A 1 -B 1 package*.json

# Look for urllib imports and usage patterns
ast-grep --pattern 'require("urllib")'

# Check for any urllib version-specific code or comments
rg -i 'urllib.*v(3|4)' --type js

Length of output: 223

Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.52%. Comparing base (1f9fc01) to head (81804e5).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #174   +/-   ##
=======================================
  Coverage   85.52%   85.52%           
=======================================
  Files          27       27           
  Lines        2626     2626           
  Branches      474      474           
=======================================
  Hits         2246     2246           
  Misses        380      380           

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

Copy link
Contributor

@killagu killagu left a comment

Choose a reason for hiding this comment

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

LGTM

@fengmk2 fengmk2 merged commit df7dc48 into master Dec 7, 2024
14 checks passed
@fengmk2 fengmk2 deleted the peerDependencies-urllib branch December 7, 2024 11:49
fengmk2 pushed a commit that referenced this pull request Dec 7, 2024
[skip ci]

## [5.13.0](v5.12.5...v5.13.0) (2024-12-07)

### Features

* mv urllib to peerDependencies ([#174](#174)) ([df7dc48](df7dc48))
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