Skip to content

Commit

Permalink
add Surface Catalogue in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoefmoraes committed Feb 27, 2024
1 parent af37f75 commit 0467914
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
14 changes: 12 additions & 2 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import Config

config :esbuild,
catalogue: [
args:
~w(../deps/surface_catalogue/assets/js/app.js --bundle --target=es2017 --minify --outdir=../priv/static/assets/catalogue),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]

# For development, we disable any cache and enable
# debugging and code reloading.
#
Expand All @@ -15,9 +23,10 @@ config :surface_site, SurfaceSiteWeb.Endpoint,
debug_errors: true,
secret_key_base: "qdZaVqRjkIyGWZ50fXKWgziVNqwZTtBLxQiTxBHJpMGXJvDljm+oAEwq+4r+2R4y",
watchers: [
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]},
# TODO: Tailwind
# tailwind: {Tailwind, :install_and_run, [:default, ~w(--watch)]}
esbuild: {Esbuild, :install_and_run, [:catalogue, ~w(--sourcemap=inline --watch)]}
]

# ## SSL Support
Expand Down Expand Up @@ -50,7 +59,8 @@ config :surface_site, SurfaceSiteWeb.Endpoint,
patterns: [
~r{priv/posts/*/.*(md)$},
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"lib/surface_site_web/(controllers|live|components)/.*(ex|heex|sface|js)$"
~r"lib/surface_site_web/(controllers|live|components)/.*(ex|heex|sface|js)$",
~r"priv/catalogue/.*(ex)$"
]
]

Expand Down
9 changes: 9 additions & 0 deletions lib/surface_site_web/router.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule SurfaceSiteWeb.Router do
use SurfaceSiteWeb, :router
import Surface.Catalogue.Router

pipeline :browser do
plug :accepts, ["html"]
Expand Down Expand Up @@ -39,4 +40,12 @@ defmodule SurfaceSiteWeb.Router do
live "/builtincomponents/:component", BuiltinComponents
live "/builtincomponents", BuiltinComponents
end

if Mix.env() == :dev do
scope "/" do
pipe_through :browser

surface_catalogue("/catalogue")
end
end
end
11 changes: 11 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ defmodule SurfaceSite.MixProject do

# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(:dev), do: ["lib"] ++ catalogues()
defp elixirc_paths(_), do: ["lib"]

# Specifies your project dependencies.
Expand All @@ -38,6 +39,7 @@ defmodule SurfaceSite.MixProject do
{:surface_markdown, "~> 0.7.0"},
{:nimble_publisher, "~> 0.1.2"},
{:html_entities, "~> 0.5"},
{:surface_catalogue, "~> 0.6.2"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:floki, ">= 0.30.0", only: :test},
{:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
Expand All @@ -60,4 +62,13 @@ defmodule SurfaceSite.MixProject do
"assets.deploy": ["esbuild default --minify", "phx.digest"]
]
end

def catalogues do
[
# Local catalogue
"priv/catalogue",
# Dependencies catalogues
"deps/surface/priv/catalogue"
]
end
end
2 changes: 2 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
"makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"},
"nimble_publisher": {:hex, :nimble_publisher, "0.1.3", "ee856171ce221662009aecac709f96ed6339d7a6c1da43db7bb75a5016e4848f", [:mix], [{:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "dbcf800c4567d7bb71bb985781d70a55af134f1353c3a49b609d7ca679280e1e"},
Expand All @@ -26,6 +27,7 @@
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"sourceror": {:hex, :sourceror, "1.0.1", "ec2c41726d181adce888ac94b3f33b359a811b46e019c084509e02c70042e424", [:mix], [], "hexpm", "28225464ffd68bda1843c974f3ff7ccef35e29be09a65dfe8e3df3f7e3600c57"},
"surface": {:hex, :surface, "0.11.2", "97f9e0a390d4383ad54d604fd173c558206f7bb66799e0c3225835e0b860086d", [:mix], [{:phoenix_html, "~> 3.3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19.0 or ~> 0.20.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.0.0", [hex: :sourceror, repo: "hexpm", optional: false]}], "hexpm", "71c49daad5b043c5601ca3ee1459f4794287db508f2d33dde5d973bb0e6971cb"},
"surface_catalogue": {:hex, :surface_catalogue, "0.6.2", "4eb9b24904b68ac03018656df3ad3e1f40367331c862444a23f799e729afc863", [:mix], [{:earmark, "~> 1.4.21", [hex: :earmark, repo: "hexpm", optional: false]}, {:esbuild, "~> 0.2", [hex: :esbuild, repo: "hexpm", optional: false]}, {:html_entities, "~> 0.4", [hex: :html_entities, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.16.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:surface, "~> 0.10", [hex: :surface, repo: "hexpm", optional: false]}], "hexpm", "483394613fab00249a69bad9f1089417c4df2070f0b1afcb41495157f542931a"},
"surface_markdown": {:hex, :surface_markdown, "0.7.0", "52c9276895b80c3eb3a998918b1bb94af2129b60a946c9399c62523d5b5ac2b1", [:mix], [{:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:surface, "~> 0.8", [hex: :surface, repo: "hexpm", optional: false]}], "hexpm", "6d449afad866b2a6a5a5de373ba0384191e0129e38ef4e9b7477afe5f9501088"},
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
Expand Down

0 comments on commit 0467914

Please sign in to comment.