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

Repository names with `.` generate invalid JS #1406

Closed
neoeinstein opened this Issue Jun 3, 2016 · 7 comments

Comments

Projects
None yet
5 participants
@neoeinstein

neoeinstein commented Jun 3, 2016

Given an elm-package.json file like the following:

{
    "version": "1.0.0",
    "summary": "Error reproduction Elm 0.17",
    "repository": "https://github.com/example/error.repro.git",
    "license": "BSD3",
    "source-directories": [
        "src"
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "4.0.0 <= v < 5.0.0",
        "elm-lang/html": "1.0.0 <= v < 2.0.0"
    },
    "elm-version": "0.17.0 <= v < 0.18.0"
}

Elm generates invalid JavaScript:
image
image

In the event of a . in a repository name, Elm should convert it to an underscore as it does in other cases of - in a repository name.

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jun 6, 2016

Member

That would be ambiguous though. tom/this.that would be the same as tom/this-that. Is there a better way to avoid this?

Member

evancz commented Jun 6, 2016

That would be ambiguous though. tom/this.that would be the same as tom/this-that. Is there a better way to avoid this?

@zsiciarz

This comment has been minimized.

Show comment
Hide comment
@zsiciarz

zsiciarz Jul 11, 2016

Ran into a similar problem in my project (https://github.com/zsiciarz/variablestars.net/tree/elm-0.17). The generated JS file contains names like these:

_zsiciarz$variablestars.net$Astronomy$dateToJd
_zsiciarz$variablestars.net$Astronomy$jdToTime

and so on. The actual console error is SyntaxError: missing ; before statement pointing to the first occurence of a variable name like above.

Here's my elm-package.json. Not sure how to fix this though, perhaps there could be a way to set some sort of alias for the project, so that generated identifiers use that instead of the name of the repo?

zsiciarz commented Jul 11, 2016

Ran into a similar problem in my project (https://github.com/zsiciarz/variablestars.net/tree/elm-0.17). The generated JS file contains names like these:

_zsiciarz$variablestars.net$Astronomy$dateToJd
_zsiciarz$variablestars.net$Astronomy$jdToTime

and so on. The actual console error is SyntaxError: missing ; before statement pointing to the first occurence of a variable name like above.

Here's my elm-package.json. Not sure how to fix this though, perhaps there could be a way to set some sort of alias for the project, so that generated identifiers use that instead of the name of the repo?

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jul 15, 2016

Member

Tracking in #1377, thanks for the report!

Member

evancz commented Jul 15, 2016

Tracking in #1377, thanks for the report!

@evancz evancz closed this Jul 15, 2016

zsiciarz added a commit to zsiciarz/variablestars.net that referenced this issue Jan 2, 2017

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jul 14, 2017

Member

In 0.19 it will not be possible to give packages names like this, thereby avoiding the code gen issues and making package names more uniform across the ecosystem.

Member

evancz commented Jul 14, 2017

In 0.19 it will not be possible to give packages names like this, thereby avoiding the code gen issues and making package names more uniform across the ecosystem.

@mfeineis

This comment has been minimized.

Show comment
Hide comment
@mfeineis

mfeineis Nov 25, 2017

I ran into an issue with the no dots in project names approach: I'm currently building a myname.github.io page and this repo has to have the dots in the name for github to use that repo when you're using the simplest approach. See githubs docs on configuring a publishing source on that. Just wanted that to sit in a place other than Slack :-). Thanks for the good work, it's making my life so much more fun.

mfeineis commented Nov 25, 2017

I ran into an issue with the no dots in project names approach: I'm currently building a myname.github.io page and this repo has to have the dots in the name for github to use that repo when you're using the simplest approach. See githubs docs on configuring a publishing source on that. Just wanted that to sit in a place other than Slack :-). Thanks for the good work, it's making my life so much more fun.

@zwilias

This comment has been minimized.

Show comment
Hide comment
@zwilias

zwilias Nov 25, 2017

Member

@mfeineis It's recommended to leave the repository set to the default http://github.com/user/project.git for applications. There is no value to changing it, other than possibly breaking the compiled result 😉 .

There is a bunch of metadata in elm-package.json that only makes sense to change for packages published to the package repository (like version, repo, description, license). If I'm not mistaken, these fields will no longer longer be available in the application descriptor file in Elm 0.19; to prevent this type of confusion.

Member

zwilias commented Nov 25, 2017

@mfeineis It's recommended to leave the repository set to the default http://github.com/user/project.git for applications. There is no value to changing it, other than possibly breaking the compiled result 😉 .

There is a bunch of metadata in elm-package.json that only makes sense to change for packages published to the package repository (like version, repo, description, license). If I'm not mistaken, these fields will no longer longer be available in the application descriptor file in Elm 0.19; to prevent this type of confusion.

@mfeineis

This comment has been minimized.

Show comment
Hide comment
@mfeineis

mfeineis Nov 25, 2017

@zwilias Thank your for the clarification, that's exactly what I did :-). As you guessed the result won't be published on package.elm-lang.org but is for my blog that is currently in migration-to-elm-static-html-lib mode.

mfeineis commented Nov 25, 2017

@zwilias Thank your for the clarification, that's exactly what I did :-). As you guessed the result won't be published on package.elm-lang.org but is for my blog that is currently in migration-to-elm-static-html-lib mode.

zoul added a commit to zoul/bratrskapomoc.cz that referenced this issue Mar 25, 2018

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