-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Config loading #5277
Config loading #5277
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
* @param projectName The base name of the folder with the project to use. | ||
* @param changeDirTo If provided, the working directory will be changed to this. Must be a child of the project folder. | ||
*/ | ||
export function useFixtureProject(projectName: string, changeDirTo?: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alcuadrado wdyt about having a test
module in hardhat-utils
for things like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be a separate package, as it should be a devDependency. I'm planning to add it asap. Before we start repeating ourselves.
? configPath | ||
: resolve(process.cwd(), configPath); | ||
|
||
const { exists } = await import("@nomicfoundation/hardhat-utils/fs"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably use regular imports for the hardhat-utils
package, as the package only imports things from node and should be fast enough to avoid using dynamic imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this comment for now, we'll need more data to decide if and when it is worth using dynamic imports, as most things now will be lazy and wont benefit from using this the pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code in particular already existed in the v-next
branch, I just moved it from internal/cli/main.ts
into here. Definitely something to think about moving forward though.
|
||
const config = imported.default; | ||
|
||
if (typeof config !== "object" || config === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alcuadrado This would allow Array
configs to be passed, is that intended? By the way, this is the second time I've seen an isObject
check (which is also missing the Array
check). I believe we should add this as a util.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zoeyTM you can ignore this, I'll put a separate PR adding isObject
and replacing the occurrences with the helper.
resolves #5263