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

Feature: Don't check version if path is present #73

Merged
merged 9 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Config

config :esbuild,
version: "0.17.11",
version: "0.23.0",
another: [
args: ["--version"]
]
44 changes: 25 additions & 19 deletions lib/esbuild.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Esbuild do
# https://registry.npmjs.org/esbuild/latest
@latest_version "0.17.11"
@latest_version "0.23.0"

@moduledoc """
Esbuild is an installer and runner for [esbuild](https://esbuild.github.io).
Expand All @@ -21,10 +21,14 @@ defmodule Esbuild do

## Esbuild configuration

There are two global configurations for the esbuild application:
There are four global configurations for the esbuild application:

* `:version` - the expected esbuild version

* `:version_check` - whether to perform the version check or not.
Useful when you manage the esbuild executable with an external
tool (eg. npm)

* `:cacerts_path` - the directory to find certificates for
https connections

Expand Down Expand Up @@ -65,28 +69,30 @@ defmodule Esbuild do

@doc false
def start(_, _) do
unless Application.get_env(:esbuild, :version) do
Logger.warning("""
esbuild version is not configured. Please set it in your config files:
if Application.get_env(:esbuild, :version_check, true) do
unless Application.get_env(:esbuild, :version) do
Logger.warning("""
esbuild version is not configured. Please set it in your config files:

config :esbuild, :version, "#{latest_version()}"
""")
end
config :esbuild, :version, "#{latest_version()}"
""")
end

configured_version = configured_version()
configured_version = configured_version()

case bin_version() do
{:ok, ^configured_version} ->
:ok
case bin_version() do
{:ok, ^configured_version} ->
:ok

{:ok, version} ->
Logger.warning("""
Outdated esbuild version. Expected #{configured_version}, got #{version}. \
Please run `mix esbuild.install` or update the version in your config files.\
""")
{:ok, version} ->
Logger.warning("""
Outdated esbuild version. Expected #{configured_version}, got #{version}. \
Please run `mix esbuild.install` or update the version in your config files.\
""")

:error ->
:ok
:error ->
:ok
end
end

Supervisor.start_link([], strategy: :one_for_one, name: __MODULE__.Supervisor)
Expand Down
Loading