From 26ed919a8f79412ee682215cf3d3ce3cbbd774d4 Mon Sep 17 00:00:00 2001 From: karimsemmoud Date: Thu, 11 Jun 2026 09:31:42 +0700 Subject: [PATCH 1/6] Widen phoenix_live_view constraint to ~> 1.1 --- e2e/mix.exs | 2 +- integration_test/mix.exs | 2 +- mix.exs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/mix.exs b/e2e/mix.exs index 4b6535a1..9f57cb52 100644 --- a/e2e/mix.exs +++ b/e2e/mix.exs @@ -61,7 +61,7 @@ defmodule E2e.MixProject do {:phoenix_html, "~> 4.1"}, {:phoenix_live_reload, "~> 1.2", only: :dev}, {:phoenix_live_dashboard, "~> 0.8.3"}, - {:phoenix_live_view, "~> 1.1.0"}, + {:phoenix_live_view, "~> 1.1"}, {:live_capture, "~> 0.2"}, {:lazy_html, ">= 0.1.0", only: :test}, {:esbuild, "~> 0.10", runtime: Mix.env() == :dev}, diff --git a/integration_test/mix.exs b/integration_test/mix.exs index a9968ea8..7d72ef34 100644 --- a/integration_test/mix.exs +++ b/integration_test/mix.exs @@ -44,7 +44,7 @@ defmodule Corex.Integration.MixProject do {:postgrex, ">= 0.0.0"}, {:ecto_sqlite3, ">= 0.0.0"}, {:phoenix_html, "~> 4.1"}, - {:phoenix_live_view, "~> 1.1.0"}, + {:phoenix_live_view, "~> 1.1"}, {:dns_cluster, "~> 0.2.0"}, {:lazy_html, ">= 0.1.0"}, {:phoenix_live_reload, "~> 1.2"}, diff --git a/mix.exs b/mix.exs index 9df47608..fd142325 100644 --- a/mix.exs +++ b/mix.exs @@ -55,7 +55,7 @@ defmodule Corex.MixProject do [ {:jason, "~> 1.0"}, {:phoenix, "~> 1.8.1"}, - {:phoenix_live_view, "~> 1.1.0"}, + {:phoenix_live_view, "~> 1.1"}, {:gettext, "~> 1.0"}, {:esbuild, "~> 0.8", only: [:dev, :test], runtime: false}, {:ex_doc, "~> 0.40", only: [:dev, :docs], runtime: false}, From ca4cdb9bdc02e83255c11a01abb01dfc8801c20b Mon Sep 17 00:00:00 2001 From: karimsemmoud Date: Thu, 11 Jun 2026 10:02:52 +0700 Subject: [PATCH 2/6] Fix CI fallout from Live View widen --- installer/lib/corex_new/patches.ex | 12 +++++++ installer/test/patches_test.exs | 58 ++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/installer/lib/corex_new/patches.ex b/installer/lib/corex_new/patches.ex index 287f6326..927517c8 100644 --- a/installer/lib/corex_new/patches.ex +++ b/installer/lib/corex_new/patches.ex @@ -151,6 +151,7 @@ defmodule Corex.New.Patches do |> maybe_add_corex_generators_config(opts) |> maybe_add_designex_config(opts) |> patch_esbuild_for_esm() + |> patch_env_path_lists() write_if_changed!(path, content, updated) end @@ -750,6 +751,17 @@ defmodule Corex.New.Patches do end end + defp patch_env_path_lists(content) do + Regex.replace( + ~r/"NODE_PATH"\s*=>\s*\[([^\]]+)\]/u, + content, + fn _, inner -> + paths = inner |> String.split(",") |> Enum.map(&String.trim/1) + ~s/"NODE_PATH" => Enum.join([#{Enum.join(paths, ", ")}], ":")/ + end + ) + end + defp patch_esbuild_for_esm(content) do cond do String.contains?(content, "--format=esm") -> diff --git a/installer/test/patches_test.exs b/installer/test/patches_test.exs index 75fe5f03..8926b033 100644 --- a/installer/test/patches_test.exs +++ b/installer/test/patches_test.exs @@ -685,6 +685,64 @@ defmodule Corex.New.PatchesTest do end) end + test "joins NODE_PATH env lists for tailwind and esbuild on Elixir 1.18" do + in_tmp(:patch_config_node_path, fn -> + File.mkdir_p!("config") + File.write!("config/config.exs", @stock_config_exs) + + Patches.patch_config_exs(File.cwd!(), otp_app: :my_app) + body = File.read!("config/config.exs") + + assert body =~ + ~s|"NODE_PATH" => Enum.join([Path.expand("../deps", __DIR__), Mix.Project.build_path()], ":")| + + refute body =~ + ~s|"NODE_PATH" => [Path.expand("../deps", __DIR__), Mix.Project.build_path()]| + end) + end + + test "leaves NODE_PATH unchanged when already a string" do + in_tmp(:patch_config_node_path_string, fn -> + File.mkdir_p!("config") + + config = """ + import Config + + config :esbuild, + version: "0.25.4", + my_app: [ + args: ~w(js/app.js --bundle), + cd: Path.expand("../assets", __DIR__), + env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)} + ] + + import_config "#{"#"}{config_env()}.exs" + """ + + File.write!("config/config.exs", config) + Patches.patch_config_exs(File.cwd!(), otp_app: :my_app) + body = File.read!("config/config.exs") + + assert body =~ ~s|"NODE_PATH" => Path.expand("../deps", __DIR__)| + refute body =~ "Enum.join" + end) + end + + test "NODE_PATH list patch is idempotent" do + in_tmp(:patch_config_node_path_idempotent, fn -> + File.mkdir_p!("config") + File.write!("config/config.exs", @stock_config_exs) + + Patches.patch_config_exs(File.cwd!(), otp_app: :my_app) + Patches.patch_config_exs(File.cwd!(), otp_app: :my_app) + body = File.read!("config/config.exs") + + assert length(Regex.scan(~r/"NODE_PATH"\s*=>/u, body)) == 1 + assert body =~ "Enum.join" + refute body =~ ~s|"NODE_PATH" => [Path.expand("../deps", __DIR__), Mix.Project.build_path()]| + end) + end + test "skips themes config when themes key already exists" do in_tmp(:patch_config_themes_present, fn -> File.mkdir_p!("config") From ddb19582c22451397b6408317905a4c1ce0296c4 Mon Sep 17 00:00:00 2001 From: karimsemmoud Date: Thu, 11 Jun 2026 10:03:52 +0700 Subject: [PATCH 3/6] fix(file-upload): drop live_img_preview sizing attrs --- lib/components/file_upload_live.ex | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/components/file_upload_live.ex b/lib/components/file_upload_live.ex index cb88d38c..0fe074e7 100644 --- a/lib/components/file_upload_live.ex +++ b/lib/components/file_upload_live.ex @@ -262,8 +262,6 @@ defmodule Corex.FileUploadLive do entry={entry} data-scope="file-upload" data-part="item-preview-image" - width="40" - height="40" /> From 7a7900670d996a0af761999966e88cd19cc5fbf0 Mon Sep 17 00:00:00 2001 From: karimsemmoud Date: Thu, 11 Jun 2026 10:09:03 +0700 Subject: [PATCH 4/6] mix lint --- installer/test/patches_test.exs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/installer/test/patches_test.exs b/installer/test/patches_test.exs index 8926b033..25cb0af4 100644 --- a/installer/test/patches_test.exs +++ b/installer/test/patches_test.exs @@ -739,7 +739,9 @@ defmodule Corex.New.PatchesTest do assert length(Regex.scan(~r/"NODE_PATH"\s*=>/u, body)) == 1 assert body =~ "Enum.join" - refute body =~ ~s|"NODE_PATH" => [Path.expand("../deps", __DIR__), Mix.Project.build_path()]| + + refute body =~ + ~s|"NODE_PATH" => [Path.expand("../deps", __DIR__), Mix.Project.build_path()]| end) end From fb6185cdaf62fcb9c209c7773e3efec7eff6151d Mon Sep 17 00:00:00 2001 From: karimsemmoud Date: Thu, 11 Jun 2026 10:11:53 +0700 Subject: [PATCH 5/6] dev(CI): add integration test for previous phx_new version --- .github/workflows/elixir.yml | 19 +++++++++++++++++-- integration_test/README.md | 4 ++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index d0252f5c..6c7a0244 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -379,7 +379,7 @@ jobs: unzip -l /tmp/corex_new_archive_check.ez | grep -q 'priv/corex_design/corex/' || (echo 'missing priv/corex_design in archive'; exit 1) integration-tests: - name: Integration tests (OTP ${{ matrix.otp }} | Elixir ${{ matrix.elixir }}) + name: Integration tests (${{ matrix.phx_new_label }}) runs-on: ubuntu-24.04 strategy: @@ -387,10 +387,20 @@ jobs: include: - elixir: 1.17.3 otp: 26.2.5.2 + phx_new_version: "" + phx_new_label: "OTP 26 | Elixir 1.17 | phx_new latest" - elixir: 1.18.4 otp: 27.3 + phx_new_version: "" + phx_new_label: "OTP 27 | Elixir 1.18 | phx_new latest" + - elixir: 1.18.4 + otp: 27.3 + phx_new_version: "1.8.4" + phx_new_label: "OTP 27 | Elixir 1.18 | phx_new 1.8.4" - elixir: 1.18.4 otp: 28.0.1 + phx_new_version: "" + phx_new_label: "OTP 28 | Elixir 1.18 | phx_new latest" services: postgres: @@ -441,7 +451,12 @@ jobs: mix archive.install corex_new.ez --force - name: Install Mix archives for corex.new (phx_new) - run: mix archive.install hex phx_new --force + run: | + if [ -n "${{ matrix.phx_new_version }}" ]; then + mix archive.install hex phx_new ${{ matrix.phx_new_version }} --force + else + mix archive.install hex phx_new --force + fi - name: Run integration tests (fast) working-directory: integration_test diff --git a/integration_test/README.md b/integration_test/README.md index 9349d1ff..ef7f019c 100644 --- a/integration_test/README.md +++ b/integration_test/README.md @@ -7,6 +7,10 @@ This project contains integration tests for Phoenix-generated projects and Corex CI (`.github/workflows/elixir.yml`) installs **`phx_new`** and locally built **`corex_new`**, then runs, in order: +The matrix runs **latest** `phx_new` on OTP 26 / 27 / 28, plus a **pinned `phx_new 1.8.4`** row on OTP 27 +and Elixir 1.18 (aligned with `installer/mix.exs` `@phoenix_version`) so `corex.new` stays compatible with +older Phoenix installers as well as current Hex releases. + 1. **`mix test`** - matches local default; `test_helper.exs` sets `exclude: [:database]`, so untagged work runs here. 2. **`mix test --include database:postgresql`** - uses the job’s **Postgres 15** service on **localhost:5432** (`PGHOST`, `PGUSER`, `PGPASSWORD`, `PGPORT`, `DATABASE_URL` set in the workflow). From 31d1796bd5cc800e4380ec87933634a3fe326bea Mon Sep 17 00:00:00 2001 From: karimsemmoud Date: Thu, 11 Jun 2026 11:04:25 +0700 Subject: [PATCH 6/6] dev(CI): Update test names and added full pinned version matrix --- .github/workflows/elixir.yml | 20 ++++++++++++++------ integration_test/README.md | 6 +++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index 6c7a0244..47020289 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -379,7 +379,7 @@ jobs: unzip -l /tmp/corex_new_archive_check.ez | grep -q 'priv/corex_design/corex/' || (echo 'missing priv/corex_design in archive'; exit 1) integration-tests: - name: Integration tests (${{ matrix.phx_new_label }}) + name: Integration tests (OTP ${{ matrix.otp }} | Elixir ${{ matrix.elixir }}${{ matrix.phx_new_suffix }}) runs-on: ubuntu-24.04 strategy: @@ -388,19 +388,27 @@ jobs: - elixir: 1.17.3 otp: 26.2.5.2 phx_new_version: "" - phx_new_label: "OTP 26 | Elixir 1.17 | phx_new latest" + phx_new_suffix: "" - elixir: 1.18.4 otp: 27.3 phx_new_version: "" - phx_new_label: "OTP 27 | Elixir 1.18 | phx_new latest" + phx_new_suffix: "" + - elixir: 1.18.4 + otp: 28.0.1 + phx_new_version: "" + phx_new_suffix: "" + - elixir: 1.17.3 + otp: 26.2.5.2 + phx_new_version: "1.8.4" + phx_new_suffix: " | phx_new 1.8.4" - elixir: 1.18.4 otp: 27.3 phx_new_version: "1.8.4" - phx_new_label: "OTP 27 | Elixir 1.18 | phx_new 1.8.4" + phx_new_suffix: " | phx_new 1.8.4" - elixir: 1.18.4 otp: 28.0.1 - phx_new_version: "" - phx_new_label: "OTP 28 | Elixir 1.18 | phx_new latest" + phx_new_version: "1.8.4" + phx_new_suffix: " | phx_new 1.8.4" services: postgres: diff --git a/integration_test/README.md b/integration_test/README.md index ef7f019c..6db44fde 100644 --- a/integration_test/README.md +++ b/integration_test/README.md @@ -7,9 +7,9 @@ This project contains integration tests for Phoenix-generated projects and Corex CI (`.github/workflows/elixir.yml`) installs **`phx_new`** and locally built **`corex_new`**, then runs, in order: -The matrix runs **latest** `phx_new` on OTP 26 / 27 / 28, plus a **pinned `phx_new 1.8.4`** row on OTP 27 -and Elixir 1.18 (aligned with `installer/mix.exs` `@phoenix_version`) so `corex.new` stays compatible with -older Phoenix installers as well as current Hex releases. +The matrix runs **latest** `phx_new` on each OTP / Elixir row, then repeats all three rows with **pinned +`phx_new 1.8.4`** (aligned with `installer/mix.exs` `@phoenix_version`) so `corex.new` stays compatible +with older Phoenix installers as well as current Hex releases. 1. **`mix test`** - matches local default; `test_helper.exs` sets `exclude: [:database]`, so untagged work runs here. 2. **`mix test --include database:postgresql`** - uses the job’s **Postgres 15** service on **localhost:5432**