Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elm upgrade placing broken version number in elm.json #94

Open
Muzz opened this issue Mar 28, 2021 · 3 comments
Open

Elm upgrade placing broken version number in elm.json #94

Muzz opened this issue Mar 28, 2021 · 3 comments

Comments

@Muzz
Copy link

Muzz commented Mar 28, 2021

Finally getting around to seeing if i can update an old project of mine. And for some reason the elm.json that is getting generated has a carriage return in it. This is on windows 10 with the latest elm-format, and elm, with the latest elm-upgrade.

Assistance would be appreciated.

`C:\GITHUB\PrismaPalette\gamut-commander\html>npx elm-upgrade@latest
INFO: Found elm at node_modules.bin\elm.CMD
INFO: Found elm 0.19.1
INFO: Found elm-format at node_modules.bin\elm-format.CMD
INFO: Found elm-format 0.8.5
INFO: Cleaning ./elm-stuff before upgrading
INFO: Converting elm-package.json -> elm.json
INFO: Detected an application project (this project has no exposed modules)
WARNING: MichaelCombs28/elm-mdl has not been upgraded to 0.19 yet!
INFO: Installing latest version of debois/elm-dom
-- PROBLEM WITH VERSION ----------------------------------------------- elm.json

I got stuck while reading your elm.json file. I was expecting a version number
here:

8| "elm-version": "0.19.1\r",
^
I need something like "1.0.0" or "2.0.4" that explicitly states all three
numbers!

WARNING: Failed to upgrade debois/elm-dom!
INFO: Switching from elm-community/linear-algebra (deprecated) to elm-explorations/linear-algebra
INFO: Installing latest version of elm-explorations/linear-algebra`

@avh4
Copy link
Owner

avh4 commented Mar 28, 2021

Huh, that's interesting. I'm guessing it's due to nodejs automatic newline conversion? I'd think it'd have to be this line where things go wrong https://github.com/avh4/elm-upgrade/blob/master/upgrade.js#L130 Does fs.writeFileSync and/or JSON.stringify insert \r on Windows? If we could update that function to not do that, I'd think that should fix things.

@avh4
Copy link
Owner

avh4 commented Mar 28, 2021

Ah, I realized what I just wrote is probably wrong. It's more likely that the problem is here https://github.com/avh4/elm-upgrade/blob/master/upgrade.js#L175 we need to strip out the \r when parsing the version number from elm --version.

@Muzz
Copy link
Author

Muzz commented Mar 28, 2021

Thanks for looking into that so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants