Skip to content

Commit

Permalink
added info log on adding js hooks to app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Sinclair committed May 2, 2024
1 parent b0bcedd commit 958aa35
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/tasks/install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ defmodule Mix.Tasks.Bloom.Install do

File.write!(target_path, source_code)

if File.exists?(js_hook_file) do
component_includes_js? = File.exists?(js_hook_file)

if component_includes_js? do
js_hook_dir = "assets/vendor/hooks"
File.mkdir_p(js_hook_dir)
js_hook_target_path = "#{js_hook_dir}/#{file_name}.js"
Expand All @@ -62,6 +64,12 @@ defmodule Mix.Tasks.Bloom.Install do
Mix.shell().info(
"Don't forget to import the component to your #{project_name |> Macro.underscore()}_web.ex` file."
)

if component_includes_js? do
Mix.shell().info(
"Make sure you import the JS hook in your `app.js` file and add it to the hooks of your Liveview Socket."
)
end
else
Mix.shell().info("Template not found: #{source_file}")
end
Expand Down

0 comments on commit 958aa35

Please sign in to comment.