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

[WIP] Project root resolution #5517

Merged
merged 11 commits into from
Jul 23, 2024
Merged

[WIP] Project root resolution #5517

merged 11 commits into from
Jul 23, 2024

Conversation

alcuadrado
Copy link
Member

@alcuadrado alcuadrado commented Jul 12, 2024

This PR revamps how we manage the project root resolution and how it impacts other parts of the system.

The project root in Hardhat v3 will be the root of the npm package containing the Hardhat config file, or the one containing the CWD if an instance of the HRE is initialized without using a config file.

This PR touches several files, so here's a summary of the changes:

  • The base HRE constructor in the core package now accepts an optional projectRoot.
  • There's now a resolveProjectRoot helper exposed in core.
  • Plugin installation error detection is now run based on the project root, as plugins and their dependencies should all be installed in the npm package containing the project.
  • I added that same error detection logic to the hook manager, because loading actions can fail.
  • The three ways to initialize the HRE (the cli, importing hardhat, and using createHardhatRuntimeEnvironment) were updated according to the new project root logic.
  • I implemented a small change to the /package module in the utils package.

I'm marking this as WIP as I still haven't added tests for the new functionality yet.

Fixes #5436

Copy link

vercel bot commented Jul 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2024 2:22pm

Copy link

changeset-bot bot commented Jul 12, 2024

⚠️ No Changeset found

Latest commit: 4dc69d2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@alcuadrado alcuadrado requested review from zoeyTM, schaable and kanej and removed request for zoeyTM and schaable July 12, 2024 21:18
@github-actions github-actions bot added the status:ready This issue is ready to be worked on label Jul 12, 2024
@alcuadrado alcuadrado changed the title Projext root [WIP] Project root resolution Jul 12, 2024
Copy link
Contributor

@zoeyTM zoeyTM left a comment

Choose a reason for hiding this comment

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

Pre-approving before tests are added, but I think this looks good!

Copy link
Member

@schaable schaable left a comment

Choose a reason for hiding this comment

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

LGTM, just left a minor comment about parameter order

@schaable schaable added the v-next A Hardhat v3 development task label Jul 15, 2024
Base automatically changed from fix-example-project to v-next July 15, 2024 21:13
@schaable schaable mentioned this pull request Jul 23, 2024
@schaable schaable merged commit 02fac13 into v-next Jul 23, 2024
50 checks passed
@schaable schaable deleted the projext-root branch July 23, 2024 15:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready This issue is ready to be worked on v-next A Hardhat v3 development task
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants