switch mockup generator to UK print providers and add --replace flag

- Prefer Print Clever (72) for canvas, Monster Digital (29) for
  apparel and mugs where available, fall back to default providers
- Rename Art Print products to Canvas (new Satin Canvas blueprint)
- Add Canvas Prints category in Printify tag extraction
- Add --replace/-r flag to purge existing Printify products before
  generating (with interactive confirmation)
- Add purge_all_products/1 to generator module
- Remove old art print mockups, add new canvas + extra provider mockups

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-14 13:00:59 +00:00
parent 5c2f70ce44
commit af207d7a35
78 changed files with 100 additions and 45 deletions

View File

@@ -16,6 +16,9 @@ defmodule Mix.Tasks.GenerateMockups do
# Generate mockups (keeps products in Printify)
mix generate_mockups
# Delete existing products first, then generate fresh ones
mix generate_mockups --replace
# Generate mockups and delete products afterwards
mix generate_mockups --cleanup
@@ -45,12 +48,14 @@ defmodule Mix.Tasks.GenerateMockups do
OptionParser.parse(args,
switches: [
cleanup: :boolean,
replace: :boolean,
search: :string,
list_blueprints: :boolean,
help: :boolean
],
aliases: [
c: :cleanup,
r: :replace,
s: :search,
l: :list_blueprints,
h: :help
@@ -84,6 +89,7 @@ defmodule Mix.Tasks.GenerateMockups do
mix generate_mockups [options]
Options:
--replace, -r Delete ALL existing products from Printify before generating (with confirmation)
--cleanup, -c Delete created products from Printify after downloading mockups
--search, -s TERM Search for blueprints by name
--list-blueprints List all available blueprint IDs and names
@@ -149,12 +155,14 @@ defmodule Mix.Tasks.GenerateMockups do
defp generate_mockups(opts) do
cleanup = Keyword.get(opts, :cleanup, false)
replace = Keyword.get(opts, :replace, false)
Mix.shell().info("""
╔═══════════════════════════════════════════╗
║ Printify Mockup Generator ║
╠═══════════════════════════════════════════╣
║ Replace mode: #{if replace, do: "ON ", else: "OFF"}
║ Cleanup mode: #{if cleanup, do: "ON ", else: "OFF"}
╚═══════════════════════════════════════════╝
@@ -177,6 +185,8 @@ defmodule Mix.Tasks.GenerateMockups do
""")
_token ->
if replace, do: purge_existing_products()
results = MockupGenerator.generate_all(cleanup: cleanup)
# Summary
@@ -200,4 +210,27 @@ defmodule Mix.Tasks.GenerateMockups do
end
end
end
defp purge_existing_products do
alias SimpleshopTheme.Clients.Printify, as: Client
Mix.shell().info("Fetching existing products...")
{:ok, shop_id} = Client.get_shop_id()
{:ok, %{"data" => products}} = Client.list_products(shop_id)
count = length(products)
if count == 0 do
Mix.shell().info("No existing products to delete.\n")
else
Mix.shell().info("Found #{count} existing products in Printify.")
if Mix.shell().yes?("Delete all #{count} products before generating new ones?") do
deleted = MockupGenerator.purge_all_products(shop_id)
Mix.shell().info("Deleted #{deleted} products.\n")
else
Mix.shell().info("Skipping purge.\n")
end
end
end
end