Skip to content

A live Elm cache is required in offline mode #399

Description

@dwayne

When I add this patch and try to run elm-review in this version of elm2nix I get the following error:

example> I could not fetch all the data I need about these dependencies of your project:
example> - elm/browser 1.0.2
example> - elm/url 1.0.0
example>
example> Connect to the Internet so I can download and cache the data for future uses.
example> I will try to review the project anyway, but you might get unexpected results

I ran nix build .#reviewedExample -L --keep-failed and checked the Elm cache that I created and I noticed that both elm/browser 1.0.2 and elm/url 1.0.0 were missing docs.json.

I found an old Discourse post where this same issue was experienced but their solutions don't explain why the docs.json issue gets resolved so I did some investigation of my own.

When is docs.json created?

It is created during an elm make. See builder/src/Elm/Details.hs, in particular:

What ultimately calls writeDocs?

  • load -> generate -> verifyApp -> verifyDependencies -> verifyDep -> build -> writeDocs
  • load is used by make, repl, and reactor

A way forward

Here's what I've learned:

  1. elm make generates various files in the Elm cache as it does its thing
  2. One of them is docs.json
  3. If I let elm make run before I run elm-review then the various files are populated in the Elm cache as required by elm-review
  4. In addition, I need the lock file to include all dependencies from both elm.json and review/elm.json

When I follow 3 & 4, it works. See this commit.

What's a live Elm cache?

I'm calling a live Elm cache an Elm cache in which elm make was run at least once on it. All the reachable dependencies would have artifacts.dat, docs.json, and whatever other files that the compiler generates at build time.

What to do with this issue?

I found a solution to my original problem and will be moving forward with my work around but I'm not sure what you'd want to do with this information, if anything. Please feel free to close this issue if there's nothing that can be done by this project.

Out of curiosity, why is docs.json required?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions