Skip to content

Commit

Permalink
Fix mix setup for esbuild and tailwind, closes #5718
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 23, 2024
1 parent 8b71fb3 commit 9426858
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions installer/lib/mix/tasks/phx.new.ex
Expand Up @@ -213,13 +213,13 @@ defmodule Mix.Tasks.Phx.New do
Mix.shell().info([:green, "* running ", :reset, "mix assets.setup"])

# First compile only builders so we can install in parallel
cmd(project, "mix deps.compile castore #{Enum.join(builders, " ")}", false)
cmd(project, "mix deps.compile castore jason #{Enum.join(builders, " ")}", log: false)
end

tasks =
Enum.map(builders, fn builder ->
cmd = "mix do loadpaths --no-compile + #{builder}.install"
Task.async(fn -> cmd(project, cmd, false) end)
Task.async(fn -> cmd(project, cmd, log: false, cd: project.web_path) end)
end)

if rebar_available?() do
Expand Down Expand Up @@ -317,12 +317,14 @@ defmodule Mix.Tasks.Phx.New do

## Helpers

defp cmd(%Project{} = project, cmd, log? \\ true) do
defp cmd(%Project{} = project, cmd, opts \\ []) do
{log?, opts} = Keyword.pop(opts, :log, true)

if log? do
Mix.shell().info([:green, "* running ", :reset, cmd])
end

case Mix.shell().cmd(cmd, cmd_opts(project)) do
case Mix.shell().cmd(cmd, opts ++ cmd_opts(project)) do
0 -> []
_ -> ["$ #{cmd}"]
end
Expand Down

0 comments on commit 9426858

Please sign in to comment.