dillonkearns / elm-typescript-interop

Generate TypeScript declaration files for your elm ports!
BSD 3-Clause "New" or "Revised" License
165 stars 13 forks source link

Parse failure #9

Closed sporto closed 6 years ago

sporto commented 6 years ago

Hi I tried to run this but got what appears to be a parsing failure. I have pasted the output here https://paste.ee/p/TvYVi

The project I used is available here https://github.com/sporto/save-up/tree/master/client

Thanks

dillonkearns commented 6 years ago

Hey @sporto, thank you for reporting the issue! It turns out your project still has an elm-package.json file, and the logic I had was checking for elm-package.json before elm.json. It's working now!

https://github.com/dillonkearns/elm-typescript-interop/blob/master/CHANGELOG.md#007---2018-09-13

sporto commented 6 years ago

Hi Dillon

Unfortunately this didn't fix the issue for me. I removed elm-package and update this node module. Then ran again. I see this https://paste.ee/p/TbTtw

Thanks

dillonkearns commented 6 years ago

Hey @sporto, that's interesting, it works for me in my cloned version of the code.

It appears that the error you're encountering is happening because it's finding the module Test.Basics, which I see in the node_modules folder in my cloned down repo after I npm install. I'm not sure why your version would be looking in that directory, though, since the only source-directory you have listed is "src".

For reference, here's the path where I see it: save-up/client/node_modules/elm-webpack-loader/test/fixtures/elm-stuff/packages/elm-lang/core/5.0.0/tests/Test/Basics.elm

Can you do an ls of your client/src folder for me so I can see if there is either an elm-stuff or a node_modules folder (or any other directories that are in the .gitignore and contain .elm files).

I'm trying to figure out how to have it ignore folders like elm-stuff and node_modules when it's scanning through those folders.

dillonkearns commented 6 years ago

I just pushed a new version that will have better error messages for elm-ast parsing errors, as well. Hopefully that makes it a little easier to debug the issue.

For reference, the reason it is getting syntax errors on those files is because there are some bugs with the elm-ast packages out there. I just switched over from Bogdanp/elm-ast to tunguski/elm-ast because the Bogdanp one had some pretty basic errors that tunguski seemed to fix (for example, it was failing to parse when there were comments within function bodies). But certain files that have really gnarly syntax it seems to fail to parse still.

sporto commented 6 years ago

I had a folder elm-stuff inside src. Probably created when using the repl in Elm 0.18. After deleting this folder it worked.

Thanks for the help

dillonkearns commented 6 years ago

Yeah, that makes perfect sense. I definitely want the CLI to be robust enough to "just work". I went ahead and published a new version that ignores any folders within the source-directories that are named either elm-stuff or node_modules.

Thanks for reporting all the details, that's super helpful 👍