-
-
Notifications
You must be signed in to change notification settings - Fork 322
Add Hardhat plugin #1087
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
Add Hardhat plugin #1087
Conversation
webpro
left a comment
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.
Thanks for the plugin! LGTM, but I do have a remark or two.
| { | ||
| "name": "@fixtures/hardhat", | ||
| "dependencies": { | ||
| "hardhat": "*" |
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.
Looks like it's typically used as dev dep? Seeing --save-dev in their docs.
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.
Yes
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.
Changed. Does that make a difference for production mode?
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.
Indeed. In general just better to have the fixtures as close to reality as possible.
|
|
||
| const resolve: Resolve = async () => { | ||
| return [toDependency('hardhat')]; | ||
| }; |
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.
The
hardhatpackage may or may not be imported.
I understand the reasoning here, but if it's indeed not imported anywhere, then perhaps it's used in some other way? E.g. in package.json#scripts or somewhere else?
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.
Some people add scripts, but there's also a hardhat-shorthand package which is installed globally and adds an hh shortcut to replace npx hardhat, yarn run hardhat, etc. It parses the Hardhat config and supports tab completion for builtin and user-defined commands, making it categorically different from scripts.
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.
Note that the global hh bin still requires that hardhat be installed locally.
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.
Thanks, bit of a bummer but let's roll with it :)
commit: |
| @@ -0,0 +1,25 @@ | |||
| import { toDependency } from 'src/util/input.js'; | |||
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.
Please use relative 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.
fixed
|
Thanks, Nick! |
|
🚀 This pull request is included in v5.57.0. See Release 5.57.0 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
Hardhat is a CLI tool that relies on the presence of a JS config file. The
hardhatpackage may or may not be imported.This plugin is meant to do two things:
hardhat.config.xas an entry.hardhatis not imported anywhere.Is the implementation correct? I'm not sure about the
resolvefunction.