gleam
gleam copied to clipboard
Use cached deps version information when network connection is not available
Thank you for your work on gleam.
This request is a more fleshed out version of #1069, but as I did not create that issue, I am unable to reopen it.
I wanted to try gleam
, installed it, ran gleam new
which succeeded, and got on a flight without wifi, thinking I'll be able to play with it while offline.
But this was not to be, because neither gleam build
nor gleam test
work on first run in a project without an internet connection.
$ gleam test
Resolving versions
error: Dependency resolution failed
An error occurred while determining what dependency packages and versions
should be downloaded.
The error from the version resolver library was:
Decision making failed
It would be great if gleam new
did the steps necessary to have a minimally working version of the package it creates be buildable.
I imagine that one way to do this would be to use a centralized cache for gleam packages that can be shared across repositories, so that once a user has successfully built one project from a quickstart gleam new
, building another project from a barebones gleam new
would grab those same standard libraries, instead of re-downloading them for every first gleam build
in any given project.
I do want to acknowledge that gleam build
and gleam test
do not require an internet connection on subsequent calls (provided no new libraries are added).
Hey @ivanov ! That situation on the plane sounds really annoying, sorry about that. You're totally right, what you tried should have worked, and we want folks to be able to use Gleam even when offline.
The good news is that we already have that package cache so this should be not to much work to build.
The network is being used here to ask Hex what the current versions of the packages are so we can determine what versions to use. If the network cannot be reached we could used a cached version of this information instead, while printing a warning to say that package versions may be out-of-date.
We'll need to work out exactly what information to cache, but that should be no major problem.
A good place to start would just be calling dependencies::download
after we generate the template files.
I can look into this after local deps are done.