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 remix-url-resolver not handling "github:XX" styled package.json packages #5332

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

forefy
Copy link

@forefy forefy commented Oct 25, 2024

Hi 👋

I'm PRing this small change in the remix-url-resolver in cases where the target repo specifies a github: styled repo instead of a regular npm version on it's package.json

Look at forge-std from this example

  "devDependencies": {
    "forge-std": "github:foundry-rs/forge-std#v1.8.1",
    "prettier": "^3.0.0",
    "solhint": "^3.6.2"
  }

This will end up on handleNpmImport, which tries to parse the github:XX string as an NPM package version and errors out

The PR fixes this by just detecting the github prefix, and redirecting execution flow to the correct handleGithubCall handler

To reproduce try to resolve contract repo: https://github.com/PaulRBerg/foundry-template

Please let me know if you have any questions!

Copy link

netlify bot commented Oct 25, 2024

👷 Deploy request for remixproject pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 69d2885

@Aniket-Engg
Copy link
Collaborator

@forefy Can you please rebase it?

If the entry is pointing to a github repo, redirect to correct handler instead of continuing
@forefy
Copy link
Author

forefy commented Nov 4, 2024

@forefy Can you please rebase it?

@Aniket-Engg done :)

@Aniket-Engg
Copy link
Collaborator

@forefy which contract should be compiled from shared repo to reproduce the error?

Copy link
Collaborator

@Aniket-Engg Aniket-Engg left a comment

Choose a reason for hiding this comment

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

This still doesn't work as handleGithubCall method performs certain cleaning for URL and resulting URL from github:XX style are not being resolved

@forefy
Copy link
Author

forefy commented Nov 4, 2024

@Aniket-Engg I created a temp PoC repo to demonstrate my point: https://github.com/forefy/remix-url-resolver-poc

To replicate:

  • run npm i
  • run npm run start to see the original error
  • patch in the changes proposed in this PR
  • run npm run start again and see that it works after the change

The difference from what I assumed you tested is how you initialize RemixURLResolver:

const dependencies = {
  deps: {
    "forge-std": "github:foundry-rs/forge-std#v1.8.1", // This was not supported
    prettier: "^3.0.0",
    solhint: "^3.6.2"
  }
};

const resolver = new RemixURLResolver(() => {
  return dependencies;
});

@forefy
Copy link
Author

forefy commented Nov 18, 2024

@Aniket-Engg were you able to replicate the issue now? can we merge this in?

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