graph-tooling
graph-tooling copied to clipboard
allow passing `spkg.io` from `graph init`
Pull the substream package from spkg.io
@saihaj can I pick this to work on next?
go for it @joshuanazareth97
@saihaj Notes on my understanding / the implementation I am planning:
- As I understand it, there are 2 locations from which we could receive spkgPath: (1) flag (2) interactive prompt
- The value received from either of these is passed into the same
initSubgraphFromContractmethod, which then adds this to the manifest file undersource - Currently, the file must exist in the path relative to the directory that
graph initis called in
Approach:
- Change the validation for the spkg file to also pass for the URL format above (spkg.io.../.../)
- If we receive a URL, download the file into the current directory
- In this case spkgPath becomes the name of the spkg file, since it is in the root of the current directory
- Continue as before, passing spkgPath into the manifest, just like with local files
Bonus:
- Potential UX improvement: If a URL is passed, we can further ask the user which directory they want to download the spkg file into, defaulting to the current dir. This would give more control to the user, but would require additional logic for creating non-existent folders etc.
Interested to know your thoughts around this approach.
Hey @saihaj, have implemented this using a slight variation of the approach above. have not yet implemented the bonus feature I mentioned, do let me know if there's anything you'd like me to change?