First, thank you for this project, I love being able to browse the docs for our application!
I ran into an issue where when we have some files with incorrect or missing documentation, edp doesn't list the errors that need to be fixed in the documentation.
In our case it was failed to parse the string that comes back from running elm make
|> stubbing incoming port uiVideoPlayerInbound
|> stubbing outgoing port uiVideoPlayerOutbound
SyntaxError: Unexpected token n in JSON at position 1899
|> writing documentation into docs.json
failed to build project documentation
{"type":"compile-errors","errors":[....the rest of the error json}npm ERR! code 1
npm ERR! path /Users/user/path/to/project/elm-stuff/elm-application-482575LMmitR960sw
npm ERR! command failed
npm ERR! command sh -c elm "make" "--docs=/var/folders/h5/nv96dt4j2rs9rhh4zxq4gjjw0000gn/T/elm-docs-48257qjjrw5ZuSXCo.json" "--report=json"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user/.npm/_logs/2021-03-09T14_51_44_781Z-debug.log
It is those additional npm ERR! strings that cause the parsing to fail, I tweaked the code on that line to strip out anything after npm ERR!, and that seems to solve it.
let replacedStr = build.stderr.toString().replace(/npm ERR! .*/gm, "");
elmErrors(JSON.parse(replacedStr));
First, thank you for this project, I love being able to browse the docs for our application!
I ran into an issue where when we have some files with incorrect or missing documentation,
edp
doesn't list the errors that need to be fixed in the documentation.In our case it was failed to parse the string that comes back from running
elm make
I added some additional logging and it looks like this line is where it is happening: https://github.com/dmy/elm-doc-preview/blob/master/lib/elm-doc-server.ts#L328
In the output in ends up getting something like
It is those additional
npm ERR!
strings that cause the parsing to fail, I tweaked the code on that line to strip out anything afternpm ERR!
, and that seems to solve it.node version: v15.1.0 npm version: 7.5.2 OS: MacOS Catalina 10.15.7