-
Notifications
You must be signed in to change notification settings - Fork 39
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
Feature: Don't check version if path is present #73
Feature: Don't check version if path is present #73
Conversation
I think we should check the version still, because you want to guarantee all coworkers use the correct one. We would accept a way of setting the version to nil or false, but it may already be supported. |
It doesn't support setting the However, I think I wrote the description wrong because if you set the |
lib/esbuild.ex
Outdated
@@ -65,7 +65,7 @@ defmodule Esbuild do | |||
|
|||
@doc false | |||
def start(_, _) do | |||
unless Application.get_env(:esbuild, :version) do | |||
unless Application.get_env(:esbuild, :version) or Application.get_env(:esbuild, :path) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think or will work here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, fixed
I am worried this will be a breaking change and I also believe the code does not work as you expect. I do t think we should change configured_version() to return anything else other than the configured version. |
I've fixed the code, sorry about that.
I thought about it, and I can't see any breaking changes except the lack of a warning log (which is what I want to achieve with this PR). Without these changes, if you don't set a version, you always get a warning. Now you get a warning only if you don't set a path as well. The other difference is the default version printed in the warning log. But, in my opinion, if you set the path and a version, it's correct that the default version is the bin one. There is no changes in the behaviour of the library as far as I can tell, unless I'm missing something :D |
That's breaking change. Now someone can update the version and a co-worker will still use the old version. As I said, we can have an option to explicitly disable the check, but I don't think we should change the return value of |
There's probably something I'm missing, but when can this happen? There are 3 scenarios, as far as I can tell:
I thought you were concerned about point 3. but in that case, it behaves as before. The value returned by |
But I can see why you wouldn't want to change the behaviour of With my code it doesn't return the "configured" version anymore but something more like a "target" or "desired" version. What do you think about changing the name of that function? |
Hi @josevalim, can I do something to improve this PR? |
This comment is still relevant: #73 (comment) |
Ok so I'll try to add an option to explicitly disable the check. Could |
PR updated. I want to add a test but I don't know how to do it. I thought to download an older version, and then run the |
Please update the docs here and we should be good to go: https://github.com/phoenixframework/esbuild/blob/main/lib/esbuild.ex#L22 |
Updated |
Co-authored-by: José Valim <jose.valim@gmail.com>
💚 💙 💜 💛 ❤️ |
I think checking the existence of the
version
param is redundant when using a path foresbuild
binary. In this case,esbuild
is probably managed with an external package manager (eg.npm
).