Add tasks to update esbuild version

This commit is contained in:
Claudio Ortolina
2025-05-27 14:49:24 +01:00
parent a1baa10e88
commit c0ef2038e7
4 changed files with 103 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
defmodule Mix.Tasks.Esbuild.CheckVersion do
use Mix.Task
@shortdoc "Checks the the current Esbuild version is the latest"
@moduledoc """
Checks the the current esbuild version is the latest.
Exits with 0 if versions match, 1 if the esbuild needs to be updated.
"""
alias Mix.Tasks.Esbuild.Release
@impl Mix.Task
def run(_args) do
current_version = Release.fetch_current_version()
latest_version = Release.fetch_latest_version!()
if current_version !== latest_version do
Mix.Shell.IO.info(
"A new esbuild version is available: #{current_version} ==> #{latest_version}"
)
System.halt(1)
else
Mix.Shell.IO.info("The esbuild version is up to date (#{current_version})")
end
end
end