Repository: phoenixframework/phoenix
Pull request #4589 (2021-11-10 00:38:34)

Fix link to phoenix javascript files
phoenix.js is no longer in a single js file, it is now a directory of files. Alternatively we could link to the index.js as the entry point but I think linking to the entire directory is easier to navigate from.


Patch:
diff --git a/README.md b/README.md
index 0f6474593..ea76288d7 100644
--- a/README.md
+++ b/README.md
@@ -68,7 +68,6 @@ $ mix archive.build
 ```bash
 $ cd assets
 $ npm install
-$ npm run watch
 ```
 
 ## Important links
diff --git a/guides/real_time/channels.md b/guides/real_time/channels.md
index c3d2662a1..c93968a40 100644
--- a/guides/real_time/channels.md
+++ b/guides/real_time/channels.md
@@ -168,7 +168,7 @@ The following libraries exist today, and new ones are always welcome.
 
 #### Official
 
-Phoenix ships with a JavaScript client that is available when generating a new Phoenix project. The documentation for the JavaScript module is available at [https://hexdocs.pm/phoenix/js/](https://hexdocs.pm/phoenix/js/); the code is in [phoenix.js](https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix.js).
+Phoenix ships with a JavaScript client that is available when generating a new Phoenix project. The documentation for the JavaScript module is available at [https://hexdocs.pm/phoenix/js/](https://hexdocs.pm/phoenix/js/); the code is in [multiple js files](https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix/).
 
 #### 3rd Party
 
diff --git a/priv/templates/phx.gen.channel/channel.ex b/priv/templates/phx.gen.channel/channel.ex
index 4c1cf8215..0f7a9b5e5 100644
--- a/priv/templates/phx.gen.channel/channel.ex
+++ b/priv/templates/phx.gen.channel/channel.ex
@@ -21,7 +21,7 @@ defmodule <%= module %>Channel do
   # broadcast to everyone in the current topic (<%= singular %>:lobby).
   @impl true
   def handle_in("shout", payload, socket) do
-    broadcast socket, "shout", payload
+    broadcast(socket, "shout", payload)
     {:noreply, socket}
   end
 


Test patch:
diff --git a/priv/templates/phx.gen.channel/channel_test.exs b/priv/templates/phx.gen.channel/channel_test.exs
index 6fc15ebde..7698d8700 100644
--- a/priv/templates/phx.gen.channel/channel_test.exs
+++ b/priv/templates/phx.gen.channel/channel_test.exs
@@ -11,17 +11,17 @@ defmodule <%= module %>ChannelTest do
   end
 
   test "ping replies with status ok", %{socket: socket} do
-    ref = push socket, "ping", %{"hello" => "there"}
+    ref = push(socket, "ping", %{"hello" => "there"})
     assert_reply ref, :ok, %{"hello" => "there"}
   end
 
   test "shout broadcasts to <%= singular %>:lobby", %{socket: socket} do
-    push socket, "shout", %{"hello" => "all"}
+    push(socket, "shout", %{"hello" => "all"})
     assert_broadcast "shout", %{"hello" => "all"}
   end
 
   test "broadcasts are pushed to the client", %{socket: socket} do
-    broadcast_from! socket, "broadcast", %{"some" => "data"}
+    broadcast_from!(socket, "broadcast", %{"some" => "data"})
     assert_push "broadcast", %{"some" => "data"}
   end
 end
diff --git a/test/mix/tasks/phx.gen.auth_test.exs b/test/mix/tasks/phx.gen.auth_test.exs
index 962bc4a18..732eb9937 100644
--- a/test/mix/tasks/phx.gen.auth_test.exs
+++ b/test/mix/tasks/phx.gen.auth_test.exs
@@ -545,7 +545,7 @@ defmodule Mix.Tasks.Phx.Gen.AuthTest do
     end
   end
 
-  test "supports --binary_id option", config do
+  test "supports --binary-id option", config do
     in_tmp_phx_project(config.test, fn ->
       Gen.Auth.run(
         ~w(Accounts User users --binary-id),
diff --git a/test/mix/tasks/phx.gen.channel_test.exs b/test/mix/tasks/phx.gen.channel_test.exs
index c21f7c581..fb1fa7365 100644
--- a/test/mix/tasks/phx.gen.channel_test.exs
+++ b/test/mix/tasks/phx.gen.channel_test.exs
@@ -27,7 +27,7 @@ defmodule Mix.Tasks.Phx.Gen.ChannelTest do
         assert file =~ ~S|def handle_in("ping", payload, socket) do|
         assert file =~ ~S|{:reply, {:ok, payload}, socket}|
         assert file =~ ~S|def handle_in("shout", payload, socket) do|
-        assert file =~ ~S|broadcast socket, "shout", payload|
+        assert file =~ ~S|broadcast(socket, "shout", payload)|
         assert file =~ ~S|{:noreply, socket}|
       end)
 
@@ -38,15 +38,15 @@ defmodule Mix.Tasks.Phx.Gen.ChannelTest do
         assert file =~ ~S|> subscribe_and_join(PhoenixWeb.RoomChannel|
 
         assert file =~ ~S|test "ping replies with status ok"|
-        assert file =~ ~S|ref = push socket, "ping", %{"hello" => "there"}|
+        assert file =~ ~S|ref = push(socket, "ping", %{"hello" => "there"})|
         assert file =~ ~S|assert_reply ref, :ok, %{"hello" => "there"}|
 
         assert file =~ ~S|test "shout broadcasts to room:lobby"|
-        assert file =~ ~S|push socket, "shout", %{"hello" => "all"}|
+        assert file =~ ~S|push(socket, "shout", %{"hello" => "all"})|
         assert file =~ ~S|assert_broadcast "shout", %{"hello" => "all"}|
 
         assert file =~ ~S|test "broadcasts are pushed to the client"|
-        assert file =~ ~S|broadcast_from! socket, "broadcast", %{"some" => "data"}|
+        assert file =~ ~S|broadcast_from!(socket, "broadcast", %{"some" => "data"})|
         assert file =~ ~S|assert_push "broadcast", %{"some" => "data"}|
       end)
     end)