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

Fix: more loosened React lib version check #7484

Merged

Conversation

Shinyaigeek
Copy link
Contributor

↪️ Pull Request

Fixes: #7335

Hi team 👋

Currently, JSTransformer's detection of React lib version in package.json is crashed when react lib is specified with URL (such as https://pkg.csb.dev/preactjs/preact/commit/96082866/preact ). I fixed this.

💻 Examples

package.json

{
  "private": true,
  "dependencies": {
    "preact": "https://pkg.csb.dev/preactjs/preact/commit/96082866/preact"
  }
}

🚨 Test instructions

I added a test case to whether or not check parcel correctly work with react dependency specified with URL.

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@height
Copy link

height bot commented Dec 26, 2021

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@Shinyaigeek
Copy link
Contributor Author

some test related to this PR case failed, I will fix later🙏

Comment on lines +212 to +216
reactLibVersion = reactLibVersion
? semver.validRange(reactLibVersion)
: null;
let minReactLibVersion =
reactLibVersion != null && reactLibVersion !== '*'
reactLibVersion !== null && reactLibVersion !== '*'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use semver.validRange instead of semver.valid, because semver.valid returns null with the input such as 17 so some test case will be failed. I use semver.validRange to avoid this. If you have another idea about this, I would appreciate it if you tell me.

@devongovett devongovett merged commit 26570dc into parcel-bundler:v2 Dec 28, 2021
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.

React lib version check should be loosened more
2 participants