- Add @source for shop_components/ directory in app-shop.css (Tailwind wasn't scanning sub-modules after the refactor, dropping ~73 utilities) - Remove overly aggressive .dockerignore rules that excluded mockup image variants needed by the responsive_image component - Seed default theme settings on first boot via Release.seed_defaults/0 in the supervision tree (seeds.exs doesn't run in releases) - Fix PDP gallery images for mock data by appending -1200.webp to bare mockup base paths - Update fly.toml format from fly launch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.2 KiB
Elixir
52 lines
1.2 KiB
Elixir
defmodule SimpleshopTheme.Release do
|
|
@moduledoc """
|
|
Release tasks that can be run via `bin/migrate` or `bin/simpleshop_theme eval`.
|
|
|
|
Migrations run automatically on startup (see Application), so this is mainly
|
|
useful as a standalone tool for debugging or manual recovery.
|
|
"""
|
|
|
|
@app :simpleshop_theme
|
|
|
|
def migrate do
|
|
load_app()
|
|
|
|
for repo <- repos() do
|
|
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
|
|
end
|
|
end
|
|
|
|
@doc """
|
|
Seeds default theme settings if none exist.
|
|
|
|
Called on every boot but only writes to the DB on first run
|
|
(when the settings table is empty). Safe to call repeatedly.
|
|
"""
|
|
def seed_defaults do
|
|
alias SimpleshopTheme.Settings
|
|
|
|
case Settings.get_setting("theme_settings") do
|
|
nil ->
|
|
{:ok, _} = Settings.apply_preset(:studio)
|
|
:ok
|
|
|
|
_exists ->
|
|
:ok
|
|
end
|
|
end
|
|
|
|
def rollback(repo, version) do
|
|
load_app()
|
|
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
|
|
end
|
|
|
|
defp repos do
|
|
Application.fetch_env!(@app, :ecto_repos)
|
|
end
|
|
|
|
defp load_app do
|
|
Application.ensure_all_started(:ssl)
|
|
Application.load(@app)
|
|
end
|
|
end
|