Current section
Files
Jump to
Current section
Files
lib/needle_new/generators/shared.ex
defmodule Needle.New.Generators.Shared do
@moduledoc false
use Needle.New.Generator
alias Needle.New.Project
template(:ctx_base_single, [
{:ctx_app, :eex, "needle_single/lib/<ctx_lib>/supervisor.ex"}
])
template(:ctx_base_umbrella, [
{:root_app, :eex, "needle_umbrella/apps/<ctx_app>/README.md"},
{:root_app, :eex, "needle_umbrella/apps/<ctx_app>/mix.exs"},
{:root_app, :eex, "needle_umbrella/apps/<ctx_app>/formatter.exs", filename: ".formatter.exs"},
{:root_app, :eex, "needle_umbrella/apps/<ctx_app>/gitignore", filename: ".gitignore"},
{:root_app, :eex, "needle_umbrella/apps/<ctx_app>/lib/<ctx_lib>/application.ex"},
{:root_app, :eex, "needle_umbrella/apps/<ctx_app>/test/test_helper.exs"}
])
template(:ctx, [
{:ctx_app, :eex, "needle_ctx/lib/<ctx_lib>.ex"},
{:ctx_app, :eex, "needle_ctx/lib/<ctx_lib>/telemetry.ex"},
{:root_app, :config, "needle_ctx/config/config.exs"},
{:root_app, :config, "needle_ctx/config/dev.exs"},
{:root_app, :config, "needle_ctx/config/prod.exs"},
{:root_app, :config, "needle_ctx/config/test.exs"},
{:root_app, :config_prod, "needle_ctx/config/runtime.exs"}
])
template(:ecto, [
{:ctx_app, :eex, "needle_ctx/lib/<ctx_lib>/repo.ex"},
{:ctx_app, :dir, "needle_ctx/priv/repo/migrations"},
{:ctx_app, :eex, "needle_ctx/priv/repo/migrations/formatter.exs", filename: ".formatter.exs"},
{:ctx_app, :eex, "needle_ctx/priv/repo/seeds.exs"},
{:ctx_app, :eex, "needle_ctx/test/support/data_case.ex"}
])
template(:mailer, [
{:ctx_app, :eex, "needle_ctx/lib/<ctx_lib>/mailer.ex"}
])
template(:web_base_single, [
{:web_app, :eex, "needle_single/lib/<web_lib>/supervisor.ex"}
])
template(:web_base_umbrella, [
{:root_app, :eex, "needle_umbrella/apps/<web_app>/README.md"},
{:root_app, :eex, "needle_umbrella/apps/<web_app>/mix.exs"},
{:root_app, :eex, "needle_umbrella/apps/<web_app>/formatter.exs", filename: ".formatter.exs"},
{:root_app, :eex, "needle_umbrella/apps/<web_app>/gitignore", filename: ".gitignore"},
{:root_app, :eex, "needle_umbrella/apps/<web_app>/lib/<web_lib>/application.ex"},
{:root_app, :eex, "needle_umbrella/apps/<web_app>/test/test_helper.exs"}
])
template(:web, [
{:web_app, :eex, "needle_web/lib/<web_lib>.ex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/telemetry.ex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/endpoint.ex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/router.ex"},
{:web_app, :dir, "needle_web/lib/<web_lib>/controllers"},
{:web_app, :eex, "needle_web/lib/<web_lib>/controllers/error_json.ex"},
{:web_app, :eex, "needle_web/test/support/conn_case.ex"},
{:web_app, :dir, "needle_web/test/<web_lib>/controllers"},
{:web_app, :eex, "needle_web/test/<web_lib>/controllers/error_json_test.exs"},
{:root_app, :config, "needle_web/config/config.exs"},
{:root_app, :config, "needle_web/config/dev.exs"},
{:root_app, :config, "needle_web/config/prod.exs"},
{:root_app, :config, "needle_web/config/test.exs"},
{:root_app, :config_prod, "needle_web/config/runtime.exs"}
])
template(:assets, [
{:web_app, :eex, "needle_web/assets/package.json"},
{:web_app, :eex, "needle_web/assets/app.js"},
{:web_app, :txt, "needle_web/assets/README.md"},
{:web_app, :txt, "needle_web/assets/vite.config.js"},
{:web_app, :txt, "needle_web/assets/tailwind.config.js"},
{:web_app, :txt, "needle_web/assets/public/favicon.ico"},
{:web_app, :txt, "needle_web/assets/public/robots.txt"},
{:web_app, :txt, "needle_web/assets/public/images/gitkeep", filename: ".gitkeep"},
{:web_app, :txt, "needle_web/assets/lib/phoenix/index.js"},
{:web_app, :txt, "needle_web/assets/lib/phoenix/live_reload.css"},
{:web_app, :txt, "needle_web/assets/lib/tailwind/index.css"},
{:web_app, :txt, "needle_web/assets/lib/tailwind/colors.js"}
])
template(:html, [
{:web_app, :eex, "needle_web/lib/<web_lib>/components/layouts.ex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/components/layouts/root.html.heex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/components/layouts/app.html.heex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/components/core_components.ex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/controllers/page_controller.ex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/controllers/page_html.ex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/controllers/page_html/home.html.heex"},
{:web_app, :eex, "needle_web/lib/<web_lib>/controllers/error_html.ex"},
{:web_app, :eex, "needle_web/test/<web_lib>/controllers/page_controller_test.exs"},
{:web_app, :eex, "needle_web/test/<web_lib>/controllers/error_html_test.exs"}
])
template(:live, [
{:web_app, :txt, "needle_web/assets/lib/phoenix_live_view/index.js"}
])
template(:gettext, [
{:web_app, :eex, "needle_web/lib/<web_lib>/gettext.ex"},
{:web_app, :eex, "needle_web/priv/gettext/en/LC_MESSAGES/errors.po"},
{:web_app, :eex, "needle_web/priv/gettext/errors.pot"}
])
@impl true
def prepare_project(%Project{} = _project) do
raise RuntimeError, "use patch/2, instead of this function"
end
@impl true
def generate(%Project{} = _project) do
raise RuntimeError, "use patch/2, instead of this function"
end
def patch(%Project{} = project, name) do
copy_from(project, __MODULE__, name)
end
end