-
Notifications
You must be signed in to change notification settings - Fork 208
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 graph init with --from-example and --from-contract modes #224
Conversation
Users can choose between these two modes. If they provide all the different values that each of the modes needs, the interactive form is bypassed, allowing the new `graph init` to be used in non-interactive environments such as CI.
graph init
with --from-example
and --from-contract
modes
The "Next steps:" instructions don't instruct me to run codegen, which is necessary before deploy. |
@leodasvacas That's because |
@Jannis ah nice, I got confused because of the |
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.
A bunch of small comments. Nice tests! It would be cool to also have a test for the generated contents.
}) | ||
|
||
if (inputs === undefined) { | ||
process.exit(1) |
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.
Does inputs === undefined
have a particular meaning? Should we print something here?
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 inputs
are undefined
if the form is cancelled. I've added 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.
Where's the 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 @leodasvacas, I'll address the comments in the morning! |
This behavior showed when using --from-example without an internet connection. Now it prints the actual error instead of silently failing.
@leodasvacas I've fixed a few things, added a few comments and tried to address with comments with replies. Let me know what you think. |
src/scaffold.js
Outdated
subgraphName, | ||
}, | ||
dependencies: { | ||
'@graphprotocol/graph-cli': '0.7.2', |
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'll need to be careful to remember to update this, at least on breaking changes.
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. I have an idea: How about we take the package version and put it in here? Then we're always up to date.
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.
If that's possible that would be great.
This supersedes #216 by supporting both the old and the new
graph init
via--from-example
and--from-contract <address>
mode flags.
TODO
Example usage
If all arguments are provided for either mode,
graph init
will run in non-interactive mode:If one or more arguments are not provided,
graph init
will run the user through an interactive form to create a subgraph from an existing contract, pre-populating fields with the provided values:If an ABI cannot be found on Etherscan, this form asks for a local ABI file path: