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

plugin authors discussion w/rt 0.8.0 release #522

Closed
avh4 opened this issue Aug 21, 2018 · 9 comments
Closed

plugin authors discussion w/rt 0.8.0 release #522

avh4 opened this issue Aug 21, 2018 · 9 comments

Comments

@avh4
Copy link
Owner

avh4 commented Aug 21, 2018

From #519, @kachkaev says:

Glad to see 0.8.0-rc3 @avh4! Given that elm 0.19 has been just released, I'm wondering how to proceed with upgrading prettier-plugin-elm, which depends on elm-format.

How soon are you expecting 0.8.0 to go out? Shall I wait for this release or just bump prettier-plugin-elm with an RC?

Am I right in the assumption that [email protected] still supports Elm 0.18?

@avh4 avh4 added this to the 0.8.0 public beta (and Elm 0.19) milestone Aug 21, 2018
@kachkaev kachkaev mentioned this issue Aug 21, 2018
Merged
@avh4
Copy link
Owner Author

avh4 commented Aug 21, 2018

I'm planning to release 0.8.0 today.

The npm install elm-format will install the Elm 0.19 version. There will be binaries to download for both the 0.19 and 0.18 version. However, regardless of which binaries you use, all binaries support Elm 0.19, 0.18 and 0.17 if you use the --elm-version=... flag.

Let me know if anything seems strange from the perspective of plugin authors.

@avh4 avh4 changed the title 0.8.0 release plans and plugin upgrades plugin authors discussion w/rt 0.8.0 release Aug 21, 2018
@kachkaev
Copy link

kachkaev commented Aug 21, 2018

In the case of prettier-plugin-elm, elm-format dependency is a hard-link and its version is locked. This is intentional to simplify installation and to avoid compatibility issues.

Prettier plugins can be installed locally for a given project or globally using npm install -g / yarn global add, so there can be multiple sets of prettier plugins on a single machine. The same applies to elm binaries: there can be a local project-scoped elm and a global elm installed at the same time; their versions may differ.

Since you are mentioning --elm-version=... flag, it may be hypothetically possible for prettier-plugin-elm, to check the current version of elm and spoon-feed it to elm-format. But this makes things hard because elm-format can be given a wrong version of elm depending on the look of PATH (running ./node_modules/.bin/prettier ... and yarn prettier ... can give different results). Because of this intricate relationship, I'm inclined not to use --elm-version=... flag at all and am wondering how likely [email protected] will break elm files written for [email protected]. Should I recommend users of prettier-plugin-elm to install an upcoming version only if they have have switched to the new elm? In this case I guess I'll need to maintain two versions of the prettier-plugin-elm until elm 0.19 is used by pretty much everyone.

PS: Prettier users are not allowed to pass options CLI down to plugins. This can be bypassed by the use of environment variables, but such a hidden way of configuring things seems a more of an evil than help.

@avh4
Copy link
Owner Author

avh4 commented Aug 21, 2018

I believe the only thing the 0.19 version will break for 0.18 code is that it changes escaped characters in strings to the new \u{xxxx} format, which 0.18 can't parse.

I'm not really sure what's best for dealing with people using both 0.18 and 0.19...

  • I guess I could publish both the versions on npm.. either with different package names, or with different tags. But I'm not sure if that would really help in your case, since you need to depend on the right version?
  • elm-format could try to auto-detect the correct version to use. I'd like to eventually try to do that anyway, but I'm not sure it would be easy. More details here: auto-detect the correct Elm version #523

I'm not really sure what's best here. Maybe it is best just for people not to upgrade elm-format and related plugins until they move to Elm 0.19? That doesn't really seem like a good solution either.

@avh4
Copy link
Owner Author

avh4 commented Aug 22, 2018

I think it's best to do the 0.8.0 release tonight, so I'm moving this discussion to the 0.8.1 milestone.

@avh4
Copy link
Owner Author

avh4 commented Sep 5, 2018

@kachkaev what did you end up recommending for prettier-plugin-elm users? Do you know what the experience of your plugin users has been with Elm 0.19 so far?

@avh4
Copy link
Owner Author

avh4 commented Sep 5, 2018

One thing I've been considering is to say that plugins should prefer using ./node_modules/.bin/elm-format if it exists in the current project, which would allow users to install the appropriate version locally with npm. Would an option like that align with the philosophy of prettier?

@kachkaev
Copy link

kachkaev commented Sep 5, 2018

Hi @avh4! I have not looked into upgrading to 0.8.0 so far due to lack of time, but I hope I'll do this in the next few weeks. Feel free to ping and poke me if I disappear again 😅

In terms of using local elm-format: prettier-plugin-elm has got a hard dependency on elm-format, which gets automatically installed in the same place as the plugin. But this does not mean you cannot have multiple versions – there can be a project-specific prettier with a local prettier-plugin-elm version A and a global prettier with a global plugin version B, which depends on a different elm-format. I was thinking o loosing the dependency originally, but decided not to do so in the end. The reason is that we're applying couple of formatting hacks to support fragments, and these may break if the version of prettier-format is not predictable.

@kachkaev
Copy link

kachkaev commented Sep 17, 2018

I upgraded elm-format in prettier-plugin-elm this weekend and released a couple of RCs. I'll go for supporting 0.19 only, because elm.json may not exist in the context of markdown code blocks. Once there is a decision on #551, I guess I'll be able to make the new version stable.

UPD: actually, I'd better wait for [email protected]

@avh4
Copy link
Owner Author

avh4 commented Oct 7, 2018

Implemented in 0.8.1. (plugins should pass --elm-version=..., or run elm-format from the directory containing elm.json/elm-package.json)

Also, created #561 to slightly improve things more in 0.8.2. (should allow any plugins that use --yes (and not --stdin) to not need to pass --elm-version=...)

@avh4 avh4 closed this as completed Oct 7, 2018
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