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:
elm make generates various files in the Elm cache as it does its thing
- One of them is
docs.json
- 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
- 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?
When I add this patch and try to run
elm-reviewin this version ofelm2nixI get the following error:I ran
nix build .#reviewedExample -L --keep-failedand checked the Elm cache that I created and I noticed that bothelm/browser 1.0.2andelm/url 1.0.0were missingdocs.json.I found an old Discourse post where this same issue was experienced but their solutions don't explain why the
docs.jsonissue gets resolved so I did some investigation of my own.When is
docs.jsoncreated?It is created during an
elm make. Seebuilder/src/Elm/Details.hs, in particular:writeDocswriteDocsimplementationWhat ultimately calls
writeDocs?load -> generate -> verifyApp -> verifyDependencies -> verifyDep -> build -> writeDocsloadis used by make, repl, and reactorA way forward
Here's what I've learned:
elm makegenerates various files in the Elm cache as it does its thingdocs.jsonelm makerun before I runelm-reviewthen the various files are populated in the Elm cache as required byelm-reviewelm.jsonandreview/elm.jsonWhen 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 makewas run at least once on it. All the reachable dependencies would haveartifacts.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.jsonrequired?