Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
236e182
install igniter
phyr97 Mar 14, 2025
1ab5cb7
install igniterjs
phyr97 Mar 14, 2025
bbd67df
generate igniter install task
phyr97 Mar 14, 2025
57f0390
reduce info/2 to minimal information
phyr97 Mar 14, 2025
a8874ff
install backpex hooks and add formatter dep
phyr97 Mar 14, 2025
55f63d5
install backpex pubsub server
phyr97 Mar 15, 2025
d3005c6
remove todos
phyr97 Mar 15, 2025
5207980
install backpex_routes in router
phyr97 Mar 15, 2025
17f2ccf
remove only option for added deps in igniter info
phyr97 Mar 16, 2025
3f5b969
install daisyui via npm in backpex installer
phyr97 Mar 16, 2025
dfe0654
generate admin layout within backpex installer
phyr97 Mar 16, 2025
c981c1d
Merge branch 'develop' into feature/backpex-installer
phyr97 Mar 30, 2025
028e374
update igniter
phyr97 Mar 31, 2025
0f7471b
create update_app_css function
phyr97 Mar 31, 2025
e28b0ec
add check for tailwind/forms plugin
phyr97 Mar 31, 2025
069b055
remove unused deps in demo lock
phyr97 Apr 1, 2025
1178921
add floki as dependency for html parsing
phyr97 Apr 1, 2025
e15e45e
check for bg-white in root.html.heex
phyr97 Apr 1, 2025
8cfe36c
write documentation for the task
phyr97 Apr 1, 2025
95b9312
add info hint to installation guide
phyr97 Apr 1, 2025
ccbf40c
remove only option from sourceror
phyr97 Apr 1, 2025
21d90ad
Merge branch 'develop' into feature/backpex-installer
phyr97 Apr 5, 2025
140ba0e
remove semicolon
phyr97 Apr 5, 2025
c540aaf
remove h-full class in body
phyr97 Apr 5, 2025
4158a09
add igniter_js to adds_deps key
phyr97 Apr 5, 2025
2232408
move some functions into a helpers module
phyr97 Apr 6, 2025
7b00f85
fix credo warnings
phyr97 Apr 6, 2025
15a35ba
check for existing router setup
phyr97 Apr 9, 2025
26753af
use alias for igniter and igniter js modules
phyr97 Apr 10, 2025
f4a8682
remove igniter_js from installs
phyr97 Apr 10, 2025
044513d
Add npm package check and update daisyui installation logic
phyr97 Apr 10, 2025
df2cbbc
Improve logging message format in helpers and comment out example sid…
phyr97 Apr 10, 2025
aaafd4b
add sourceror in demo mix to dev and test only
phyr97 Apr 10, 2025
3758dd4
Merge branch 'develop' into feature/backpex-installer
phyr97 Apr 10, 2025
26d4a03
Merge branch 'develop' into feature/backpex-installer
phyr97 May 19, 2025
18d5d82
Update dependencies and fix layout styles
phyr97 May 19, 2025
23b80a4
Merge branch 'develop' into feature/backpex-installer
phyr97 May 28, 2025
035232b
update igniter to 0.6
phyr97 May 28, 2025
474c506
adjust order according to the improved installation docs
phyr97 May 28, 2025
9258be2
make igniter optional
phyr97 May 28, 2025
1006e64
remove "optional" option for igniter and igniter js
phyr97 May 28, 2025
4f3fa2b
Merge branch 'feature/improve-docs' into feature/backpex-installer
phyr97 May 28, 2025
80abb01
improve info text for the installer
phyr97 May 28, 2025
7f02fad
pipe through browser for backpex_routes
phyr97 May 28, 2025
91dfe3f
Merge develop into backpex-installer
phyr97 Jul 21, 2025
5ff04e7
Merge develop into backpex-installer
phyr97 Jul 21, 2025
933e01e
Merge branch 'feature/backpex-installer' of github.com:naymspace/back…
phyr97 Jul 22, 2025
86febf4
check if daisyui preinstalled
phyr97 Jul 22, 2025
131993b
Add Tailwind version compatibility check in backpex installer
phyr97 Jul 23, 2025
ce0ec81
Update igniter_js dependency version in backpex installer to "~> 0.4"
phyr97 Jul 23, 2025
2ad6064
Include version info in Tailwind check result
phyr97 Jul 23, 2025
6f52503
add semicolon to backpex sources
phyr97 Jul 23, 2025
dbbb1e3
Merge branch 'feature/backpex-installer' of github.com:naymspace/back…
phyr97 Jul 24, 2025
b2f3b57
fix spelling and unreachable code
phyr97 Aug 2, 2025
0ae5a73
Merge branch 'develop' into feature/backpex-installer
phyr97 Aug 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion demo/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ defmodule Demo.MixProject do
{:smokestack, "~> 0.9.2"},
{:faker, "~> 0.18"},
{:phoenix_test, "~> 0.7.0", only: :test, runtime: false},
{:sourceror, "~> 1.7", only: [:dev, :test]},
{:phoenix_test_playwright, "~> 0.7.0", only: :test, runtime: false},
{:a11y_audit, "~> 0.2.3", only: :test},
{:live_debugger, "~> 0.3", only: :dev},
Expand Down
12 changes: 12 additions & 0 deletions demo/mix.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion guides/get_started/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Installation

The following guide will help you to install Backpex in your Phoenix application. We will guide you through the installation process and show you how to create a simple resource.
The following guide will help you to install Backpex in your Phoenix application. We will guide you through the installation process and show you how to create a simple resource.

## Prerequisites

Expand All @@ -10,6 +10,10 @@ Backpex integrates seamlessly with your existing Phoenix LiveView application, b

Backpex is built on top of Phoenix LiveView, so you need to have Phoenix LiveView installed in your application. If you generate a new Phoenix application using the latest version of the `mix phx.new` generator, Phoenix LiveView is included by default.

> #### Info {: .info}
>
> We have created an initial version of the [Backpex installer task](Mix.Tasks.Backpex.Install.html), which runs with the help of the [Igniter](https://github.com/ash-project/igniter) framework. This installer automates the upcoming steps up to the "[Create an example resource](installation.html#create-an-example-resource)" step. Feedback is welcome!

### Tailwind CSS

Backpex uses Tailwind CSS for styling. Make sure you have Tailwind CSS installed in your application. You can install Tailwind CSS by following the [official installation guide](https://tailwindcss.com/docs/installation/framework-guides/phoenix). If you generate a new Phoenix application using the latest version of the `mix phx.new` generator, Tailwind CSS is included by default.
Expand Down
91 changes: 91 additions & 0 deletions lib/mix/helpers.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
defmodule Backpex.Mix.Helpers do
@moduledoc """
Helper functions for the Backpex mix tasks.
"""

alias Igniter.Libs.Phoenix
alias Igniter.Project.Application, as: IgniterApp
alias Igniter.Project.Module, as: IgniterModule
alias Igniter.Util.Warning

@doc """
Gets the Phoenix PubSub module from the application configuration.
"""
def pubsub_module(igniter) do
web_module = Phoenix.web_module(igniter)
endpoint_module = Module.safe_concat(web_module, Endpoint)
app_name = IgniterApp.app_name(igniter)

Application.get_env(app_name, endpoint_module)[:pubsub_server]
end

@doc """
Checks if a specific string exists within a module's source code.
"""
def exists_in_module?(igniter, module, line) do
case IgniterModule.find_module(igniter, module) do
{:ok, {igniter, source, _zipper}} ->
{:ok, {igniter, string_in_source?(source, line)}}

{:error, igniter} ->
Mix.shell().warning("Could not find module #{inspect(module)}")
{:error, igniter}
end
end

@doc """
Checks if a specific string exists within a source's content.
"""
def string_in_source?(source, string) do
source
|> Rewrite.Source.get(:content)
|> String.contains?(string)
end

@doc """
Updates a file by adding a line if it doesn't already exist.
"""
def add_line_to_file(igniter, file_path, new_line) do
if Igniter.exists?(igniter, file_path) do
Igniter.update_file(igniter, file_path, &add_line(&1, file_path, new_line))
else
Warning.warn_with_code_sample(
igniter,
"File not found at #{file_path}. Please manually add the following line:",
new_line
)
end
end

defp add_line(source, file_path, line) do
content = Rewrite.Source.get(source, :content)

if String.contains?(content, line) do
Mix.shell().info("'#{line}' already exists in #{file_path}.")
source
else
Rewrite.Source.update(source, :content, content <> "\n#{line}")
end
end

@doc """
Gets the web folder path for the Phoenix application.
"""
def web_folder_path(igniter) do
igniter
|> IgniterApp.app_name()
|> Mix.Phoenix.web_path()
end

@doc """
Checks if an npm package is already installed in the project.
"""
def npm_package_installed?(package_name) do
env = [{"PATH", System.get_env("PATH")}]

case System.cmd("npm", ["list", "--depth=0", package_name], stderr_to_stdout: true, env: env) do
{_output, 0} -> true
{_output, _int} -> false
end
end
end
Loading
Loading